From 3f60144e0f91da0ff2744d76405ed292d4ef8258 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 27 Jun 2022 15:33:44 -0700 Subject: [PATCH] chore: update driver to 1.23.0 (#968) --- README.md | 2 +- .../main/java/com/microsoft/playwright/Request.java | 5 +++-- .../main/java/com/microsoft/playwright/Response.java | 5 +++-- .../playwright/TestBrowserContextCookies.java | 10 ++++++++-- .../microsoft/playwright/TestBrowserContextHar.java | 2 ++ scripts/CLI_VERSION | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dd9aa3d7..286d5c90 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 103.0.5060.53 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 104.0.5112.20 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 15.4 | ✅ | ✅ | ✅ | | Firefox 100.0.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/playwright/src/main/java/com/microsoft/playwright/Request.java b/playwright/src/main/java/com/microsoft/playwright/Request.java index e776e98a..8c5fa961 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Request.java +++ b/playwright/src/main/java/com/microsoft/playwright/Request.java @@ -58,8 +58,9 @@ public interface Request { */ Frame frame(); /** - * **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use {@link Request#allHeaders - * Request.allHeaders()} instead. + * An object with the request HTTP headers. The header names are lower-cased. Note that this method does not return + * security-related headers, including cookie-related ones. You can use {@link Request#allHeaders Request.allHeaders()} for + * complete list of headers that include {@code cookie} information. */ Map headers(); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/Response.java b/playwright/src/main/java/com/microsoft/playwright/Response.java index 3dbea7fa..3b398b99 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Response.java +++ b/playwright/src/main/java/com/microsoft/playwright/Response.java @@ -45,8 +45,9 @@ public interface Response { */ boolean fromServiceWorker(); /** - * **DEPRECATED** Incomplete list of headers as seen by the rendering engine. Use {@link Response#allHeaders - * Response.allHeaders()} instead. + * An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return + * security-related headers, including cookie-related ones. You can use {@link Response#allHeaders Response.allHeaders()} + * for complete list of headers that include {@code cookie} information. */ Map headers(); /** diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java index fb405932..eee89cba 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java @@ -65,13 +65,19 @@ public class TestBrowserContextCookies extends TestBase { " return document.cookie;\n" + " }"); assertEquals("username=John Doe", documentCookie); - int timestamp = (Integer) page.evaluate("+(new Date('1/1/2038'))/1000"); Cookie cookie = context.cookies().get(0); assertEquals("username", cookie.name); assertEquals("John Doe", cookie.value); assertEquals("localhost", cookie.domain); assertEquals("/", cookie.path); - assertEquals(timestamp, cookie.expires); + // Browsers start to cap cookies with 400 days max expires value. + // See https://github.com/httpwg/http-extensions/pull/1732 + // Chromium patch: https://chromium.googlesource.com/chromium/src/+/aaa5d2b55478eac2ee642653dcd77a50ac3faff6 + // We want to make sure that expires date is at least 400 days in future. + Double timestamp = (Double) page.evaluate("const FOUR_HUNDRED_DAYS = 1000 * 60 * 60 * 24 * 400;\n" + + " const FIVE_MINUTES = 1000 * 60 * 5; // relax condition a bit to make sure test is not flaky.\n" + + " (Date.now() + FOUR_HUNDRED_DAYS - FIVE_MINUTES) / 1000;"); + assertTrue(cookie.expires > timestamp, cookie.expires + " > " + timestamp + " failed."); assertEquals(false, cookie.httpOnly); assertEquals(false, cookie.secure); if (isChromium()) { diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextHar.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextHar.java index 19e83683..72492bc0 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextHar.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextHar.java @@ -19,6 +19,7 @@ package com.microsoft.playwright; import com.microsoft.playwright.options.HarMode; import com.microsoft.playwright.options.HarNotFound; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.api.io.TempDir; import java.io.IOException; @@ -213,6 +214,7 @@ public class TestBrowserContextHar extends TestBase { } @Test + @DisabledIf(value="isFirefox", disabledReason="Flaky in Firefox, upstream as well") void shouldGoForwardToRedirectedNavigation() { Path path = Paths.get("src/test/resources/har-redirect.har"); context.routeFromHAR(path, new BrowserContext.RouteFromHAROptions().setUrl(Pattern.compile(".*theverge.*"))); diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION index 7ac6e08a..a6c2798a 100644 --- a/scripts/CLI_VERSION +++ b/scripts/CLI_VERSION @@ -1 +1 @@ -1.23.0-beta-1656035897000 +1.23.0