Skip to content

Commit 89516e9

Browse files
authored
chore: roll Playwright to 1.7.0-next.1607623793189 (microsoft#362)
1 parent e9f2205 commit 89516e9

12 files changed

+1533
-1041
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
66

77
| | Linux | macOS | Windows |
88
| :--- | :---: | :---: | :---: |
9-
| Chromium <!-- GEN:chromium-version -->88.0.4316.0<!-- GEN:stop --> ||||
10-
| WebKit <!-- GEN:webkit-version -->14.0<!-- GEN:stop --> ||||
11-
| Firefox <!-- GEN:firefox-version -->83.0<!-- GEN:stop --> ||||
9+
| Chromium <!-- GEN:chromium-version -->89.0.4344.0<!-- GEN:stop --> ||||
10+
| WebKit <!-- GEN:webkit-version -->14.1<!-- GEN:stop --> ||||
11+
| Firefox <!-- GEN:firefox-version -->84.0b9<!-- GEN:stop --> ||||
1212

1313
Headless execution is supported for all browsers on all platforms.
1414

playwright/async_api.py

Lines changed: 726 additions & 496 deletions
Large diffs are not rendered by default.

playwright/sync_api.py

Lines changed: 726 additions & 496 deletions
Large diffs are not rendered by default.

scripts/documentation_provider.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,28 @@ def print_entry(
106106
args = method["args"]
107107
args_with_expanded_options: Dict[str, Any] = dict()
108108
for name, value in args.items():
109+
expand = False
109110
if name == "options":
110-
for opt_name, opt_value in args["options"]["type"][
111-
"properties"
112-
].items():
111+
expand = True
112+
if fqname == "Page.frame" and name == "frameSelector":
113+
expand = True
114+
if ".addStyleTag" in fqname and name == "style":
115+
expand = True
116+
if ".addScriptTag" in fqname and name == "script":
117+
expand = True
118+
if fqname == "Page.emulateMedia" and name == "params":
119+
expand = True
120+
if fqname == "Route.fulfill" and name == "response":
121+
expand = True
122+
if fqname == "Route.continue" and name == "overrides":
123+
expand = True
124+
if fqname == "Page.setViewportSize" and name == "viewportSize":
125+
expand = True
126+
if expand:
127+
for opt_name, opt_value in args[name]["type"]["properties"].items():
113128
args_with_expanded_options[opt_name] = opt_value
114129
else:
115130
args_with_expanded_options[name] = value
116-
if fqname == "Route.fulfill":
117-
for name, value in args["response"]["type"]["properties"].items():
118-
args_with_expanded_options[name] = value
119-
del args_with_expanded_options["response"]
120-
if fqname == "Route.continue":
121-
for name, value in args["overrides"]["type"]["properties"].items():
122-
args_with_expanded_options[name] = value
123-
del args_with_expanded_options["overrides"]
124-
if fqname == "Page.setViewportSize":
125-
for name, value in args["viewportSize"]["type"]["properties"].items():
126-
args_with_expanded_options[name] = value
127-
del args_with_expanded_options["viewportSize"]
128131

129132
if signature and signature_no_return:
130133
print("")

scripts/expected_api_mismatch.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Parameter type mismatch in Page.route(url=): documented as Union[str, RegExp, fu
6868
Parameter type mismatch in Page.unroute(url=): documented as Union[str, RegExp, function(URL):boolean], code has Union[str, Pattern, typing.Callable[[str], bool]]
6969
Parameter type mismatch in Page.waitForNavigation(url=): documented as Union[str, RegExp, Function, NoneType], code has Union[str, Pattern, typing.Callable[[str], bool], NoneType]
7070
Parameter type mismatch in Page.waitForRequest(urlOrPredicate=): documented as Union[str, RegExp, Function], code has Union[str, Pattern, typing.Callable[[str], bool], NoneType]
71-
Parameter type mismatch in Page.waitForResponse(urlOrPredicate=): documented as Union[str, RegExp, Function], code has Union[str, Pattern, typing.Callable[[str], bool], NoneType]
71+
Parameter type mismatch in Page.waitForResponse(urlOrPredicate=): documented as Union[str, RegExp, function(Response):boolean], code has Union[str, Pattern, typing.Callable[[str], bool], NoneType]
7272

7373
# Add init script
7474
Parameter type mismatch in Page.addInitScript(script=): documented as Union[Callable, str, Dict], code has Optional[str]

scripts/update_api.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ function update_api {
88
generate_script="$2"
99
git checkout HEAD -- "$file_name"
1010

11-
python "$generate_script" > .x
12-
13-
mv .x "$file_name"
14-
pre-commit run --files $file_name
11+
if python "$generate_script" > .x; then
12+
mv .x "$file_name"
13+
pre-commit run --files $file_name
14+
echo "Regenerated APIs"
15+
else
16+
echo "Exited due to errors"
17+
fi
1518
}
1619

1720
update_api "playwright/sync_api.py" "scripts/generate_sync_api.py"
1821
update_api "playwright/async_api.py" "scripts/generate_async_api.py"
19-
20-
echo "Regenerated APIs"

setup.cfg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ markers =
66
only_platform
77
junit_family=xunit2
88
[mypy]
9-
ignore_errors = True
9+
ignore_missing_imports = True
10+
python_version = 3.7
11+
warn_unused_ignores = False
12+
warn_redundant_casts = True
13+
warn_unused_configs = True
14+
check_untyped_defs = True
15+
disallow_untyped_defs = True
16+
[mypy-tests.*]
17+
check_untyped_defs = False
18+
disallow_untyped_defs = False
1019
[flake8]
1120
ignore =
1221
E501

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import setuptools
2424
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
2525

26-
driver_version = "0.170.0-next.1605573954344"
26+
driver_version = "0.170.0-next.1607623793189"
2727

2828

2929
with open("README.md", "r", encoding="utf-8") as fh:

tests/async/test_interception.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ async def test_page_route_should_intercept_main_resource_during_cross_process_na
533533
assert len(intercepted) == 1
534534

535535

536+
@pytest.mark.skip_browser("webkit")
536537
async def test_page_route_should_create_a_redirect(page, server):
537538
await page.goto(server.PREFIX + "/empty.html")
538539

tests/async/test_page.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,16 @@ async def test_fill_should_fill_input(page, server):
954954

955955
async def test_fill_should_throw_on_unsupported_inputs(page, server):
956956
await page.goto(server.PREFIX + "/input/textarea.html")
957-
for type in ["color", "file"]:
957+
for type in [
958+
"button",
959+
"checkbox",
960+
"file",
961+
"image",
962+
"radio",
963+
"range",
964+
"reset",
965+
"submit",
966+
]:
958967
await page.evalOnSelector(
959968
"input", "(input, type) => input.setAttribute('type', type)", type
960969
)

tests/async/test_queryselector.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
1-
from typing import Any, cast
2-
31
import pytest
42

53
from playwright import Error
64
from playwright.async_api import Page
75

86

9-
async def test_selectors_register_should_work(selectors, page: Page, utils):
10-
await utils.register_selector_engine(
11-
selectors,
12-
"tag",
13-
"""{
14-
create(root, target) {
15-
return target.nodeName;
16-
},
17-
query(root, selector) {
18-
return root.querySelector(selector);
19-
},
20-
queryAll(root, selector) {
21-
return Array.from(root.querySelectorAll(selector));
22-
}
23-
}""",
24-
)
7+
async def test_selectors_register_should_work(selectors, browser):
8+
tag_selector = """
9+
{
10+
create(root, target) {
11+
return target.nodeName;
12+
},
13+
query(root, selector) {
14+
return root.querySelector(selector);
15+
},
16+
queryAll(root, selector) {
17+
return Array.from(root.querySelectorAll(selector));
18+
}
19+
}"""
20+
21+
# Register one engine before creating context.
22+
await selectors.register("tag", tag_selector)
23+
24+
context = await browser.newContext()
25+
# Register another engine after creating context.
26+
await selectors.register("tag2", tag_selector)
27+
28+
page = await context.newPage()
2529
await page.setContent("<div><span></span></div><div></div>")
26-
element_handle_impl = cast(Any, (await page.querySelector("div")))._impl_obj
27-
assert await element_handle_impl._createSelectorForTest("tag") == "DIV"
30+
2831
assert await page.evalOnSelector("tag=DIV", "e => e.nodeName") == "DIV"
2932
assert await page.evalOnSelector("tag=SPAN", "e => e.nodeName") == "SPAN"
3033
assert await page.evalOnSelectorAll("tag=DIV", "es => es.length") == 2
3134

35+
assert await page.evalOnSelector("tag2=DIV", "e => e.nodeName") == "DIV"
36+
assert await page.evalOnSelector("tag2=SPAN", "e => e.nodeName") == "SPAN"
37+
assert await page.evalOnSelectorAll("tag2=DIV", "es => es.length") == 2
38+
3239
# Selector names are case-sensitive.
3340
with pytest.raises(Error) as exc:
3441
await page.querySelector("tAG=DIV")
3542
assert 'Unknown engine "tAG" while parsing selector tAG=DIV' in exc.value.message
3643

44+
await context.close()
45+
3746

3847
async def test_selectors_register_should_work_with_path(
3948
selectors, page: Page, utils, assetdir
@@ -54,7 +63,7 @@ async def test_selectors_register_should_work_in_main_and_isolated_world(
5463
return window.__answer;
5564
},
5665
queryAll(root, selector) {
57-
return [document.body, document.documentElement, window.__answer];
66+
return window['__answer'] ? [window['__answer'], document.body, document.documentElement] : [];
5867
}
5968
}"""
6069

tests/common/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)