From c52f0f2f2260dd4cd699e5423aeb8c2c76135349 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Thu, 12 Aug 2021 12:25:11 -0700 Subject: [PATCH] chore: roll to 1.14 branch tot (#845) --- README.md | 6 +++--- playwright/_impl/_locator.py | 6 +++--- playwright/async_api/_generated.py | 4 ++-- playwright/sync_api/_generated.py | 4 ++-- setup.py | 2 +- .../async/test_browsercontext_add_cookies.py | 18 +++++++++-------- tests/async/test_browsercontext_cookies.py | 20 +++++++++---------- tests/async/test_defaultbrowsercontext.py | 10 +++++----- tests/async/test_headful.py | 4 ++-- tests/async/test_locators.py | 2 +- tests/sync/test_locators.py | 2 +- 11 files changed, 40 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index f76c89a14..832d41cc9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 93.0.4576.0 | ✅ | ✅ | ✅ | -| WebKit 14.2 | ✅ | ✅ | ✅ | -| Firefox 90.0 | ✅ | ✅ | ✅ | +| Chromium 94.0.4595.0 | ✅ | ✅ | ✅ | +| WebKit 15.0 | ✅ | ✅ | ✅ | +| Firefox 91.0 | ✅ | ✅ | ✅ | ## Documentation diff --git a/playwright/_impl/_locator.py b/playwright/_impl/_locator.py index aae3e724f..c701b6c67 100644 --- a/playwright/_impl/_locator.py +++ b/playwright/_impl/_locator.py @@ -185,14 +185,14 @@ async def element_handles(self) -> List[ElementHandle]: @property def first(self) -> "Locator": - return Locator(self._frame, f"{self._selector} >> _nth=first") + return Locator(self._frame, f"{self._selector} >> nth=0") @property def last(self) -> "Locator": - return Locator(self._frame, f"{self._selector} >> _nth=last") + return Locator(self._frame, f"{self._selector} >> nth=-1") def nth(self, index: int) -> "Locator": - return Locator(self._frame, f"{self._selector} >> _nth={index}") + return Locator(self._frame, f"{self._selector} >> nth={index}") async def focus(self, timeout: float = None) -> None: params = locals_to_params(locals()) diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index c0372b75d..0e025d79f 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -11044,8 +11044,8 @@ async def evaluate_all(self, expression: str, arg: typing.Any = None) -> NoneTyp The method finds all elements matching the specified locator and passes an array of matched elements as a first argument to `expression`. Returns the result of `expression` invocation. - If `expression` returns a [Promise], then [`Locator.evaluateAll`] would wait for the promise to resolve and return its - value. + If `expression` returns a [Promise], then `locator.evaluate_all()` would wait for the promise to resolve and + return its value. Examples: diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index 9ea4c8c5c..74777fa95 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -10980,8 +10980,8 @@ def evaluate_all(self, expression: str, arg: typing.Any = None) -> NoneType: The method finds all elements matching the specified locator and passes an array of matched elements as a first argument to `expression`. Returns the result of `expression` invocation. - If `expression` returns a [Promise], then [`Locator.evaluateAll`] would wait for the promise to resolve and return its - value. + If `expression` returns a [Promise], then `locator.evaluate_all()` would wait for the promise to resolve and + return its value. Examples: diff --git a/setup.py b/setup.py index 770321178..2a5e83cd0 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ InWheel = None from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand -driver_version = "1.14.0-next-1628399336000" +driver_version = "1.14.0-1628783206000" def extractall(zip: zipfile.ZipFile, path: str) -> None: diff --git a/tests/async/test_browsercontext_add_cookies.py b/tests/async/test_browsercontext_add_cookies.py index 1fe64309c..6ce2e6088 100644 --- a/tests/async/test_browsercontext_add_cookies.py +++ b/tests/async/test_browsercontext_add_cookies.py @@ -210,7 +210,7 @@ async def test_should_have_expires_set_to_neg_1_for_session_cookies(context, ser assert cookies[0]["expires"] == -1 -async def test_should_set_cookie_with_reasonable_defaults(context, server): +async def test_should_set_cookie_with_reasonable_defaults(context, server, is_chromium): await context.add_cookies( [{"url": server.EMPTY_PAGE, "name": "defaults", "value": "123456"}] ) @@ -225,12 +225,12 @@ async def test_should_set_cookie_with_reasonable_defaults(context, server): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] -async def test_should_set_a_cookie_with_a_path(context, page, server): +async def test_should_set_a_cookie_with_a_path(context, page, server, is_chromium): await page.goto(server.PREFIX + "/grid.html") await context.add_cookies( [ @@ -251,7 +251,7 @@ async def test_should_set_a_cookie_with_a_path(context, page, server): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] assert await page.evaluate("document.cookie") == "gridcookie=GRID" @@ -311,7 +311,9 @@ async def test_should_be_able_to_set_unsecure_cookie_for_http_website( assert not cookie["secure"] -async def test_should_set_a_cookie_on_a_different_domain(context, page, server): +async def test_should_set_a_cookie_on_a_different_domain( + context, page, server, is_chromium +): await page.goto(server.EMPTY_PAGE) await context.add_cookies( [{"url": "https://www.example.com", "name": "example-cookie", "value": "best"}] @@ -326,7 +328,7 @@ async def test_should_set_a_cookie_on_a_different_domain(context, page, server): "expires": -1, "httpOnly": False, "secure": True, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] @@ -370,7 +372,7 @@ async def test_should_not_block_third_party_cookies( ) await page.frames[1].evaluate("document.cookie = 'username=John Doe'") await page.wait_for_timeout(2000) - allows_third_party = is_chromium or is_firefox + allows_third_party = is_firefox cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + "/grid.html") if allows_third_party: @@ -381,7 +383,7 @@ async def test_should_not_block_third_party_cookies( "httpOnly": False, "name": "username", "path": "/", - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", "secure": False, "value": "John Doe", } diff --git a/tests/async/test_browsercontext_cookies.py b/tests/async/test_browsercontext_cookies.py index edd4cc780..e0ac33740 100644 --- a/tests/async/test_browsercontext_cookies.py +++ b/tests/async/test_browsercontext_cookies.py @@ -21,7 +21,7 @@ async def test_should_return_no_cookies_in_pristine_browser_context(context): assert await context.cookies() == [] -async def test_should_get_a_cookie(context, page, server, is_firefox): +async def test_should_get_a_cookie(context, page, server, is_chromium): await page.goto(server.EMPTY_PAGE) document_cookie = await page.evaluate( """() => { @@ -39,12 +39,12 @@ async def test_should_get_a_cookie(context, page, server, is_firefox): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] -async def test_should_get_a_non_session_cookie(context, page, server, is_firefox): +async def test_should_get_a_non_session_cookie(context, page, server, is_chromium): await page.goto(server.EMPTY_PAGE) # @see https://en.wikipedia.org/wiki/Year_2038_problem date = int(datetime.datetime(2038, 1, 1).timestamp() * 1000) @@ -66,7 +66,7 @@ async def test_should_get_a_non_session_cookie(context, page, server, is_firefox "expires": date / 1000, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] @@ -124,7 +124,7 @@ async def test_should_properly_report_lax_sameSite_cookie( assert cookies[0]["sameSite"] == "Lax" -async def test_should_get_multiple_cookies(context, page, server, is_firefox): +async def test_should_get_multiple_cookies(context, page, server, is_chromium): await page.goto(server.EMPTY_PAGE) document_cookie = await page.evaluate( """() => { @@ -145,7 +145,7 @@ async def test_should_get_multiple_cookies(context, page, server, is_firefox): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", }, { "name": "username", @@ -155,12 +155,12 @@ async def test_should_get_multiple_cookies(context, page, server, is_firefox): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", }, ] -async def test_should_get_cookies_from_multiple_urls(context): +async def test_should_get_cookies_from_multiple_urls(context, is_chromium): await context.add_cookies( [ {"url": "https://foo.com", "name": "doggo", "value": "woofs"}, @@ -180,7 +180,7 @@ async def test_should_get_cookies_from_multiple_urls(context): "expires": -1, "httpOnly": False, "secure": True, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", }, { "name": "doggo", @@ -190,6 +190,6 @@ async def test_should_get_cookies_from_multiple_urls(context): "expires": -1, "httpOnly": False, "secure": True, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", }, ] diff --git a/tests/async/test_defaultbrowsercontext.py b/tests/async/test_defaultbrowsercontext.py index f5e1ffaf0..f3e15b61a 100644 --- a/tests/async/test_defaultbrowsercontext.py +++ b/tests/async/test_defaultbrowsercontext.py @@ -37,7 +37,7 @@ async def _launch(**options): await context.close() -async def test_context_cookies_should_work(server, launch_persistent, is_firefox): +async def test_context_cookies_should_work(server, launch_persistent, is_chromium): (page, context) = await launch_persistent() await page.goto(server.EMPTY_PAGE) document_cookie = await page.evaluate( @@ -57,12 +57,12 @@ async def test_context_cookies_should_work(server, launch_persistent, is_firefox "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] -async def test_context_add_cookies_should_work(server, launch_persistent): +async def test_context_add_cookies_should_work(server, launch_persistent, is_chromium): (page, context) = await launch_persistent() await page.goto(server.EMPTY_PAGE) await page.context.add_cookies( @@ -78,7 +78,7 @@ async def test_context_add_cookies_should_work(server, launch_persistent): "expires": -1, "httpOnly": False, "secure": False, - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", } ] @@ -124,7 +124,7 @@ async def test_should_not_block_third_party_cookies( ) await page.wait_for_timeout(2000) - allows_third_party = is_chromium or is_firefox + allows_third_party = is_firefox assert document_cookie == ("username=John Doe" if allows_third_party else "") cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + "/grid.html") if allows_third_party: diff --git a/tests/async/test_headful.py b/tests/async/test_headful.py index 6cd22c1a8..8939bf0c2 100644 --- a/tests/async/test_headful.py +++ b/tests/async/test_headful.py @@ -101,7 +101,7 @@ async def test_should_not_block_third_party_cookies( ) await page.wait_for_timeout(2000) - allows_third_party = is_chromium or is_firefox + allows_third_party = is_firefox assert document_cookie == ("username=John Doe" if allows_third_party else "") cookies = await page.context.cookies(server.CROSS_PROCESS_PREFIX + "/grid.html") if allows_third_party: @@ -112,7 +112,7 @@ async def test_should_not_block_third_party_cookies( "httpOnly": False, "name": "username", "path": "/", - "sameSite": "None", + "sameSite": "Lax" if is_chromium else "None", "secure": False, "value": "John Doe", } diff --git a/tests/async/test_locators.py b/tests/async/test_locators.py index 3d66e19c2..b28ef3a6d 100644 --- a/tests/async/test_locators.py +++ b/tests/async/test_locators.py @@ -435,7 +435,7 @@ async def test_locators_should_throw_on_capture_without_nth(page: Page): """ ) with pytest.raises(Error, match="Can't query n-th element"): - await page.locator("*css=div >> p").nth(0).click() + await page.locator("*css=div >> p").nth(1).click() async def test_locators_should_throw_due_to_strictness(page: Page): diff --git a/tests/sync/test_locators.py b/tests/sync/test_locators.py index 2ffc8388f..b93dd7f59 100644 --- a/tests/sync/test_locators.py +++ b/tests/sync/test_locators.py @@ -419,7 +419,7 @@ def test_locators_should_throw_on_capture_without_nth(page: Page): """ ) with pytest.raises(Error, match="Can't query n-th element"): - page.locator("*css=div >> p").nth(0).click() + page.locator("*css=div >> p").nth(1).click() def test_locators_should_throw_due_to_strictness(page: Page):