Skip to content

Commit 1f847dd

Browse files
authored
fix(ci): pass launch args to bind test, pin macOS WebKit to xlarge (#3051)
1 parent d9a922d commit 1f847dd

5 files changed

Lines changed: 40 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ jobs:
5050
os: [ubuntu-latest, windows-latest, macos-latest]
5151
python-version: ['3.9', '3.10']
5252
browser: [chromium, firefox, webkit]
53+
exclude:
54+
# WebKit on standard macOS-latest (currently macos-15-arm64) is unstable;
55+
# upstream pins paid macos-15-xlarge for cross-browser webkit too.
56+
- os: macos-latest
57+
browser: webkit
5358
include:
59+
- os: macos-15-xlarge
60+
python-version: '3.9'
61+
browser: webkit
62+
- os: macos-15-xlarge
63+
python-version: '3.10'
64+
browser: webkit
5465
- os: windows-latest
5566
python-version: '3.11'
5667
browser: chromium
@@ -160,7 +171,7 @@ jobs:
160171
strategy:
161172
fail-fast: false
162173
matrix:
163-
os: [ubuntu-22.04, macos-13, windows-2022]
174+
os: [ubuntu-22.04, macos-latest, windows-2022]
164175
runs-on: ${{ matrix.os }}
165176
defaults:
166177
run:

tests/async/test_browser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import re
16+
from typing import Dict
1617

1718
import pytest
1819

@@ -56,9 +57,9 @@ async def test_should_return_browser_type(
5657

5758

5859
async def test_bind_should_return_endpoint_and_allow_unbind(
59-
browser_type: BrowserType,
60+
browser_type: BrowserType, launch_arguments: Dict
6061
) -> None:
61-
browser = await browser_type.launch()
62+
browser = await browser_type.launch(**launch_arguments)
6263
try:
6364
result = await browser.bind("test-server")
6465
assert "endpoint" in result

tests/async/test_browsercontext_storage_state.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import asyncio
1616
import json
1717
from pathlib import Path
18+
from typing import Optional
19+
20+
import pytest
1821

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

135138

136139
async def test_set_storage_state_should_apply_state_to_existing_context(
137-
browser: Browser,
140+
browser: Browser, browser_channel: Optional[str]
138141
) -> None:
142+
if browser_channel and browser_channel.startswith("msedge"):
143+
pytest.skip("Network.clearBrowserCache sometimes stalls on msedge")
139144
src = await browser.new_context()
140145
src_page = await src.new_page()
141146
await src_page.route(

tests/async/test_browsertype_connect_cdp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ async def test_connect_over_cdp_passing_header_works(
9696
request = asyncio.create_task(server.wait_for_request("/ws"))
9797
with pytest.raises(Error):
9898
await browser_type.connect_over_cdp(
99-
f"ws://127.0.0.1:{server.PORT}/ws", headers={"foo": "bar"}
99+
f"ws://127.0.0.1:{server.PORT}/ws",
100+
headers={"foo": "bar"},
101+
timeout=5000,
100102
)
101103
assert (await request).getHeader("foo") == "bar"
102104

tests/sync/test_browser.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,26 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Dict
16+
1517
from playwright.sync_api import Browser, BrowserType
1618

1719

1820
def test_should_return_browser_type(
1921
browser: Browser, browser_type: BrowserType
2022
) -> None:
2123
assert browser.browser_type is browser_type
24+
25+
26+
def test_bind_should_return_endpoint_and_allow_unbind(
27+
browser_type: BrowserType, launch_arguments: Dict
28+
) -> None:
29+
browser = browser_type.launch(**launch_arguments)
30+
try:
31+
result = browser.bind("test-server")
32+
assert "endpoint" in result
33+
assert isinstance(result["endpoint"], str)
34+
assert len(result["endpoint"]) > 0
35+
browser.unbind()
36+
finally:
37+
browser.close()

0 commit comments

Comments
 (0)