Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions playwright/src/test/java/com/microsoft/playwright/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ public class TestBase {
static final boolean isMac = Utils.getOS() == Utils.OS.MAC;
static final boolean isLinux = Utils.getOS() == Utils.OS.LINUX;
static final boolean isWindows = Utils.getOS() == Utils.OS.WINDOWS;
static final boolean headful;
static final boolean headed;
static final SameSiteAttribute defaultSameSiteCookieValue;

static {
String headfulEnv = System.getenv("HEADFUL");
headful = headfulEnv != null && !"0".equals(headfulEnv) && !"false".equals(headfulEnv);
String headedEnv = System.getenv("HEADED");
headed = headedEnv != null && !"0".equals(headedEnv) && !"false".equals(headedEnv);
defaultSameSiteCookieValue = initSameSiteAttribute();
}

// Fields reset before each test.
Page page;
BrowserContext context;

static boolean isHeadful() {
return headful;
static boolean isHeaded() {
return headed;
}

static boolean isChromium() {
Expand All @@ -81,7 +81,7 @@ static String getBrowserChannelFromEnv() {
static BrowserType.LaunchOptions createLaunchOptions() {
BrowserType.LaunchOptions options;
options = new BrowserType.LaunchOptions();
options.headless = !headful;
options.headless = !headed;
options.channel = getBrowserChannelFromEnv();
return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TestBrowserContextCredentials extends TestBase {

static boolean isChromiumHeadedLike() {
// --headless=new, the default in all Chromium channels, is like headless.
return isChromium() && (isHeadful() || getBrowserChannelFromEnv() != null);
return isChromium() && (isHeaded() || getBrowserChannelFromEnv() != null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ void shouldAuthenticate() {
context.close();
}

static boolean isChromiumHeadful() {
return isChromium() && isHeadful();
static boolean isChromiumHeaded() {
return isChromium() && isHeaded();
}

@Test
@DisabledIf(value="isChromiumHeadful", disabledReason="fixme")
@DisabledIf(value="isChromiumHeaded", disabledReason="fixme")
void shouldExcludePatterns() {
server.setRoute("/target.html", exchange -> {
exchange.sendResponseHeaders(200, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void shouldSupportIgnoreHTTPSErrorsOption() {

@Test
void shouldSupportExtraHTTPHeadersOption() throws ExecutionException, InterruptedException {
// TODO: test.flaky(browserName === "firefox" && headful && platform === "linux", "Intermittent timeout on bots");
// TODO: test.flaky(browserName === "firefox" && headed && platform === "linux", "Intermittent timeout on bots");
Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().setExtraHTTPHeaders(mapOf("foo", "bar")));
Future<Server.Request> request = server.futureRequest("/empty.html");
page.navigate(server.EMPTY_PAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ void shouldReportAltClickDownloads() throws IOException {
}


static boolean isChromiumHeadful() {
return isChromium() && isHeadful();
static boolean isChromiumHeaded() {
return isChromium() && isHeaded();
}

@Test
@DisabledIf(value="isChromiumHeadful", disabledReason="fixme")
@DisabledIf(value="isChromiumHeaded", disabledReason="fixme")
void shouldReportNewWindowDownloads() throws IOException {
// TODO: - the test fails in headful Chromium as the popup page gets closed along
// TODO: - the test fails in headed Chromium as the popup page gets closed along
// with the session before download completed event arrives.
// - WebKit doesn't close the popup page
Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

public class TestElementHandleBoundingBox extends TestBase {

static boolean isFirefoxHeadful() {
return isFirefox() && isHeadful();
static boolean isFirefoxHeaded() {
return isFirefox() && isHeaded();
}

@Test
@DisabledIf(value="isFirefoxHeadful", disabledReason="fail")
@DisabledIf(value="isFirefoxHeaded", disabledReason="fail")
void shouldWork() {
page.setViewportSize(500, 500);
page.navigate(server.PREFIX + "/grid.html");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public static String getBrowserChannelFromEnv() {
public static BrowserType.LaunchOptions createLaunchOptions() {
BrowserType.LaunchOptions options;
options = new BrowserType.LaunchOptions();
options.headless = !getHeadful();
options.headless = !getHeaded();
return options;
}

private static boolean getHeadful() {
String headfulEnv = System.getenv("HEADFUL");
return headfulEnv != null && !"0".equals(headfulEnv) && !"false".equals(headfulEnv);
private static boolean getHeaded() {
String headedEnv = System.getenv("HEADED");
return headedEnv != null && !"0".equals(headedEnv) && !"false".equals(headedEnv);
}

public static String getBrowserName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

// TODO: suite.skip(browserName === "firefox" && headful");
// TODO: suite.skip(browserName === "firefox" && headed");
public class TestPageScreenshot extends TestBase {
@Test
void shouldWork() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void shouldUploadAFolder(@TempDir Path tmpDir) throws IOException {
List<String> relativePathsSorted = new ArrayList<>(webkitRelativePaths);
relativePathsSorted.sort(String::compareTo);
// https://issues.chromium.org/issues/345393164
if (isChromium() && !isHeadful() && chromiumVersionLessThan(browser.version(), "127.0.6533.0")) {
if (isChromium() && !isHeaded() && chromiumVersionLessThan(browser.version(), "127.0.6533.0")) {
assertEquals(asList("file-upload-test/file1.txt", "file-upload-test/file2"), relativePathsSorted);
} else {
assertEquals(asList("file-upload-test/file1.txt", "file-upload-test/file2", "file-upload-test/sub-dir/really.txt"), relativePathsSorted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ void shouldWorkWithStatusCode422() {
assertEquals("Yo, page!", page.evaluate("document.body.textContent"));
}

static boolean isFirefoxHeadful() {
return isFirefox() && isHeadful();
static boolean isFirefoxHeaded() {
return isFirefox() && isHeaded();
}

@Test
@DisabledIf(value="isFirefoxHeadful", disabledReason="skip")
@DisabledIf(value="isFirefoxHeaded", disabledReason="skip")
void shouldAllowMockingBinaryResponses() {
page.route("**/*", route -> {
byte[] imageBuffer;
Expand All @@ -85,9 +85,9 @@ void shouldAllowMockingBinaryResponses() {
}

@Test
@DisabledIf(value="isFirefoxHeadful", disabledReason="skip")
@DisabledIf(value="isFirefoxHeaded", disabledReason="skip")
void shouldAllowMockingSvgWithCharset() {
// Firefox headful produces a different image.
// Firefox headed produces a different image.
page.route("**/*", route -> {
route.fulfill(new Route.FulfillOptions()
.setContentType("image/svg+xml ; charset=utf-8")
Expand Down
Loading