Skip to content
Open
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
5 changes: 1 addition & 4 deletions .github/workflows/infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/tests_bidi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ on:
description: Playwright SHA / ref to test. Use 'refs/pull/PULL_REQUEST_ID/head' to test a PR. Defaults to the current branch.
required: false
default: ''
pull_request:
branches:
- main
paths:
- .github/workflows/tests_bidi.yml
- packages/playwright-core/src/server/bidi/**
- tests/bidi/**
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge
schedule:
# Run every day at midnight
- cron: '0 0 * * *'
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/tests_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'packages/playwright-core/src/tools/**'
- 'tests/bidi/**'
- 'tests/extension/**'
- 'tests/mcp/**'
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

env:
FORCE_COLOR: 1
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/tests_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ on:
- 'packages/extension/**'
- 'tests/extension/**'
- '.github/workflows/tests_extension.yml'
pull_request:
branches:
- main
- release-*
paths:
- 'packages/playwright-core/src/tools/**'
- '!packages/playwright-core/src/tools/dashboard/**'
- '!packages/playwright-core/src/tools/trace/**'
- 'packages/extension/**'
- 'tests/extension/**'
- '.github/workflows/tests_extension.yml'
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/tests_mcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'tests/bidi/**'
- 'tests/extension/**'
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

concurrency:
# For pull requests, cancel all currently-running jobs for this workflow
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/tests_others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'tests/bidi/**'
types: [ labeled ]
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

env:
FORCE_COLOR: 1
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/tests_primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'packages/playwright-core/src/tools/**'
- 'tests/bidi/**'
- 'tests/extension/**'
- 'tests/mcp/**'
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

concurrency:
# For pull requests, cancel all currently-running jobs for this workflow
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/tests_secondary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ on:
branches:
- main
- release-*
pull_request:
types: [ labeled ]
branches:
- main
- release-*
# pull_request trigger disabled to avoid CI churn during wk_wv iteration - restore before merge

env:
# Force terminal colors. @see https://www.npmjs.com/package/colors
Expand Down
228 changes: 228 additions & 0 deletions .github/workflows/tests_webview_simulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
name: "tests WebView (iOS Simulator)"

on:
workflow_dispatch:
pull_request:
paths:
- 'packages/playwright-core/src/server/webkit/webview/**'
- 'tests/webview/**'
- '.github/workflows/tests_webview_simulator.yml'
branches:
- main
- release-*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
# Loud protocol logging so we can post-mortem any handshake failure.
# wvBrowser.ts wires helper.debugProtocolLogger() as protocolLogger, identical
# to wkBrowser.ts — so pw:protocol emits SEND ► / ◀ RECV for every wire frame.
DEBUG: pw:protocol,pw:browser*

jobs:
test_webview_simulator:
name: "WebView on iOS Simulator"
runs-on: macos-15
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Runner environment
run: |
echo "::group::OS / Xcode"
sw_vers
uname -a
xcode-select -p
xcodebuild -version
echo "::endgroup::"
echo "::group::Available iOS runtimes"
xcrun simctl list runtimes
echo "::endgroup::"
echo "::group::Available device types"
xcrun simctl list devicetypes | grep -i 'iPhone\|iPad' | head -40
echo "::endgroup::"
echo "::group::Network config"
cat /etc/hosts
ifconfig lo0
echo "::endgroup::"

- name: Ensure ::1 localhost in /etc/hosts
run: |
if grep -qE '^::1[[:space:]]+localhost' /etc/hosts; then
echo "::1 localhost already present"
else
echo "::1 localhost" | sudo tee -a /etc/hosts
echo "Added ::1 localhost"
fi
echo "--- /etc/hosts after ---"
cat /etc/hosts

- name: npm ci
run: |
echo "::group::npm ci"
npm ci
echo "::endgroup::"

- name: npm run build
run: |
echo "::group::npm run build"
npm run build
echo "::endgroup::"

- name: Install ios-webkit-debug-proxy
run: |
echo "::group::brew install ios-webkit-debug-proxy"
brew install ios-webkit-debug-proxy
which ios_webkit_debug_proxy
ios_webkit_debug_proxy --help 2>&1 | head -40 || true
echo "::endgroup::"

- name: Boot iOS Simulator
uses: futureware-tech/simulator-action@v5
with:
model: 'iPhone 15'
wait_for_boot: true
boot_timeout_seconds: 300

- name: Simulator state after boot
run: |
echo "::group::Booted devices"
xcrun simctl list devices booted
echo "::endgroup::"
echo "::group::Simulator processes"
pgrep -lf Simulator || true
pgrep -lf launchd_sim || true
echo "::endgroup::"

- name: Launch Mobile Safari
run: |
echo "::group::Launching Mobile Safari"
xcrun simctl launch booted com.apple.mobilesafari "about:blank"
sleep 2
echo "::endgroup::"
echo "::group::Mobile Safari process"
pgrep -lf MobileSafari || true
echo "::endgroup::"

- name: Start ios-webkit-debug-proxy
run: |
echo "::group::Starting proxy"
ios_webkit_debug_proxy -F -d -c "null:9221,:9222-9322" > "$RUNNER_TEMP/iwdp.log" 2>&1 &
PID=$!
echo "IWDP_PID=$PID" >> $GITHUB_ENV
echo "proxy pid=$PID"
sleep 3
if ! kill -0 "$PID" 2>/dev/null; then
echo "Proxy died immediately. Log:"
cat "$RUNNER_TEMP/iwdp.log"
exit 1
fi
echo "::endgroup::"
echo "::group::Listening ports"
lsof -nP -iTCP -sTCP:LISTEN | grep -E "9221|9222|ios_webkit" || true
echo "::endgroup::"

- name: Discover WebSocket endpoint
run: |
echo "::group::Device list (port 9221)"
for i in $(seq 1 15); do
if curl -sf http://localhost:9221/json > /tmp/devices.json; then
jq . /tmp/devices.json
[[ "$(jq 'length' /tmp/devices.json)" -gt 0 ]] && break
fi
echo "attempt $i: no devices yet"
sleep 1
done
echo "::endgroup::"

echo "::group::Tab list (port 9222)"
for i in $(seq 1 30); do
if curl -sf http://localhost:9222/json > /tmp/tabs.json && [[ "$(jq 'length' /tmp/tabs.json)" -gt 0 ]]; then
jq . /tmp/tabs.json
break
fi
echo "attempt $i: no tabs yet"
sleep 1
done
if [[ ! -s /tmp/tabs.json ]] || [[ "$(jq 'length' /tmp/tabs.json)" == "0" ]]; then
echo "Failed to discover any tab"
echo "--- proxy log ---"
cat "$RUNNER_TEMP/iwdp.log"
exit 1
fi
echo "::endgroup::"

WS=$(jq -r '.[0].webSocketDebuggerUrl' /tmp/tabs.json)
TITLE=$(jq -r '.[0].title' /tmp/tabs.json)
URL=$(jq -r '.[0].url' /tmp/tabs.json)
echo "discovered tab title=$TITLE url=$URL"
echo "discovered ws endpoint=$WS"
if [[ -z "$WS" || "$WS" == "null" ]]; then
echo "No webSocketDebuggerUrl"
exit 1
fi
echo "PW_WEBVIEW_CDP_ENDPOINT=$WS" >> $GITHUB_ENV

- name: Pre-flight WebSocket reachability
run: |
echo "::group::Pre-flight"
echo "PW_WEBVIEW_CDP_ENDPOINT=$PW_WEBVIEW_CDP_ENDPOINT"
# Strip ws:// and split host:port from the URL for a basic TCP check
HOSTPORT=$(echo "$PW_WEBVIEW_CDP_ENDPOINT" | sed -E 's|^ws://||' | cut -d/ -f1)
echo "checking TCP reachability of $HOSTPORT"
nc -zv ${HOSTPORT/:/ } || true
echo "::endgroup::"

- name: Run WebView tests
run: |
echo "::group::Test run (DEBUG=$DEBUG)"
# Mirror protocol logs to file via DEBUG_FILE (read by packages/utils/debugLogger.ts).
# Filtered to page-check as an initial sanity set; widen once the protocol
# wrapping is proven against Mobile Safari.
npx playwright test --config tests/webview/playwright.config.ts --reporter=list tests/page/page-check.spec.ts
echo "::endgroup::"
env:
DEBUG_FILE: ${{ github.workspace }}/playwright-debug.log

- name: Protocol log tail
if: always()
run: |
if [[ -s "${{ github.workspace }}/playwright-debug.log" ]]; then
SIZE=$(wc -c < "${{ github.workspace }}/playwright-debug.log")
echo "::group::pw:protocol log (size=$SIZE bytes, tailing last 400KB)"
tail -c 400000 "${{ github.workspace }}/playwright-debug.log"
echo "::endgroup::"
else
echo "::warning::No protocol log produced — DEBUG=$DEBUG may not have matched any namespace"
fi

- name: Proxy log
if: always()
run: |
echo "::group::ios-webkit-debug-proxy log"
cat "$RUNNER_TEMP/iwdp.log" || true
echo "::endgroup::"

- name: Stop proxy and simulator
if: always()
run: |
[[ -n "$IWDP_PID" ]] && kill "$IWDP_PID" 2>/dev/null || true
xcrun simctl shutdown booted || true

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: webview-simulator-logs
path: |
${{ runner.temp }}/iwdp.log
${{ github.workspace }}/playwright-debug.log
${{ github.workspace }}/test-results/**
if-no-files-found: ignore
5 changes: 3 additions & 2 deletions packages/injected/src/injectedScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,9 @@ export class InjectedScript {
return;

// Playwright only issues trusted events, so allow any custom events originating from
// the page or content scripts.
if (!event.isTrusted)
// the page or content scripts. The WebView backend cannot produce trusted events, so
// it marks synthetic events with __pwTrustedSynthetic to opt back into interception.
if (!event.isTrusted && !(event as any).__pwTrustedSynthetic)
return;

// Determine the event point. Note that Firefox does not always have window.TouchEvent.
Expand Down
4 changes: 2 additions & 2 deletions packages/playwright-core/src/client/browserType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
}

async _connectOverCDP(endpointURL: string, params: api.ConnectOverCDPOptions = {}): Promise<Browser> {
if (this.name() !== 'chromium')
throw new Error('Connecting over CDP is only supported in Chromium.');
if (this.name() !== 'chromium' && this.name() !== 'webkit')
throw new Error('Connecting over CDP is only supported in Chromium and WebKit.');
const headers = params.headers ? headersObjectToArray(params.headers) : undefined;
const result = await this._channel.connectOverCDP({
endpointURL,
Expand Down
Loading
Loading