Skip to content

Commit 1d15fba

Browse files
authored
feat(roll): roll Playwright CLI to 0.160.0-next.1604019206789 (microsoft#260)
1 parent b5f8151 commit 1d15fba

File tree

7 files changed

+47
-13
lines changed

7 files changed

+47
-13
lines changed

api.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build_package.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,23 @@
2222

2323
from playwright.path_utils import get_file_dirname
2424

25-
driver_version = "0.152.0"
25+
driver_version_64 = "0.160.0-next.1604019206789"
26+
driver_version_32 = "0.160.0-next.1604019246361"
27+
28+
29+
def driver_version(platform: str) -> str:
30+
return driver_version_32 if platform == "win32" else driver_version_64
31+
2632

2733
if not os.path.exists("driver"):
2834
os.makedirs("driver")
2935
if not os.path.exists("playwright/driver"):
3036
os.makedirs("playwright/driver")
3137

3238
for platform in ["mac", "linux", "win32", "win32_x64"]:
33-
zip_file = f"playwright-cli-{driver_version}-{platform}.zip"
39+
zip_file = f"playwright-cli-{driver_version(platform)}-{platform}.zip"
3440
if not os.path.exists("driver/" + zip_file):
35-
url = "https://playwright.azureedge.net/builds/cli/" + zip_file
41+
url = "https://playwright.azureedge.net/builds/cli/next/" + zip_file
3642
print("Fetching ", url)
3743
subprocess.check_call(["curl", url, "-o", "driver/" + zip_file])
3844

@@ -59,7 +65,7 @@
5965
}
6066

6167
for platform in ["mac", "linux", "win32", "win32_x64"]:
62-
zip_file = f"driver/playwright-cli-{driver_version}-{platform}.zip"
68+
zip_file = f"driver/playwright-cli-{driver_version(platform)}-{platform}.zip"
6369
with zipfile.ZipFile(zip_file, "r") as zip:
6470
zip.extractall(f"driver/{platform}")
6571
if platform_map[sys.platform] == platform:

playwright/async_api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5224,7 +5224,6 @@ async def grantPermissions(
52245224
----------
52255225
permissions : List[str]
52265226
A permission or an array of permissions to grant. Permissions can be one of the following values:
5227-
- `'*'`
52285227
- `'geolocation'`
52295228
- `'midi'`
52305229
- `'midi-sysex'` (system-exclusive midi)
@@ -5667,7 +5666,7 @@ async def newContext(
56675666
acceptDownloads : Optional[bool]
56685667
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
56695668
videosPath : Optional[str]
5670-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5669+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved.
56715670
videoSize : Optional[{"width": int, "height": int}]
56725671
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
56735672
@@ -5764,7 +5763,7 @@ async def newPage(
57645763
acceptDownloads : Optional[bool]
57655764
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
57665765
videosPath : Optional[str]
5767-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5766+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved.
57685767
videoSize : Optional[{"width": int, "height": int}]
57695768
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
57705769
@@ -6031,7 +6030,7 @@ async def launchPersistentContext(
60316030
chromiumSandbox : Optional[bool]
60326031
Enable Chromium sandboxing. Defaults to `true`.
60336032
videosPath : Optional[str]
6034-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
6033+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved.
60356034
videoSize : Optional[{"width": int, "height": int}]
60366035
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
60376036

playwright/page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ def video(
791791
return None
792792
if not self._video:
793793
self._video = Video(self)
794+
if "videoRelativePath" in self._initializer:
795+
self._video._set_relative_path(self._initializer["videoRelativePath"])
794796
return self._video
795797

796798
def expect_event(

playwright/sync_api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5436,7 +5436,6 @@ def grantPermissions(
54365436
----------
54375437
permissions : List[str]
54385438
A permission or an array of permissions to grant. Permissions can be one of the following values:
5439-
- `'*'`
54405439
- `'geolocation'`
54415440
- `'midi'`
54425441
- `'midi-sysex'` (system-exclusive midi)
@@ -5897,7 +5896,7 @@ def newContext(
58975896
acceptDownloads : Optional[bool]
58985897
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
58995898
videosPath : Optional[str]
5900-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5899+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved.
59015900
videoSize : Optional[{"width": int, "height": int}]
59025901
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
59035902
@@ -5996,7 +5995,7 @@ def newPage(
59965995
acceptDownloads : Optional[bool]
59975996
Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
59985997
videosPath : Optional[str]
5999-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
5998+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `page.close` for videos to be saved.
60005999
videoSize : Optional[{"width": int, "height": int}]
60016000
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
60026001
@@ -6267,7 +6266,7 @@ def launchPersistentContext(
62676266
chromiumSandbox : Optional[bool]
62686267
Enable Chromium sandboxing. Defaults to `true`.
62696268
videosPath : Optional[str]
6270-
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded.
6269+
Enables video recording for all pages to `videosPath` folder. If not specified, videos are not recorded. Make sure to await `browserContext.close` for videos to be saved.
62716270
videoSize : Optional[{"width": int, "height": int}]
62726271
Specifies dimensions of the automatically recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If `viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled down if necessary to fit specified size.
62736272

scripts/expected_api_mismatch.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,18 @@ Parameter not implemented: BrowserContext.addInitScript(arg=)
116116
# OptionsOr
117117
Parameter not implemented: Page.waitForEvent(optionsOrPredicate=)
118118
Parameter not implemented: BrowserContext.waitForEvent(optionsOrPredicate=)
119+
120+
121+
# 1.6 Todo
122+
Method not implemented: Page.tap
123+
Parameter not implemented: Browser.newPage(proxy=)
124+
Method not implemented: Frame.tap
125+
Method not implemented: Touchscreen.tap
126+
Method not implemented: ElementHandle.tap
127+
Parameter not implemented: Browser.newContext(proxy=)
128+
Parameter not implemented: Browser.newPage(recordHar=)
129+
Method not implemented: Page.touchscreen
130+
Parameter not implemented: Browser.newContext(recordHar=)
131+
Method not implemented: WebSocket.url
132+
Parameter not implemented: BrowserType.launchPersistentContext(recordHar=)
133+
Method not implemented: Request.timing

tests/async/test_video.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ async def test_short_video_should_exist(browser, tmpdir, server):
3030
assert str(tmpdir) in path
3131
await page.context.close()
3232
assert os.path.exists(path)
33+
34+
35+
async def test_short_video_should_exist_persistent_context(browser_type, tmpdir):
36+
context = await browser_type.launchPersistentContext(
37+
str(tmpdir),
38+
viewport={"width": 320, "height": 240},
39+
videosPath=str(tmpdir) + "1",
40+
)
41+
page = context.pages[0]
42+
await context.close()
43+
path = await page.video.path()
44+
assert str(tmpdir) in path
45+
assert os.path.exists(path)

0 commit comments

Comments
 (0)