Skip to content

Commit 74b9a8f

Browse files
authored
test: re-renable CORS tests (#625)
1 parent c1a52c2 commit 74b9a8f

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

playwright/_impl/_page.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,6 @@ async def pdf(
779779
def video(
780780
self,
781781
) -> Optional[Video]:
782-
if "recordVideo" not in self._browser_context._options:
783-
return None
784782
if not self._video:
785783
self._video = Video(self)
786784
return self._video

tests/async/test_interception.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,6 @@ async def handle_route(route, request):
580580
assert "failed" in exc.value.message
581581

582582

583-
# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
584-
@pytest.mark.skip_browser("chromium")
585583
async def test_page_route_should_support_cors_with_POST(page, server):
586584
await page.goto(server.EMPTY_PAGE)
587585
await page.route(
@@ -609,8 +607,6 @@ async def test_page_route_should_support_cors_with_POST(page, server):
609607
assert resp == ["electric", "gas"]
610608

611609

612-
# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
613-
@pytest.mark.skip_browser("chromium")
614610
async def test_page_route_should_support_cors_for_different_methods(page, server):
615611
await page.goto(server.EMPTY_PAGE)
616612
await page.route(

tests/async/test_video.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
import os
1616

17-
import pytest
18-
19-
from playwright.async_api import Error
20-
2117

2218
async def test_should_expose_video_path(browser, tmpdir, server):
2319
page = await browser.new_page(record_video_dir=tmpdir)
@@ -36,10 +32,8 @@ async def test_short_video_should_throw(browser, tmpdir, server):
3632
assert os.path.exists(path)
3733

3834

39-
# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
40-
@pytest.mark.skip()
4135
async def test_short_video_should_throw_persistent_context(
42-
browser_type, tmpdir, launch_arguments
36+
browser_type, tmpdir, launch_arguments, server
4337
):
4438
context = await browser_type.launch_persistent_context(
4539
str(tmpdir),
@@ -48,7 +42,8 @@ async def test_short_video_should_throw_persistent_context(
4842
record_video_dir=str(tmpdir) + "1",
4943
)
5044
page = context.pages[0]
45+
await page.goto(server.PREFIX + "/grid.html")
5146
await context.close()
52-
with pytest.raises(Error) as exc_info:
53-
await page.video.path()
54-
assert "Page closed" in exc_info.value.message
47+
48+
path = await page.video.path()
49+
assert str(tmpdir) in str(path)

tests/sync/test_video.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import os
1616

17-
import pytest
18-
1917

2018
def test_should_expose_video_path(browser, tmpdir, server):
2119
page = browser.new_page(
@@ -46,8 +44,6 @@ def test_record_video_to_path(browser, tmpdir, server):
4644
assert os.path.exists(path)
4745

4846

49-
# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
50-
@pytest.mark.skip()
5147
def test_record_video_to_path_persistent(
5248
browser_type, tmpdir, server, launch_arguments
5349
):
@@ -60,3 +56,16 @@ def test_record_video_to_path_persistent(
6056
assert str(tmpdir) in str(path)
6157
context.close()
6258
assert os.path.exists(path)
59+
60+
61+
def test_record_video_can_get_video_path_immediately(
62+
browser_type, tmpdir, launch_arguments
63+
):
64+
context = browser_type.launch_persistent_context(
65+
tmpdir, **launch_arguments, record_video_dir=tmpdir
66+
)
67+
page = context.pages[0]
68+
path = page.video.path()
69+
assert str(tmpdir) in str(path)
70+
context.close()
71+
assert os.path.exists(path)

0 commit comments

Comments
 (0)