Skip to content

About

Audits which BrowserStack capabilities listed under Selenium actually work with Playwright

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BrowserStack × Playwright Capability Audit

Audits which BrowserStack capabilities documented under the Selenium tab of /docs/automate/capabilities actually take effect when used with Playwright. Produces a colour-coded spreadsheet, a JSON report, and a doc-team action plan.

Read AUDIT_REPORT.md for the latest findings narrative. The Confluence task brief lives at [Task Brief] BrowserStack × Playwright Capability Audit — Doc Cleanup & Backend Gaps in the Engineering space.


What this does

For each documented capability, the audit:

  1. Opens a dedicated BrowserStack session via direct CDP (wss://cdp.browserstack.com/playwright?caps=…) — no SDK in the loop.
  2. Sets the capability under test (and only that capability) on top of a base config.
  3. Asserts an in-browser observable effect where possible (e.g. Intl.DateTimeFormat().resolvedOptions().timeZone for timezone).
  4. After all sessions finish, queries the BrowserStack REST API to verify artefact URLs (video_url, network_logs_url, etc.).
  5. Produces a per-capability verdict: PASS, FAIL, SDK-only, ERROR, or NO MATCH.

44 entries cover the 68 documented Selenium capabilities (related variants like ie.*, safari.* are grouped).


Prerequisites

  • Node.js ≥ 18
  • BrowserStack Automate credentials with permission to start parallel sessions
  • ~25 minutes of session time on the account (44 sessions, ~30 sec each)

Run

npm install
export BROWSERSTACK_USERNAME=<your-username>
export BROWSERSTACK_ACCESS_KEY=<your-access-key>
export BUILD_NAME=playwright-cap-audit-$(date +%s)   # optional; auto-generated if unset

npm run audit          # 44 BrowserStack sessions, ~25 min
node build-xlsx.js     # rebuild the spreadsheet from capability-audit-report.json

Outputs (gitignored — regenerated each run):

  • capability-audit-report.json — raw run data
  • capability-audit-report.xlsx — 4-sheet workbook (Summary, REST Sessions, Doc Action Plan, Legend)
  • audit-run-full.log — stdout from the run

Important: Playwright version pinning

BrowserStack's Playwright CDP endpoint silently closes connections from certain Playwright client versions (WebSocket close code 1005, no error message — the connection just dies after ~6-9 seconds).

This repo pins playwright@1.42.1 and passes 'client.playwrightVersion': '1.42.1' in the caps object. Do not bump Playwright without first verifying with node probe.js that the new version still completes a CDP handshake against cdp.browserstack.com.

Production data (90-day BigQuery analysis in the platform-audit repo) shows modern PW versions 1.50–1.59.1 do connect successfully — the precise unsupported set is narrower than the audit pin suggests. The real version-compatibility issue surfaces as Unknown scheme for Params: <method> errors mid-session when newer PW protocol methods are called (Page.snapshotForAI, setDefaultTimeoutNoReply family, etc.). See ENG-4 for the reframed scope.


ENG-N action item index

Engineering action items raised by this audit are tracked in the Confluence task brief and elaborated with reproduction steps, session evidence, and production usage data in the eng-verification dossier in the platform-audit repo.

Tag Where surfaced in this repo Topic Tier
ENG-1 capability-support-matrix.csv — networkLogs row HAR / network-logs propagation on PW (79 users in 90 d) Tier 2
ENG-2 capability-support-matrix.csv — telemetryLogs row Telemetry logs (1 user — drop, doc-cleanup) Doc cleanup
ENG-3 capability-support-matrix.csv — resolution row Resolution propagation on PW (398 users) Tier 1
ENG-4 This README (above) PW version compatibility — newer protocol methods (~400 users) Tier 2
ENG-5 capability-support-matrix.csv — safari.* row safari.* caps on PW (1 user — drop, doc-cleanup) Doc cleanup
ENG-6 capability-support-matrix.csv — localIdentifier row Local tunnel propagation (1,726 users silent-fail + 1,048 disconnect) 🔥 Tier 1
ENG-7 This README (below — Layout section) Multi-language PW SDK parity (Java/C#) Tier 2
ENG-8 capability-support-matrix.csv — networkProfile row Mobile networkProfile on PW (6+7 users — drop, doc-cleanup) Doc cleanup
ENG-9 Platform-audit repo only REST API 504s (cross-framework infra) Tier 1
ENG-10 Platform-audit repo only Crash logs / terminal logs (1,031 users) 🔥 Tier 1
ENG-11 capability-support-matrix.csv — region / dataCenter row DC region cap (6 users — hard-verified no-op on both Selenium AND PW) Doc cleanup
ENG-12 capability-support-matrix.csv — chromeOptions.args row chromeOptions.args (11 users — see PRD Confluence/6200099061) Doc cleanup

ENG-9 and ENG-10 do not have direct rows in this repo's CSV because they surfaced from the broader platform audit (REST API behaviour and failure-mode telemetry), not from per-cap CDP probing.


Layout

File Purpose
audit.js Entry point. Iterates capabilities, opens one CDP session per cap, invokes REST verification at the end.
capabilities.js The 44 capability test definitions.
build-xlsx.js Reads capability-audit-report.json and writes the formatted .xlsx.
probe.js One-off connectivity probe — useful when bumping Playwright versions.
AUDIT_REPORT.md Narrative findings from the latest run.
package.json npm run audit script + pinned dependencies.

The following files are kept as reference / legacy and are not used by npm run audit:

  • browserstack.yml, playwright.config.js, tests/, teardown.js — the BrowserStack SDK approach. Currently broken with browserstack-node-sdk@1.52.2 + Playwright 1.x — see ENG-7 in the Confluence brief.
  • browserstack.minimal.yml, playwright.minimal.config.js, tests-minimal/ — minimal repro of the SDK breakage.
  • ws-raw.js — raw WebSocket probe used while debugging the silent CDP close.

Re-running after a backend fix

The audit is idempotent. After Engineering ships a fix for one of the doc-removal candidates (e.g. network_logs_url for Playwright), simply re-run npm run audit — the verdict for that capability will flip from FAIL to PASS, and the spreadsheet will reflect the change.


Adding a new capability

  1. Add an entry to capabilities.js with cap, group, caps, expect, and a run(page) function that asserts the expected behaviour in-browser (or returns { pass: true, detail: '…' } if the capability has no observable in-browser effect).
  2. If the capability produces a REST artefact URL, set expect: 'present' | 'absent' and artifact: '<field-name>'.
  3. If the capability is SDK-only / structural (cannot be passed via CDP), set runnable: false.
  4. Run npm run audit.

About

Audits which BrowserStack capabilities listed under Selenium actually work with Playwright

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages