microsoft / microsoft/playwright-java
[Feature]: Java / JUnit - add possibility to configure default timeout
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 1.6k
- Forks
- 298
- Merge medio
- 3 d 2 h
- PR fusionados (30 d)
- 14
Descripción
🚀 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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la API de soporte de JUnit, especialmente com.microsoft.playwright.junit.Options y OptionsFactory, y después inspecciona Browser.NewContextOptions. Determina qué opción debe ser la propietaria del timeout predeterminado y cómo llega a las instancias inyectadas de BrowserContext y Page. La tarea está terminada cuando los usuarios pueden configurar el timeout de forma centralizada mediante el patrón de OptionsFactory mostrado, incluso fuera de JUnit, donde se usa NewContextOptions.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- testing-qa
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100