Skip to content
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
18 changes: 16 additions & 2 deletions tests/async/test_defaultbrowsercontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
Awaitable,
Callable,
Dict,
List,
Literal,
Optional,
Tuple,
)

import pytest

from playwright.async_api import BrowserContext, BrowserType, Error, Page, expect
from playwright.async_api import (
BrowserContext,
BrowserType,
Cookie,
Error,
Page,
expect,
)
from tests.server import Server
from tests.utils import must

Expand Down Expand Up @@ -116,6 +124,12 @@ async def test_context_add_cookies_should_work(
]


def _filter_cookies(cookies: List[Cookie]) -> List[Cookie]:
return list(
filter(lambda cookie: cookie["domain"] != "copilot.microsoft.com", cookies)
)


async def test_context_clear_cookies_should_work(
server: Server,
launch_persistent: "Callable[..., asyncio.Future[Tuple[Page, BrowserContext]]]",
Expand All @@ -131,7 +145,7 @@ async def test_context_clear_cookies_should_work(
assert await page.evaluate("document.cookie") == "cookie1=1; cookie2=2"
await page.context.clear_cookies()
await page.reload()
assert await page.context.cookies([]) == []
assert _filter_cookies(await page.context.cookies([])) == []
assert await page.evaluate("document.cookie") == ""


Expand Down
2 changes: 1 addition & 1 deletion tests/async/test_selector_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def test_should_use_data_test_id_in_strict_errors(
"""
)
with pytest.raises(Error) as exc_info:
await page.locator(".foo").hover(timeout=200)
await page.locator(".foo").hover()
assert "strict mode violation" in exc_info.value.message
assert '<div class="foo bar:0' in exc_info.value.message
assert '<div class="foo bar:1' in exc_info.value.message
Expand Down
Loading