mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-27 18:04:25 +00:00
chore: rename headful -> headed (#1835)
This commit is contained in:
parent
fd2ab4708a
commit
aee298b293
@ -45,12 +45,12 @@ 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();
|
||||
}
|
||||
|
||||
@ -58,8 +58,8 @@ public class TestBase {
|
||||
Page page;
|
||||
BrowserContext context;
|
||||
|
||||
static boolean isHeadful() {
|
||||
return headful;
|
||||
static boolean isHeaded() {
|
||||
return headed;
|
||||
}
|
||||
|
||||
static boolean isChromium() {
|
||||
@ -81,7 +81,7 @@ public class TestBase {
|
||||
static BrowserType.LaunchOptions createLaunchOptions() {
|
||||
BrowserType.LaunchOptions options;
|
||||
options = new BrowserType.LaunchOptions();
|
||||
options.headless = !headful;
|
||||
options.headless = !headed;
|
||||
options.channel = getBrowserChannelFromEnv();
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -129,12 +129,12 @@ public class TestBrowserContextProxy extends TestBase {
|
||||
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);
|
||||
|
||||
@ -128,7 +128,7 @@ public class TestDefaultBrowserContext2 extends TestBase {
|
||||
|
||||
@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);
|
||||
|
||||
@ -341,14 +341,14 @@ public class TestDownload extends TestBase {
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
|
||||
@ -26,12 +26,12 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
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");
|
||||
|
||||
@ -35,13 +35,13 @@ public class TestOptionsFactories {
|
||||
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() {
|
||||
|
||||
@ -40,7 +40,7 @@ import static java.util.Arrays.asList;
|
||||
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 {
|
||||
|
||||
@ -451,7 +451,7 @@ public class TestPageSetInputFiles extends TestBase {
|
||||
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);
|
||||
|
||||
@ -55,12 +55,12 @@ public class TestRequestFulfill extends TestBase {
|
||||
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;
|
||||
@ -85,9 +85,9 @@ public class TestRequestFulfill extends TestBase {
|
||||
}
|
||||
|
||||
@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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user