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
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10']
browser: [chromium, firefox, webkit]
exclude:
# WebKit on standard macOS-latest (currently macos-15-arm64) is unstable;
# upstream pins paid macos-15-xlarge for cross-browser webkit too.
- os: macos-latest
browser: webkit
include:
- os: macos-15-xlarge
python-version: '3.9'
browser: webkit
- os: macos-15-xlarge
python-version: '3.10'
browser: webkit
- os: windows-latest
python-version: '3.11'
browser: chromium
Expand Down Expand Up @@ -160,7 +171,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-2022]
os: [ubuntu-22.04, macos-latest, windows-2022]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down
5 changes: 3 additions & 2 deletions tests/async/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import re
from typing import Dict

import pytest

Expand Down Expand Up @@ -56,9 +57,9 @@ async def test_should_return_browser_type(


async def test_bind_should_return_endpoint_and_allow_unbind(
browser_type: BrowserType,
browser_type: BrowserType, launch_arguments: Dict
) -> None:
browser = await browser_type.launch()
browser = await browser_type.launch(**launch_arguments)
try:
result = await browser.bind("test-server")
assert "endpoint" in result
Expand Down
7 changes: 6 additions & 1 deletion tests/async/test_browsercontext_storage_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import asyncio
import json
from pathlib import Path
from typing import Optional

import pytest

from playwright.async_api import Browser, BrowserContext, Page, StorageState
from tests.server import Server
Expand Down Expand Up @@ -134,8 +137,10 @@ async def test_should_round_trip_through_the_file(


async def test_set_storage_state_should_apply_state_to_existing_context(
browser: Browser,
browser: Browser, browser_channel: Optional[str]
) -> None:
if browser_channel and browser_channel.startswith("msedge"):
pytest.skip("Network.clearBrowserCache sometimes stalls on msedge")
src = await browser.new_context()
src_page = await src.new_page()
await src_page.route(
Expand Down
4 changes: 3 additions & 1 deletion tests/async/test_browsertype_connect_cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ async def test_connect_over_cdp_passing_header_works(
request = asyncio.create_task(server.wait_for_request("/ws"))
with pytest.raises(Error):
await browser_type.connect_over_cdp(
f"ws://127.0.0.1:{server.PORT}/ws", headers={"foo": "bar"}
f"ws://127.0.0.1:{server.PORT}/ws",
headers={"foo": "bar"},
timeout=5000,
)
assert (await request).getHeader("foo") == "bar"

Expand Down
16 changes: 16 additions & 0 deletions tests/sync/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict

from playwright.sync_api import Browser, BrowserType


def test_should_return_browser_type(
browser: Browser, browser_type: BrowserType
) -> None:
assert browser.browser_type is browser_type


def test_bind_should_return_endpoint_and_allow_unbind(
browser_type: BrowserType, launch_arguments: Dict
) -> None:
browser = browser_type.launch(**launch_arguments)
try:
result = browser.bind("test-server")
assert "endpoint" in result
assert isinstance(result["endpoint"], str)
assert len(result["endpoint"]) > 0
browser.unbind()
finally:
browser.close()
Loading