🚀 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.
🚀 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 theBrowserContext. As a result, users must callcontext.setDefaultTimeoutorpage.setTimouton 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.Optionsorcom.microsoft.playwright.Browser.NewContextOptionswith possibility to set the default timeout. The latter would probably be a better choice, as it would also cover non-JUnit environments, whereNewContextOptionscould be centrally populated.Example
In the test class - same as today:
In the
OptionsFactory- new possibility to set the default timeout:Motivation
Provide users with possibility to centrally manage all defaults for the created
BrowserContext/Page.