Skip to content

test: re-renable CORS tests #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions playwright/_impl/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,6 @@ async def pdf(
def video(
self,
) -> Optional[Video]:
if "recordVideo" not in self._browser_context._options:
return None
if not self._video:
self._video = Video(self)
return self._video
Expand Down
4 changes: 0 additions & 4 deletions tests/async/test_interception.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,6 @@ async def handle_route(route, request):
assert "failed" in exc.value.message


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


# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
@pytest.mark.skip_browser("chromium")
async def test_page_route_should_support_cors_for_different_methods(page, server):
await page.goto(server.EMPTY_PAGE)
await page.route(
Expand Down
15 changes: 5 additions & 10 deletions tests/async/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

import os

import pytest

from playwright.async_api import Error


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


# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
@pytest.mark.skip()
async def test_short_video_should_throw_persistent_context(
browser_type, tmpdir, launch_arguments
browser_type, tmpdir, launch_arguments, server
):
context = await browser_type.launch_persistent_context(
str(tmpdir),
Expand All @@ -48,7 +42,8 @@ async def test_short_video_should_throw_persistent_context(
record_video_dir=str(tmpdir) + "1",
)
page = context.pages[0]
await page.goto(server.PREFIX + "/grid.html")
await context.close()
with pytest.raises(Error) as exc_info:
await page.video.path()
assert "Page closed" in exc_info.value.message

path = await page.video.path()
assert str(tmpdir) in str(path)
17 changes: 13 additions & 4 deletions tests/sync/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import os

import pytest


def test_should_expose_video_path(browser, tmpdir, server):
page = browser.new_page(
Expand Down Expand Up @@ -46,8 +44,6 @@ def test_record_video_to_path(browser, tmpdir, server):
assert os.path.exists(path)


# RELEASE BLOCKER: Temporary upstream issue https://github.com/microsoft/playwright-python/issues/608
@pytest.mark.skip()
def test_record_video_to_path_persistent(
browser_type, tmpdir, server, launch_arguments
):
Expand All @@ -60,3 +56,16 @@ def test_record_video_to_path_persistent(
assert str(tmpdir) in str(path)
context.close()
assert os.path.exists(path)


def test_record_video_can_get_video_path_immediately(
browser_type, tmpdir, launch_arguments
):
context = browser_type.launch_persistent_context(
tmpdir, **launch_arguments, record_video_dir=tmpdir
)
page = context.pages[0]
path = page.video.path()
assert str(tmpdir) in str(path)
context.close()
assert os.path.exists(path)