From b4100a4d681e6abe17835da8a65a68496a5ece07 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 18 Nov 2021 16:52:36 -0800 Subject: [PATCH] chore: roll driver to 1.18.0-alpha-1637257604000 (#711) --- README.md | 2 +- .../assertions/LocatorAssertions.java | 508 +++++++++--------- .../playwright/assertions/PageAssertions.java | 16 +- .../impl/LocatorAssertionsImpl.java | 6 + .../com/microsoft/playwright/impl/Utils.java | 2 +- .../playwright/TestBrowserContextFetch.java | 2 +- scripts/CLI_VERSION | 2 +- 7 files changed, 282 insertions(+), 256 deletions(-) diff --git a/README.md b/README.md index 0498f5c4..8207cbb5 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 98.0.4695.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 98.0.4708.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 15.4 | ✅ | ✅ | ✅ | | Firefox 94.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java b/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java index 4a1e2066..46500180 100644 --- a/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java +++ b/assertions/src/main/java/com/microsoft/playwright/assertions/LocatorAssertions.java @@ -40,6 +40,118 @@ import com.microsoft.playwright.Locator; * } */ public interface LocatorAssertions { + class IsCheckedOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsCheckedOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsDisabledOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsDisabledOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsEditableOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsEditableOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsEmptyOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsEmptyOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsEnabledOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsEnabledOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsFocusedOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsFocusedOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsHiddenOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsHiddenOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } + class IsVisibleOptions { + /** + * Time to retry the assertion for. + */ + public Double timeout; + + /** + * Time to retry the assertion for. + */ + public IsVisibleOptions setTimeout(double timeout) { + this.timeout = timeout; + return this; + } + } class ContainsTextOptions { /** * Time to retry the assertion for. @@ -188,118 +300,146 @@ public interface LocatorAssertions { return this; } } - class IsCheckedOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsCheckedOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text + * {@code "error"}: + *
{@code
+   * assertThat(locator).not().containsText("error");
+   * }
+ */ + LocatorAssertions not(); + /** + * Ensures the {@code Locator} points to a checked input. + *
{@code
+   * assertThat(page.locator(".subscribe")).isChecked();
+   * }
+ */ + default void isChecked() { + isChecked(null); } - class IsDisabledOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsDisabledOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to a checked input. + *
{@code
+   * assertThat(page.locator(".subscribe")).isChecked();
+   * }
+ */ + void isChecked(IsCheckedOptions options); + /** + * Ensures the {@code Locator} points to a disabled element. + *
{@code
+   * assertThat(page.locator("button.submit")).isDisabled();
+   * }
+ */ + default void isDisabled() { + isDisabled(null); } - class IsEditableOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsEditableOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to a disabled element. + *
{@code
+   * assertThat(page.locator("button.submit")).isDisabled();
+   * }
+ */ + void isDisabled(IsDisabledOptions options); + /** + * Ensures the {@code Locator} points to an editable element. + *
{@code
+   * assertThat(page.locator("input")).isEditable();
+   * }
+ */ + default void isEditable() { + isEditable(null); } - class IsEmptyOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsEmptyOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to an editable element. + *
{@code
+   * assertThat(page.locator("input")).isEditable();
+   * }
+ */ + void isEditable(IsEditableOptions options); + /** + * Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text. + *
{@code
+   * assertThat(page.locator("div.warning")).isEmpty();
+   * }
+ */ + default void isEmpty() { + isEmpty(null); } - class IsEnabledOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsEnabledOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text. + *
{@code
+   * assertThat(page.locator("div.warning")).isEmpty();
+   * }
+ */ + void isEmpty(IsEmptyOptions options); + /** + * Ensures the {@code Locator} points to an enabled element. + *
{@code
+   * assertThat(page.locator("button.submit")).isEnabled();
+   * }
+ */ + default void isEnabled() { + isEnabled(null); } - class IsFocusedOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsFocusedOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to an enabled element. + *
{@code
+   * assertThat(page.locator("button.submit")).isEnabled();
+   * }
+ */ + void isEnabled(IsEnabledOptions options); + /** + * Ensures the {@code Locator} points to a focused DOM node. + *
{@code
+   * assertThat(page.locator("input")).isFocused();
+   * }
+ */ + default void isFocused() { + isFocused(null); } - class IsHiddenOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsHiddenOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to a focused DOM node. + *
{@code
+   * assertThat(page.locator("input")).isFocused();
+   * }
+ */ + void isFocused(IsFocusedOptions options); + /** + * Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of visible. + *
{@code
+   * assertThat(page.locator(".my-element")).isHidden();
+   * }
+ */ + default void isHidden() { + isHidden(null); } - class IsVisibleOptions { - /** - * Time to retry the assertion for. - */ - public Double timeout; - - /** - * Time to retry the assertion for. - */ - public IsVisibleOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } + /** + * Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of visible. + *
{@code
+   * assertThat(page.locator(".my-element")).isHidden();
+   * }
+ */ + void isHidden(IsHiddenOptions options); + /** + * Ensures the {@code Locator} points to a visible DOM + * node. + *
{@code
+   * assertThat(page.locator(".my-element")).toBeVisible();
+   * }
+ */ + default void isVisible() { + isVisible(null); } + /** + * Ensures the {@code Locator} points to a visible DOM + * node. + *
{@code
+   * assertThat(page.locator(".my-element")).toBeVisible();
+   * }
+ */ + void isVisible(IsVisibleOptions options); /** * Ensures the {@code Locator} points to an element that contains the given text. You can use regular expressions for the value * as well. @@ -676,6 +816,26 @@ public interface LocatorAssertions { * @param id Element id. */ void hasId(String id, HasIdOptions options); + /** + * Ensures the {@code Locator} points to an element with the given DOM Node ID. + *
{@code
+   * assertThat(page.locator("input")).hasId("lastname");
+   * }
+ * + * @param id Element id. + */ + default void hasId(Pattern id) { + hasId(id, null); + } + /** + * Ensures the {@code Locator} points to an element with the given DOM Node ID. + *
{@code
+   * assertThat(page.locator("input")).hasId("lastname");
+   * }
+ * + * @param id Element id. + */ + void hasId(Pattern id, HasIdOptions options); /** * Ensures the {@code Locator} points to an element with given JavaScript property. Note that this property can be of a primitive * type as well as a plain serializable JavaScript object. @@ -872,145 +1032,5 @@ public interface LocatorAssertions { * @param value Expected value. */ void hasValue(Pattern value, HasValueOptions options); - /** - * Ensures the {@code Locator} points to a checked input. - *
{@code
-   * assertThat(page.locator(".subscribe")).isChecked();
-   * }
- */ - default void isChecked() { - isChecked(null); - } - /** - * Ensures the {@code Locator} points to a checked input. - *
{@code
-   * assertThat(page.locator(".subscribe")).isChecked();
-   * }
- */ - void isChecked(IsCheckedOptions options); - /** - * Ensures the {@code Locator} points to a disabled element. - *
{@code
-   * assertThat(page.locator("button.submit")).isDisabled();
-   * }
- */ - default void isDisabled() { - isDisabled(null); - } - /** - * Ensures the {@code Locator} points to a disabled element. - *
{@code
-   * assertThat(page.locator("button.submit")).isDisabled();
-   * }
- */ - void isDisabled(IsDisabledOptions options); - /** - * Ensures the {@code Locator} points to an editable element. - *
{@code
-   * assertThat(page.locator("input")).isEditable();
-   * }
- */ - default void isEditable() { - isEditable(null); - } - /** - * Ensures the {@code Locator} points to an editable element. - *
{@code
-   * assertThat(page.locator("input")).isEditable();
-   * }
- */ - void isEditable(IsEditableOptions options); - /** - * Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text. - *
{@code
-   * assertThat(page.locator("div.warning")).isEmpty();
-   * }
- */ - default void isEmpty() { - isEmpty(null); - } - /** - * Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text. - *
{@code
-   * assertThat(page.locator("div.warning")).isEmpty();
-   * }
- */ - void isEmpty(IsEmptyOptions options); - /** - * Ensures the {@code Locator} points to an enabled element. - *
{@code
-   * assertThat(page.locator("button.submit")).isEnabled();
-   * }
- */ - default void isEnabled() { - isEnabled(null); - } - /** - * Ensures the {@code Locator} points to an enabled element. - *
{@code
-   * assertThat(page.locator("button.submit")).isEnabled();
-   * }
- */ - void isEnabled(IsEnabledOptions options); - /** - * Ensures the {@code Locator} points to a focused DOM node. - *
{@code
-   * assertThat(page.locator("input")).isFocused();
-   * }
- */ - default void isFocused() { - isFocused(null); - } - /** - * Ensures the {@code Locator} points to a focused DOM node. - *
{@code
-   * assertThat(page.locator("input")).isFocused();
-   * }
- */ - void isFocused(IsFocusedOptions options); - /** - * Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of visible. - *
{@code
-   * assertThat(page.locator(".my-element")).isHidden();
-   * }
- */ - default void isHidden() { - isHidden(null); - } - /** - * Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of visible. - *
{@code
-   * assertThat(page.locator(".my-element")).isHidden();
-   * }
- */ - void isHidden(IsHiddenOptions options); - /** - * Ensures the {@code Locator} points to a visible DOM - * node. - *
{@code
-   * assertThat(page.locator(".my-element")).isVisible();
-   * }
- */ - default void isVisible() { - isVisible(null); - } - /** - * Ensures the {@code Locator} points to a visible DOM - * node. - *
{@code
-   * assertThat(page.locator(".my-element")).isVisible();
-   * }
- */ - void isVisible(IsVisibleOptions options); - /** - * Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text - * {@code "error"}: - *
{@code
-   * assertThat(locator).not().containsText("error");
-   * }
- */ - LocatorAssertions not(); } diff --git a/assertions/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java b/assertions/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java index cda9d25a..363a71ff 100644 --- a/assertions/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java +++ b/assertions/src/main/java/com/microsoft/playwright/assertions/PageAssertions.java @@ -68,6 +68,14 @@ public interface PageAssertions { return this; } } + /** + * Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain + * {@code "error"}: + *
{@code
+   * assertThat(page).not().hasURL("error");
+   * }
+ */ + PageAssertions not(); /** * Ensures the page has the given title. *
{@code
@@ -148,13 +156,5 @@ public interface PageAssertions {
    * @param urlOrRegExp Expected substring or RegExp.
    */
   void hasURL(Pattern urlOrRegExp, HasURLOptions options);
-  /**
-   * Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain
-   * {@code "error"}:
-   * 
{@code
-   * assertThat(page).not().hasURL("error");
-   * }
- */ - PageAssertions not(); } diff --git a/assertions/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java b/assertions/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java index b03290a6..88330041 100644 --- a/assertions/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java +++ b/assertions/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java @@ -181,6 +181,12 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse expectImpl("to.have.id", expected, id, "Locator expected to have ID", convertType(options, FrameExpectOptions.class)); } + @Override + public void hasId(Pattern pattern, HasIdOptions options) { + ExpectedTextValue expected = expectedRegex(pattern); + expectImpl("to.have.id", expected, pattern, "Locator expected to have ID matching regex", convertType(options, FrameExpectOptions.class)); + } + @Override public void hasJSProperty(String name, Object value, HasJSPropertyOptions options) { if (options == null) { 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 4e462abe..1d704cfe 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/Utils.java @@ -154,7 +154,7 @@ class Utils { } catch (IOException e) { throw new PlaywrightException("Failed to read from file", e); } - return new FilePayload(file.getFileName().toString(), mimeType(file), buffer); + return new FilePayload(file.getFileName().toString(), null, buffer); } static void mkParentDirs(Path file) { diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java index 36fcd32e..628d3aff 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java @@ -597,7 +597,7 @@ public class TestBrowserContextFetch extends TestBase { "\r\n" + "Doe"), body); assertTrue(body.contains("content-disposition: form-data; name=\"file\"; filename=\"simplezip.json\"\r\n" + - (isMac ? "content-type: application/octet-stream\r\n" : "content-type: application/json\r\n") + + "content-type: application/json\r\n" + "\r\n" + "{\"foo\":\"bar\"}"), body); assertEquals(200, response.status()); diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION index 5d9d2276..12b3ecc2 100644 --- a/scripts/CLI_VERSION +++ b/scripts/CLI_VERSION @@ -1 +1 @@ -1.18.0-alpha-1637178126000 +1.18.0-alpha-1637257604000