microsoft / microsoft/playwright-java
[Feature]: Java / JUnit - add possibility to configure default timeout
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 298
- Merge medio
- 3g 2h
- PR unite (30g)
- 14
Descrizione
🚀 Feature Request
Status Quo
JUnit support (https://playwright.dev/java/docs/junit) allows to inject a pre-configured instances of Page, BrowserContext, etc. into a test method. Users are able to configure various settings, but not the default timeout on the BrowserContext. As a result, users must call context.setDefaultTimeout or page.setTimout on each injected instance, which is both error prone and increases the amount of ceremonies inside the test code, distracting from its business goals.
Improvement Suggestion
Extend com.microsoft.playwright.junit.Options or com.microsoft.playwright.Browser.NewContextOptions with possibility to set the default timeout. The latter would probably be a better choice, as it would also cover non-JUnit environments, where NewContextOptions could be centrally populated.
Example
In the test class - same as today:
@UsePlaywright(MyOptions.class)
class MyTest {
...
}
In the OptionsFactory - new possibility to set the default timeout:
class MyOptions extends OptionsFactory {
@Override
public Options getOptions() {
return new Options()
....
.setContextOptions(
new Browser.NewContextOptions()
....
.setDefaultTimeout(10_000)
);
}
Motivation
Provide users with possibility to centrally manage all defaults for the created BrowserContext / Page.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’API di supporto JUnit, in particolare com.microsoft.playwright.junit.Options e OptionsFactory, quindi esamina Browser.NewContextOptions. Determina quale opzione dovrebbe gestire il timeout predefinito e come questo raggiunge le istanze iniettate di BrowserContext e Page. Il lavoro è completato quando gli utenti possono configurare centralmente il timeout tramite il pattern OptionsFactory mostrato, anche al di fuori di JUnit, dove viene usato NewContextOptions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100