Skip to content

Commit 695ba55

Browse files
authored
chore: roll to ToT (#579)
1 parent dffc3f1 commit 695ba55

File tree

14 files changed

+183
-37
lines changed

14 files changed

+183
-37
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,55 @@ jobs:
103103
if: matrix.os == 'ubuntu-latest'
104104
run: xvfb-run pytest -vv tests/async --browser=${{ matrix.browser }} --timeout 90
105105

106+
stable:
107+
name: Stable
108+
timeout-minutes: 30
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
os: [ubuntu-latest, windows-latest, macos-latest]
113+
browser-channel: [chrome]
114+
include:
115+
- os: windows-latest
116+
browser-channel: msedge
117+
- os: macos-latest
118+
browser-channel: msedge
119+
runs-on: ${{ matrix.os }}
120+
steps:
121+
- name: Install Media Pack
122+
if: matrix.os == 'windows-latest'
123+
shell: powershell
124+
run: Install-WindowsFeature Server-Media-Foundation
125+
- uses: actions/checkout@v2
126+
- uses: microsoft/playwright-github-action@v1
127+
- name: Set up Python
128+
uses: actions/setup-python@v2
129+
with:
130+
python-version: 3.8
131+
- name: Install dependencies
132+
run: |
133+
python -m pip install --upgrade pip wheel
134+
pip install -r local-requirements.txt
135+
pip install -e .
136+
- name: Build package
137+
run: python setup.py bdist_wheel
138+
- name: Install ffmpeg
139+
run: python -m playwright install ffmpeg
140+
- name: Common Tests
141+
run: pytest -vv tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
142+
- name: Test Sync API
143+
if: matrix.os != 'ubuntu-latest'
144+
run: pytest -vv tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
145+
- name: Test Sync API
146+
if: matrix.os == 'ubuntu-latest'
147+
run: xvfb-run pytest -vv tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
148+
- name: Test Async API
149+
if: matrix.os != 'ubuntu-latest'
150+
run: pytest -vv tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
151+
- name: Test Async API
152+
if: matrix.os == 'ubuntu-latest'
153+
run: xvfb-run pytest -vv tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
154+
106155
test-package-installations:
107156
name: Test package installations
108157
runs-on: ubuntu-latest

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 -->90.0.4421.0<!-- GEN:stop --> ||||
10-
| WebKit <!-- GEN:webkit-version -->14.1<!-- GEN:stop --> ||||
11-
| Firefox <!-- GEN:firefox-version -->86.0b10<!-- GEN:stop --> ||||
9+
| Chromium <!-- GEN:chromium-version -->90.0.4430.0<!-- GEN:stop --> ||||
10+
| WebKit <!-- GEN:webkit-version -->14.2<!-- GEN:stop --> ||||
11+
| Firefox <!-- GEN:firefox-version -->87.0b10<!-- GEN:stop --> ||||
1212

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

playwright/_impl/_browser_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def executable_path(self) -> str:
4949
async def launch(
5050
self,
5151
executablePath: Union[str, Path] = None,
52+
channel: str = None,
5253
args: List[str] = None,
5354
ignoreDefaultArgs: Union[bool, List[str]] = None,
5455
handleSIGINT: bool = None,
@@ -76,6 +77,7 @@ async def launch(
7677
async def launch_persistent_context(
7778
self,
7879
userDataDir: Union[str, Path],
80+
channel: str = None,
7981
executablePath: Union[str, Path] = None,
8082
args: List[str] = None,
8183
ignoreDefaultArgs: Union[bool, List[str]] = None,

playwright/async_api/_generated.py

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def resource_type(self) -> str:
9292
following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,
9393
`websocket`, `manifest`, `other`.
9494
95+
> NOTE: The resource types are available as constants in [ResourceTypes].
96+
9597
Returns
9698
-------
9799
str
@@ -2837,7 +2839,7 @@ async def evaluate_handle(
28372839
Returns the return value of `expression` as a `JSHandle`.
28382840
28392841
The only difference between `frame.evaluate()` and `frame.evaluate_handle()` is that
2840-
[method: Frame.evaluateHandle`] returns `JSHandle`.
2842+
`frame.evaluate_handle()` returns `JSHandle`.
28412843
28422844
If the function, passed to the `frame.evaluate_handle()`, returns a [Promise], then
28432845
`frame.evaluate_handle()` would wait for the promise to resolve and return its value.
@@ -4359,7 +4361,7 @@ async def evaluate(self, expression: str, arg: typing.Any = None) -> typing.Any:
43594361
wait for the promise to resolve and return its value.
43604362
43614363
If the function passed to the `worker.evaluate()` returns a non-[Serializable] value, then
4362-
`worker.evaluate()` returns `undefined`. Playwright also supports transferring some additional values that are
4364+
`worker.evaluate()` returns `undefined`. Playwright also supports transferring some additional values that are
43634365
not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`.
43644366
43654367
Parameters
@@ -4629,7 +4631,7 @@ def suggested_filename(self) -> str:
46294631
async def delete(self) -> NoneType:
46304632
"""Download.delete
46314633
4632-
Deletes the downloaded file.
4634+
Deletes the downloaded file. Will wait for the download to finish if necessary.
46334635
"""
46344636

46354637
return mapping.from_maybe_impl(
@@ -4639,7 +4641,7 @@ async def delete(self) -> NoneType:
46394641
async def failure(self) -> typing.Optional[str]:
46404642
"""Download.failure
46414643
4642-
Returns download error if any.
4644+
Returns download error if any. Will wait for the download to finish if necessary.
46434645
46444646
Returns
46454647
-------
@@ -4653,7 +4655,8 @@ async def failure(self) -> typing.Optional[str]:
46534655
async def path(self) -> typing.Optional[pathlib.Path]:
46544656
"""Download.path
46554657
4656-
Returns path to the downloaded file in case of successful download.
4658+
Returns path to the downloaded file in case of successful download. The method will wait for the download to finish if
4659+
necessary.
46574660
46584661
Returns
46594662
-------
@@ -4667,7 +4670,7 @@ async def path(self) -> typing.Optional[pathlib.Path]:
46674670
async def save_as(self, path: typing.Union[str, pathlib.Path]) -> NoneType:
46684671
"""Download.save_as
46694672
4670-
Saves the download to a user-specified path.
4673+
Saves the download to a user-specified path. It is safe to call this method while the download is still in progress.
46714674
46724675
Parameters
46734676
----------
@@ -7666,9 +7669,16 @@ def expect_response(
76667669
Returns the matched response.
76677670
76687671
```py
7669-
first_response = await page.wait_for_response(\"https://example.com/resource\")
7670-
final_response = await page.wait_for_response(lambda response: response.url == \"https://example.com\" and response.status === 200)
7671-
return final_response.ok
7672+
async with page.expect_response(\"https://example.com/resource\") as response_info:
7673+
await page.click(\"input\")
7674+
response = response_info.value
7675+
return response.ok
7676+
7677+
# or with a lambda
7678+
async with page.expect_response(lambda response: response.url == \"https://example.com\" and response.status === 200) as response_info:
7679+
await page.click(\"input\")
7680+
response = response_info.value
7681+
return response.ok
76727682
```
76737683
76747684
Parameters
@@ -8623,7 +8633,7 @@ async def new_context(
86238633
Specifies if viewport supports touch events. Defaults to false.
86248634
color_scheme : Union["dark", "light", "no-preference", NoneType]
86258635
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
8626-
`page.emulate_media()` for more details. Defaults to '`light`'.
8636+
`page.emulate_media()` for more details. Defaults to `'light'`.
86278637
accept_downloads : Union[bool, NoneType]
86288638
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
86298639
proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType]
@@ -8760,7 +8770,7 @@ async def new_page(
87608770
Specifies if viewport supports touch events. Defaults to false.
87618771
color_scheme : Union["dark", "light", "no-preference", NoneType]
87628772
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
8763-
`page.emulate_media()` for more details. Defaults to '`light`'.
8773+
`page.emulate_media()` for more details. Defaults to `'light'`.
87648774
accept_downloads : Union[bool, NoneType]
87658775
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
87668776
proxy : Union[{server: str, bypass: Union[str, NoneType], username: Union[str, NoneType], password: Union[str, NoneType]}, NoneType]
@@ -8872,6 +8882,7 @@ async def launch(
88728882
self,
88738883
*,
88748884
executable_path: typing.Union[str, pathlib.Path] = None,
8885+
channel: str = None,
88758886
args: typing.List[str] = None,
88768887
ignore_default_args: typing.Union[bool, typing.List[str]] = None,
88778888
handle_sigint: bool = None,
@@ -8922,6 +8933,16 @@ async def launch(
89228933
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is
89238934
resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox
89248935
or WebKit, use at your own risk.
8936+
channel : Union[str, NoneType]
8937+
Chromium distribution channel, one of
8938+
- chrome
8939+
- chrome-beta
8940+
- chrome-dev
8941+
- chrome-canary
8942+
- msedge
8943+
- msedge-beta
8944+
- msedge-dev
8945+
- msedge-canary
89258946
args : Union[List[str], NoneType]
89268947
Additional arguments to pass to the browser instance. The list of Chromium flags can be found
89278948
[here](http://peter.sh/experiments/chromium-command-line-switches/).
@@ -8970,6 +8991,7 @@ async def launch(
89708991
"browser_type.launch",
89718992
self._impl_obj.launch(
89728993
executablePath=executable_path,
8994+
channel=channel,
89738995
args=args,
89748996
ignoreDefaultArgs=ignore_default_args,
89758997
handleSIGINT=handle_sigint,
@@ -8992,6 +9014,7 @@ async def launch_persistent_context(
89929014
self,
89939015
user_data_dir: typing.Union[str, pathlib.Path],
89949016
*,
9017+
channel: str = None,
89959018
executable_path: typing.Union[str, pathlib.Path] = None,
89969019
args: typing.List[str] = None,
89979020
ignore_default_args: typing.Union[bool, typing.List[str]] = None,
@@ -9043,6 +9066,16 @@ async def launch_persistent_context(
90439066
[Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#introduction) and
90449067
[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile). Note that Chromium's user
90459068
data directory is the **parent** directory of the "Profile Path" seen at `chrome://version`.
9069+
channel : Union[str, NoneType]
9070+
Chromium distribution channel, one of
9071+
- chrome
9072+
- chrome-beta
9073+
- chrome-dev
9074+
- chrome-canary
9075+
- msedge
9076+
- msedge-beta
9077+
- msedge-dev
9078+
- msedge-canary
90469079
executable_path : Union[pathlib.Path, str, NoneType]
90479080
Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is
90489081
resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled
@@ -9118,7 +9151,7 @@ async def launch_persistent_context(
91189151
Specifies if viewport supports touch events. Defaults to false.
91199152
color_scheme : Union["dark", "light", "no-preference", NoneType]
91209153
Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
9121-
`page.emulate_media()` for more details. Defaults to '`light`'.
9154+
`page.emulate_media()` for more details. Defaults to `'light'`.
91229155
accept_downloads : Union[bool, NoneType]
91239156
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
91249157
chromium_sandbox : Union[bool, NoneType]
@@ -9144,6 +9177,7 @@ async def launch_persistent_context(
91449177
"browser_type.launch_persistent_context",
91459178
self._impl_obj.launch_persistent_context(
91469179
userDataDir=user_data_dir,
9180+
channel=channel,
91479181
executablePath=executable_path,
91489182
args=args,
91499183
ignoreDefaultArgs=ignore_default_args,

0 commit comments

Comments
 (0)