Package com.microsoft.playwright.junit
Annotation Type UsePlaywright
-
@ExtendWith({OptionsExtension.class,PlaywrightExtension.class,BrowserExtension.class,BrowserContextExtension.class,PageExtension.class,APIRequestContextExtension.class}) @Retention(RUNTIME) @Target(TYPE) @Inherited public @interface UsePlaywrightNOTE: this API is experimental and is subject to changes. Use@UsePlaywrightannotation to automatically manage Playwright objects used in your test. Custom configuration can be provided by implementingOptionsFactoryand passing the class as a parameter.When a test class is annotated with
@UsePlaywrighteach test method can use any of the following arguments that will be automatically created at run time:PageandBrowserContextare created before each test and closed after the test has finished.BrowserandPlaywrightare reused between tests for better efficiency.An example of using
@UsePlaywrightannotation:{@code import com.microsoft.playwright.Browser; import com.microsoft.playwright.BrowserContext; import com.microsoft.playwright.Page; import org.junit.jupiter.api.Test; import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<? extends OptionsFactory>value
-
-
-
Element Detail
-
value
Class<? extends OptionsFactory> value
- Default:
- com.microsoft.playwright.impl.junit.DefaultOptions.class
-
-