From 4e5285950d73598aa4ad197ac2b5562c1d468b8f Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 8 Jun 2023 18:23:19 -0700 Subject: [PATCH] chore: roll to 1.35.0-beta (#1298) --- README.md | 2 +- .../com/microsoft/playwright/APIRequest.java | 4 +- .../com/microsoft/playwright/Browser.java | 84 ++++++++++--------- .../com/microsoft/playwright/BrowserType.java | 36 ++++---- .../microsoft/playwright/ConsoleMessage.java | 2 +- .../java/com/microsoft/playwright/Dialog.java | 2 +- .../microsoft/playwright/ElementHandle.java | 19 ++++- .../com/microsoft/playwright/Locator.java | 21 ++++- .../java/com/microsoft/playwright/Page.java | 19 ++++- .../assertions/LocatorAssertions.java | 80 +++++++++--------- .../playwright/assertions/PageAssertions.java | 8 +- .../playwright/impl/BrowserContextImpl.java | 2 +- .../microsoft/playwright/impl/PageImpl.java | 11 ++- .../microsoft/playwright/impl/RouteImpl.java | 11 ++- .../playwright/impl/TimeoutSettings.java | 8 +- .../com/microsoft/playwright/impl/Utils.java | 15 ++-- .../playwright/TestPageScreenshot.java | 16 ++++ .../playwright/TestPageSetInputFiles.java | 29 +++++++ .../com/microsoft/playwright/TestWorkers.java | 8 ++ .../resources/input/fileupload-multi.html | 12 +++ scripts/CLI_VERSION | 2 +- 21 files changed, 267 insertions(+), 124 deletions(-) create mode 100644 playwright/src/test/resources/input/fileupload-multi.html diff --git a/README.md b/README.md index 5d895bef..4adc12a2 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 114.0.5735.35 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 115.0.5790.13 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 16.4 | ✅ | ✅ | ✅ | | Firefox 113.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java index 1f650988..5cfdbde1 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java @@ -42,7 +42,7 @@ public interface APIRequest { */ public String baseURL; /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public Map extraHTTPHeaders; /** @@ -100,7 +100,7 @@ public interface APIRequest { return this; } /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public NewContextOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 5a77201c..b418332e 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -66,7 +66,7 @@ public interface Browser extends AutoCloseable { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *
    *
  • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
  • @@ -78,7 +78,7 @@ public interface Browser extends AutoCloseable { */ public String baseURL; /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public Boolean bypassCSP; /** @@ -93,7 +93,7 @@ public interface Browser extends AutoCloseable { */ public Double deviceScaleFactor; /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public Map extraHTTPHeaders; /** @@ -130,8 +130,9 @@ public interface Browser extends AutoCloseable { public Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public String locale; /** @@ -141,11 +142,11 @@ public interface Browser extends AutoCloseable { public Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public List permissions; /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

    NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -220,13 +221,14 @@ public interface Browser extends AutoCloseable { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public Boolean strictSelectors; /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public String timezoneId; /** @@ -255,7 +257,7 @@ public interface Browser extends AutoCloseable { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *

      *
    • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
    • @@ -270,7 +272,7 @@ public interface Browser extends AutoCloseable { return this; } /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public NewContextOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; @@ -294,7 +296,7 @@ public interface Browser extends AutoCloseable { return this; } /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public NewContextOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; @@ -365,8 +367,9 @@ public interface Browser extends AutoCloseable { } /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public NewContextOptions setLocale(String locale) { this.locale = locale; @@ -382,14 +385,14 @@ public interface Browser extends AutoCloseable { } /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public NewContextOptions setPermissions(List permissions) { this.permissions = permissions; return this; } /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

      NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -399,7 +402,7 @@ public interface Browser extends AutoCloseable { return setProxy(new Proxy(server)); } /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

      NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -532,7 +535,8 @@ public interface Browser extends AutoCloseable { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public NewContextOptions setStrictSelectors(boolean strictSelectors) { this.strictSelectors = strictSelectors; @@ -541,7 +545,7 @@ public interface Browser extends AutoCloseable { /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public NewContextOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; @@ -588,7 +592,7 @@ public interface Browser extends AutoCloseable { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *

        *
      • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
      • @@ -600,7 +604,7 @@ public interface Browser extends AutoCloseable { */ public String baseURL; /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public Boolean bypassCSP; /** @@ -615,7 +619,7 @@ public interface Browser extends AutoCloseable { */ public Double deviceScaleFactor; /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public Map extraHTTPHeaders; /** @@ -652,8 +656,9 @@ public interface Browser extends AutoCloseable { public Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public String locale; /** @@ -663,11 +668,11 @@ public interface Browser extends AutoCloseable { public Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public List permissions; /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

        NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -742,13 +747,14 @@ public interface Browser extends AutoCloseable { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public Boolean strictSelectors; /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public String timezoneId; /** @@ -777,7 +783,7 @@ public interface Browser extends AutoCloseable { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *

          *
        • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
        • @@ -792,7 +798,7 @@ public interface Browser extends AutoCloseable { return this; } /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public NewPageOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; @@ -816,7 +822,7 @@ public interface Browser extends AutoCloseable { return this; } /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public NewPageOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; @@ -887,8 +893,9 @@ public interface Browser extends AutoCloseable { } /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public NewPageOptions setLocale(String locale) { this.locale = locale; @@ -904,14 +911,14 @@ public interface Browser extends AutoCloseable { } /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public NewPageOptions setPermissions(List permissions) { this.permissions = permissions; return this; } /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

          NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -921,7 +928,7 @@ public interface Browser extends AutoCloseable { return setProxy(new Proxy(server)); } /** - * Network proxy settings to use with this context. + * Network proxy settings to use with this context. Defaults to none. * *

          NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts * override the proxy, global proxy will be never used and can be any string, for example {@code launch({ proxy: { server: @@ -1054,7 +1061,8 @@ public interface Browser extends AutoCloseable { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public NewPageOptions setStrictSelectors(boolean strictSelectors) { this.strictSelectors = strictSelectors; @@ -1063,7 +1071,7 @@ public interface Browser extends AutoCloseable { /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public NewPageOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 06da4d06..6983b3a6 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -382,7 +382,7 @@ public interface BrowserType { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *

            *
          • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
          • @@ -394,7 +394,7 @@ public interface BrowserType { */ public String baseURL; /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public Boolean bypassCSP; /** @@ -440,7 +440,7 @@ public interface BrowserType { */ public Path executablePath; /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public Map extraHTTPHeaders; /** @@ -506,8 +506,9 @@ public interface BrowserType { public Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public String locale; /** @@ -517,7 +518,7 @@ public interface BrowserType { public Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public List permissions; /** @@ -585,7 +586,8 @@ public interface BrowserType { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public Boolean strictSelectors; /** @@ -596,7 +598,7 @@ public interface BrowserType { /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public String timezoneId; /** @@ -637,7 +639,7 @@ public interface BrowserType { * Page.waitForURL()}, {@link Page#waitForRequest Page.waitForRequest()}, or {@link Page#waitForResponse * Page.waitForResponse()} it takes the base URL in consideration by using the {@code URL()} constructor for building the - * corresponding URL. Examples: + * corresponding URL. Unset by default. Examples: *
              *
            • baseURL: {@code http://localhost:3000} and navigating to {@code /bar.html} results in {@code * http://localhost:3000/bar.html}
            • @@ -652,7 +654,7 @@ public interface BrowserType { return this; } /** - * Toggles bypassing page's Content-Security-Policy. + * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ public LaunchPersistentContextOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; @@ -735,7 +737,7 @@ public interface BrowserType { return this; } /** - * An object containing additional HTTP headers to be sent with every request. + * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ public LaunchPersistentContextOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; @@ -853,8 +855,9 @@ public interface BrowserType { } /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, - * {@code Accept-Language} request header value as well as number and date formatting rules. Learn more about emulation in - * our emulation guide. + * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default + * locale. Learn more about emulation in our emulation guide. */ public LaunchPersistentContextOptions setLocale(String locale) { this.locale = locale; @@ -870,7 +873,7 @@ public interface BrowserType { } /** * A list of permissions to grant to all pages in this context. See {@link BrowserContext#grantPermissions - * BrowserContext.grantPermissions()} for more details. + * BrowserContext.grantPermissions()} for more details. Defaults to none. */ public LaunchPersistentContextOptions setPermissions(List permissions) { this.permissions = permissions; @@ -1002,7 +1005,8 @@ public interface BrowserType { /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not - * affect any Locator APIs (Locators are always strict). See {@code Locator} to learn more about the strict mode. + * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about + * the strict mode. */ public LaunchPersistentContextOptions setStrictSelectors(boolean strictSelectors) { this.strictSelectors = strictSelectors; @@ -1019,7 +1023,7 @@ public interface BrowserType { /** * Changes the timezone of the context. See ICU's - * metaZones.txt for a list of supported timezone IDs. + * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ public LaunchPersistentContextOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; diff --git a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java index 577a5e6f..3b1ed5d4 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java +++ b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java @@ -59,7 +59,7 @@ public interface ConsoleMessage { /** * The page that produced this console message, if any. * - * @since v1.33 + * @since v1.34 */ Page page(); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/Dialog.java b/playwright/src/main/java/com/microsoft/playwright/Dialog.java index b6964e3c..597d66a0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Dialog.java +++ b/playwright/src/main/java/com/microsoft/playwright/Dialog.java @@ -84,7 +84,7 @@ public interface Dialog { /** * The page that initiated this dialog, if available. * - * @since v1.33 + * @since v1.34 */ Page page(); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index a4a691b0..29d9477c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -602,9 +602,15 @@ public interface ElementHandle extends JSHandle { public ScreenshotCaret caret; /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public List mask; + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public String maskColor; /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. @@ -663,12 +669,21 @@ public interface ElementHandle extends JSHandle { } /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public ScreenshotOptions setMask(List mask) { this.mask = mask; return this; } + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public ScreenshotOptions setMaskColor(String maskColor) { + this.maskColor = maskColor; + return this; + } /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. diff --git a/playwright/src/main/java/com/microsoft/playwright/Locator.java b/playwright/src/main/java/com/microsoft/playwright/Locator.java index 272857f6..e106f465 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Locator.java +++ b/playwright/src/main/java/com/microsoft/playwright/Locator.java @@ -1407,9 +1407,15 @@ public interface Locator { public ScreenshotCaret caret; /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public List mask; + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public String maskColor; /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. @@ -1468,12 +1474,21 @@ public interface Locator { } /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public ScreenshotOptions setMask(List mask) { this.mask = mask; return this; } + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public ScreenshotOptions setMaskColor(String maskColor) { + this.maskColor = maskColor; + return this; + } /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. @@ -2067,7 +2082,7 @@ public interface Locator { * } * * @param locator Additional locator to match. - * @since v1.33 + * @since v1.34 */ Locator and(Locator locator); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java index f0f04b22..ca4598c8 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Page.java +++ b/playwright/src/main/java/com/microsoft/playwright/Page.java @@ -2407,9 +2407,15 @@ public interface Page extends AutoCloseable { public Boolean fullPage; /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public List mask; + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public String maskColor; /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. @@ -2489,12 +2495,21 @@ public interface Page extends AutoCloseable { } /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box - * {@code #FF00FF} that completely covers its bounding box. + * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. */ public ScreenshotOptions setMask(List mask) { this.mask = mask; return this; } + /** + * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code + * #FF00FF}. + */ + public ScreenshotOptions setMaskColor(String maskColor) { + this.maskColor = maskColor; + return this; + } /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. diff --git a/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java b/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java index d02b3526..c2318052 100644 --- a/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java +++ b/playwright/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java @@ -40,7 +40,7 @@ public interface LocatorAssertions { class IsAttachedOptions { public Boolean attached; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; @@ -49,7 +49,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsAttachedOptions setTimeout(double timeout) { this.timeout = timeout; @@ -59,7 +59,7 @@ public interface LocatorAssertions { class IsCheckedOptions { public Boolean checked; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; @@ -68,7 +68,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsCheckedOptions setTimeout(double timeout) { this.timeout = timeout; @@ -77,12 +77,12 @@ public interface LocatorAssertions { } class IsDisabledOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsDisabledOptions setTimeout(double timeout) { this.timeout = timeout; @@ -92,7 +92,7 @@ public interface LocatorAssertions { class IsEditableOptions { public Boolean editable; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; @@ -101,7 +101,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsEditableOptions setTimeout(double timeout) { this.timeout = timeout; @@ -110,12 +110,12 @@ public interface LocatorAssertions { } class IsEmptyOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsEmptyOptions setTimeout(double timeout) { this.timeout = timeout; @@ -125,7 +125,7 @@ public interface LocatorAssertions { class IsEnabledOptions { public Boolean enabled; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; @@ -134,7 +134,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsEnabledOptions setTimeout(double timeout) { this.timeout = timeout; @@ -143,12 +143,12 @@ public interface LocatorAssertions { } class IsFocusedOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsFocusedOptions setTimeout(double timeout) { this.timeout = timeout; @@ -157,12 +157,12 @@ public interface LocatorAssertions { } class IsHiddenOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsHiddenOptions setTimeout(double timeout) { this.timeout = timeout; @@ -176,7 +176,7 @@ public interface LocatorAssertions { */ public Double ratio; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; @@ -189,7 +189,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsInViewportOptions setTimeout(double timeout) { this.timeout = timeout; @@ -198,13 +198,13 @@ public interface LocatorAssertions { } class IsVisibleOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; public Boolean visible; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public IsVisibleOptions setTimeout(double timeout) { this.timeout = timeout; @@ -222,7 +222,7 @@ public interface LocatorAssertions { */ public Boolean ignoreCase; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** @@ -239,7 +239,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public ContainsTextOptions setTimeout(double timeout) { this.timeout = timeout; @@ -255,12 +255,12 @@ public interface LocatorAssertions { } class HasAttributeOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasAttributeOptions setTimeout(double timeout) { this.timeout = timeout; @@ -269,12 +269,12 @@ public interface LocatorAssertions { } class HasClassOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasClassOptions setTimeout(double timeout) { this.timeout = timeout; @@ -283,12 +283,12 @@ public interface LocatorAssertions { } class HasCountOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasCountOptions setTimeout(double timeout) { this.timeout = timeout; @@ -297,12 +297,12 @@ public interface LocatorAssertions { } class HasCSSOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasCSSOptions setTimeout(double timeout) { this.timeout = timeout; @@ -311,12 +311,12 @@ public interface LocatorAssertions { } class HasIdOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasIdOptions setTimeout(double timeout) { this.timeout = timeout; @@ -325,12 +325,12 @@ public interface LocatorAssertions { } class HasJSPropertyOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasJSPropertyOptions setTimeout(double timeout) { this.timeout = timeout; @@ -344,7 +344,7 @@ public interface LocatorAssertions { */ public Boolean ignoreCase; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** @@ -361,7 +361,7 @@ public interface LocatorAssertions { return this; } /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasTextOptions setTimeout(double timeout) { this.timeout = timeout; @@ -377,12 +377,12 @@ public interface LocatorAssertions { } class HasValueOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasValueOptions setTimeout(double timeout) { this.timeout = timeout; @@ -391,12 +391,12 @@ public interface LocatorAssertions { } class HasValuesOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasValuesOptions setTimeout(double timeout) { this.timeout = timeout; diff --git a/playwright/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java b/playwright/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java index 9d46459e..c5784736 100644 --- a/playwright/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java +++ b/playwright/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java @@ -39,12 +39,12 @@ import java.util.regex.Pattern; public interface PageAssertions { class HasTitleOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasTitleOptions setTimeout(double timeout) { this.timeout = timeout; @@ -53,12 +53,12 @@ public interface PageAssertions { } class HasURLOptions { /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public Double timeout; /** - * Time to retry the assertion for. + * Time to retry the assertion for in milliseconds. Defaults to {@code 5000}. */ public HasURLOptions setTimeout(double timeout) { this.timeout = timeout; diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java index f5f74b8f..768a336f 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java @@ -580,7 +580,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext { updateInterceptionPatterns(); } if (handled == Router.HandleResult.NoMatchingHandler || handled == Router.HandleResult.Fallback) { - route.resume(); + route.resume(null, true); } } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java index 1f92bcb6..201e1a17 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java @@ -936,7 +936,16 @@ public class PageImpl extends ChannelOwner implements Page { @Override public void pause() { withLogging("Page.pause", () -> { - runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable) waitableClosedOrCrashed))); + Double defaultNavigationTimeout = browserContext.timeoutSettings.defaultNavigationTimeout(); + Double defaultTimeout = browserContext.timeoutSettings.defaultTimeout(); + browserContext.setDefaultNavigationTimeout(0); + browserContext.setDefaultTimeout(0); + try { + runUntil(() -> {}, new WaitableRace<>(asList(context().pause(), (Waitable) waitableClosedOrCrashed))); + } finally { + browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout); + browserContext.setDefaultTimeout(defaultTimeout); + } }); } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/RouteImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/RouteImpl.java index 2c08b81f..3bf5a65c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/RouteImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/RouteImpl.java @@ -58,9 +58,13 @@ public class RouteImpl extends ChannelOwner implements Route { @Override public void resume(ResumeOptions options) { + resume(options, false); + } + + void resume(ResumeOptions options, boolean isFallback) { startHandling(); applyOverrides(convertType(options, FallbackOptions.class)); - withLogging("Route.resume", () -> resumeImpl(request().fallbackOverridesForResume())); + withLogging("Route.resume", () -> resumeImpl(request().fallbackOverridesForResume(), isFallback)); } @Override @@ -71,7 +75,7 @@ public class RouteImpl extends ChannelOwner implements Route { } applyOverrides(options); if (shouldResumeIfFallbackIsCalled) { - resume(); + resume(null, true); } } @@ -114,7 +118,7 @@ public class RouteImpl extends ChannelOwner implements Route { request().applyFallbackOverrides(overrides); } - private void resumeImpl(RequestImpl.FallbackOverrides options) { + private void resumeImpl(RequestImpl.FallbackOverrides options, boolean isFallback) { JsonObject params = new JsonObject(); if (options != null) { if (options.url != null) { @@ -132,6 +136,7 @@ public class RouteImpl extends ChannelOwner implements Route { } } params.addProperty("requestUrl", request.initializer.get("url").getAsString()); + params.addProperty("isFallback", isFallback); sendMessageAsync("continue", params); } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java b/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java index 8d1a1a84..9507502e 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java @@ -30,6 +30,13 @@ class TimeoutSettings { this.parent = parent; } + Double defaultTimeout() { + return defaultTimeout; + } + Double defaultNavigationTimeout() { + return defaultNavigationTimeout; + } + void setDefaultTimeout(double timeout) { defaultTimeout = timeout; } @@ -73,5 +80,4 @@ class TimeoutSettings { } return new WaitableTimeout<>(timeout(timeout)); } - } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java b/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java index 0346e5dc..8200aa31 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java @@ -162,16 +162,15 @@ class Utils { static final int maxUplodBufferSize = 50 * 1024 * 1024; static boolean hasLargeFile(Path[] files) { + int totalSize = 0; for (Path file: files) { try { - if (Files.size(file)> maxUplodBufferSize) { - return true; - } + totalSize += Files.size(file); } catch (IOException e) { throw new PlaywrightException("Cannot get file size.", e); } } - return false; + return totalSize > maxUplodBufferSize; } static void addLargeFileUploadParams(Path[] files, JsonObject params, BrowserContextImpl context) { @@ -202,10 +201,12 @@ class Utils { } static void checkFilePayloadSize(FilePayload[] files) { + int totalSize = 0; for (FilePayload file: files) { - if (file.buffer.length > maxUplodBufferSize) { - throw new PlaywrightException("Cannot set buffer larger than 50Mb, please write it to a file and pass its path instead."); - } + totalSize += file.buffer.length; + } + if (totalSize > maxUplodBufferSize) { + throw new PlaywrightException("Cannot set buffer larger than 50Mb, please write it to a file and pass its path instead."); } } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java b/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java index cc82a573..3c901a57 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java @@ -35,6 +35,7 @@ import java.util.Arrays; import static com.microsoft.playwright.options.ScreenshotAnimations.DISABLED; 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"); public class TestPageScreenshot extends TestBase { @@ -233,4 +234,19 @@ public class TestPageScreenshot extends TestBase { } assertTrue(hasDifferentScreenshots); } + + @Test + void shouldWorkWhenMaskColorIsNotPinkF0F() { + page.setViewportSize(500, 500); + page.navigate(server.PREFIX + "/grid.html"); + byte[] screenshot1 = page.screenshot( + new Page.ScreenshotOptions() + .setMask(asList(page.locator("div").nth(5))) + .setMaskColor("#00FF00")); + byte[] screenshot2 = page.screenshot( + new Page.ScreenshotOptions() + .setMask(asList(page.locator("div").nth(5)))); + assertThrows(AssertionError.class, () -> assertArrayEquals(screenshot1, screenshot2)); + } + } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java b/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java index 3c7b0c25..d17e0abb 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import com.microsoft.playwright.options.AriaRole; import com.microsoft.playwright.options.FilePayload; import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.Test; @@ -96,6 +97,34 @@ public class TestPageSetInputFiles extends TestBase { assertEquals(200 * 1024 * 1024, fields.get(0).content.length()); } + @Test + void shouldUploadMultipleLargeFiles(@TempDir Path tmpDir) throws IOException, ExecutionException, InterruptedException { + Assumptions.assumeTrue(3 <= (Runtime.getRuntime().maxMemory() >> 30), "Fails if max heap size is < 3Gb"); + int filesCount = 10; + page.navigate(server.PREFIX + "/input/fileupload-multi.html"); + Path uploadFile = tmpDir.resolve("50MB_1.zip"); + String str = String.join("", Collections.nCopies(1024, "A")); + + try (Writer stream = new OutputStreamWriter(Files.newOutputStream(uploadFile))) { + for (int i = 0; i < 49 * 1024; i++) { + stream.write(str); + } + } + Locator input = page.locator("input[type='file']"); + List uploadFiles = new ArrayList<>(); + uploadFiles.add(uploadFile); + for (int i = 1; i < filesCount; i++) { + Path dstFile = tmpDir.resolve("50MB_" + i + ".zip"); + Files.copy(uploadFile, dstFile); + uploadFiles.add(dstFile); + } + FileChooser fileChooser = page.waitForFileChooser(() -> input.click()); + fileChooser.setFiles(uploadFiles.toArray(new Path[0])); + Object filesLen = page.getByRole(AriaRole.TEXTBOX).evaluate("e => e.files.length"); + assertTrue(fileChooser.isMultiple()); + assertEquals(filesCount, filesLen); + } + @Test void shouldUploadLargeFileWithRelativePath(@TempDir Path tmpDir) throws IOException, ExecutionException, InterruptedException { Assumptions.assumeTrue(3 <= (Runtime.getRuntime().maxMemory() >> 30), "Fails if max heap size is < 3Gb"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java b/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java index ca86e928..aa99d015 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.api.condition.EnabledIf; @@ -28,6 +29,11 @@ import static org.junit.jupiter.api.Assertions.*; public class TestWorkers extends TestBase { + private int browserMajorVersion() { + String version = browser.version(); + return Integer.parseInt(version.split("\\.")[0]); + } + @Test void pageWorkers() { Worker worker = page.waitForWorker(() -> page.navigate(server.PREFIX + "/worker/worker.html")); @@ -145,6 +151,7 @@ public class TestWorkers extends TestBase { @Test void shouldReportNetworkActivity() { + Assumptions.assumeFalse(isFirefox() && browserMajorVersion() < 114); Worker worker = page.waitForWorker(() -> page.navigate(server.PREFIX + "/worker/worker.html")); String url = server.PREFIX + "/one-style.css"; Request[] request = {null}; @@ -160,6 +167,7 @@ public class TestWorkers extends TestBase { @Test void shouldReportNetworkActivityOnWorkerCreation() { + Assumptions.assumeFalse(isFirefox() && browserMajorVersion() < 114); // Chromium needs waitForDebugger enabled for this one. page.navigate(server.EMPTY_PAGE); String url = server.PREFIX + "/one-style.css"; diff --git a/playwright/src/test/resources/input/fileupload-multi.html b/playwright/src/test/resources/input/fileupload-multi.html new file mode 100644 index 00000000..05dd5a22 --- /dev/null +++ b/playwright/src/test/resources/input/fileupload-multi.html @@ -0,0 +1,12 @@ + + + + File upload test + + +
              + + +
              + + diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION index 00e952d0..d86c6fe1 100644 --- a/scripts/CLI_VERSION +++ b/scripts/CLI_VERSION @@ -1 +1 @@ -1.34.2 +1.35.0-beta-1686201102000