1
0
mirror of synced 2026-05-22 18:53:15 +00:00

feat(junit): make getOrCreate fixture methods public (#1527)

This commit is contained in:
uchagani
2024-03-29 12:21:35 -04:00
committed by GitHub
parent e7653ddde7
commit 240f8d0873
5 changed files with 35 additions and 5 deletions
@@ -48,7 +48,13 @@ public class APIRequestContextExtension implements ParameterResolver, BeforeEach
return getOrCreateAPIRequestContext(extensionContext);
}
static APIRequestContext getOrCreateAPIRequestContext(ExtensionContext extensionContext) {
/**
* Returns the APIRequestContext that belongs to the current test. Will be created if it doesn't already exist.
* <strong>NOTE:</strong> this method is subject to change.
* @param extensionContext the context in which the current test or container is being executed.
* @return The APIRequestContext that belongs to the current test.
*/
public static APIRequestContext getOrCreateAPIRequestContext(ExtensionContext extensionContext) {
APIRequestContext apiRequestContext = threadLocalAPIRequestContext.get();
if (apiRequestContext != null) {
return apiRequestContext;
@@ -48,7 +48,13 @@ public class BrowserContextExtension implements ParameterResolver, AfterEachCall
return getOrCreateBrowserContext(extensionContext);
}
static BrowserContext getOrCreateBrowserContext(ExtensionContext extensionContext) {
/**
* Returns the BrowserContext that belongs to the current test. Will be created if it doesn't already exist.
* <strong>NOTE:</strong> this method is subject to change.
* @param extensionContext the context in which the current test or container is being executed.
* @return The BrowserContext that belongs to the current test.
*/
public static BrowserContext getOrCreateBrowserContext(ExtensionContext extensionContext) {
BrowserContext browserContext = threadLocalBrowserContext.get();
if (browserContext != null) {
return browserContext;
@@ -47,7 +47,13 @@ public class BrowserExtension implements ParameterResolver, AfterAllCallback {
return getOrCreateBrowser(extensionContext);
}
static Browser getOrCreateBrowser(ExtensionContext extensionContext) {
/**
* Returns the Browser that belongs to the current test. Will be created if it doesn't already exist.
* <strong>NOTE:</strong> this method is subject to change.
* @param extensionContext the context in which the current test or container is being executed.
* @return The Browser that belongs to the current test.
*/
public static Browser getOrCreateBrowser(ExtensionContext extensionContext) {
Browser browser = threadLocalBrowser.get();
if (browser != null) {
return browser;
@@ -45,7 +45,13 @@ public class PageExtension implements ParameterResolver, AfterEachCallback {
return getOrCreatePage(extensionContext);
}
static Page getOrCreatePage(ExtensionContext extensionContext) {
/**
* Returns the Page that belongs to the current test. Will be created if it doesn't already exist.
* <strong>NOTE:</strong> this method is subject to change.
* @param extensionContext the context in which the current test or container is being executed.
* @return The Page that belongs to the current test.
*/
public static Page getOrCreatePage(ExtensionContext extensionContext) {
Page page = threadLocalPage.get();
if (page != null) {
return page;
@@ -79,7 +79,13 @@ public class PlaywrightExtension implements ParameterResolver {
return getOrCreatePlaywright(extensionContext);
}
static Playwright getOrCreatePlaywright(ExtensionContext extensionContext) {
/**
* Returns the Playwright that belongs to the current test. Will be created if it doesn't already exist.
* <strong>NOTE:</strong> this method is subject to change.
* @param extensionContext the context in which the current test or container is being executed.
* @return The Playwright that belongs to the current test.
*/
public static Playwright getOrCreatePlaywright(ExtensionContext extensionContext) {
Playwright playwright = threadLocalPlaywright.get();
if (playwright != null) {
return playwright;