Skip to content

feat(automate): run SDK tests in a local Chrome, with accessibility scans - #522

Draft
Aaryan430 wants to merge 4 commits into
mainfrom
feat/ata-1480-local-browser-a11y
Draft

Aaryan430 wants to merge 4 commits into
mainfrom
feat/ata-1480-local-browser-a11y

Conversation

@Aaryan430

@Aaryan430 Aaryan430 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Jira: ATA-1480 — running a workflow accessibility scan without an Automate license.

Why

A user without an Automate license who asks for the accessibility issues of a user flow has no route today:

  • setupBrowserStackAutomateTests only sets up runs on BrowserStack, and its browserstack.yml never turns accessibility on (no accessibility: true anywhere in sdk-utils).
  • startAccessibilityScan covers one page, not a flow.

The SDK already supports running tests in a local browser with browserstackAutomation: false: it loads its scanner into that browser, and no Automate session is created. This PR has the MCP set that up.

What changes

setupBrowserStackAutomateTests gains two optional parameters. Leaving both off gives exactly the output it gives today.

Param Adds
accessibility accessibility: true in browserstack.yml (for Cypress: run_settings; for WebdriverIO: the service options); a step that writes a test for the user's flow when none exists, gets it passing without the SDK first, and gives it a timeout of several minutes; a step to read the issues with fetchAccessibilityIssues using the run's thBuildId
runOnLocalBrowser browserstackAutomation: false, one platform (chrome, browserVersion: latest, marked required), browserstackLocal: false, no device validation; a step to upgrade the SDK; Chrome for Testing for Selenium (SE_FORCE_BROWSER_DOWNLOAD=true, no code change), or Playwright on full Chromium named in full (browserName: "chromium" and channel: "chromium"). Cypress and WebdriverIO are refused with an error, because BrowserStack documents no local run for them

Routing (within each tool's description budget; no server-wide text, following the #511 review):

  • setupBrowserStackAutomateTests mentions local runs and accessibility (328 → 323 chars).
  • startAccessibilityScan (200) and accessibilityExpert (184) say a user flow goes to setupBrowserStackAutomateTests with no Automate license needed. Clients that defer tools show only tool names until one is loaded, and in the first end-to-end test the agent read "Automate" in the name as "needs a license", then wrote its own Playwright + axe-core script instead. It had loaded these two tools, so they now carry the pointer (2ba0804).

Also:

  • fetchAccessibilityIssues "Build not found" now also names the cause hit in testing: the build ran under a different account than the server's.
  • docs/TOOLS.md rows are updated.

Evidence (bstackdemo.com sign-in → cart → checkout, local machine)

Run Result
Python SDK 1.51.2 + Selenium, Chrome for Testing 156 Passed, 18 scans, 130 issues read back with fetchAccessibilityIssues
The same test on BrowserStack infra (macOS Sequoia) 131 issues, 129 identical by rule + selector; the 3 differences depend on focus or hover state
SE_FORCE_BROWSER_DOWNLOAD=true, no binary path in the test Ran on Chrome for Testing 156 (installed Chrome is 155), scans saved
No browserVersion in platforms (2 runs) Scans ran, but the test was reported with accessibility: false and nothing reached the dashboard
Node SDK 1.75.1 + Playwright 1.64.1, default config Failed on Playwright's 30 s test timeout: every action waits for a scan
The same, default headless shell, longer timeout Passed, "scan succeeded" × 14, but 0 issues saved: the shell loads no extension
The same, channel: "chromium" Passed, 199 issues, including 125 of the Selenium run's 130 (the extra 72 are needs-review color-contrast items)
The same, channel: "chromium" but no browserName (what the agent wrote in end-to-end test #2) Passed in 42 s, 0 scans: the SDK's isSupportedPlaywright throws on the unset browserName. The step now requires it (latest commit)
Routing: Claude Code, strict MCP config, no user settings, hooks, plugins or skills (2 headless runs, the user's prompt) Both called setupBrowserStackAutomateTests with accessibility and runOnLocalBrowser

Unit tests: tests/tools/sdk-utils-local-accessibility.test.ts (yml for local, cloud and plain runs; steps for pytest local, Playwright local, Cypress refused, WebdriverIO accessibility, and a plain run unchanged), plus a routing test in accessibility.test.ts. 1481 tool tests pass.

Not verified yet

  • No-license accounts. Every run above used a licensed account. Whether the backend lets a no-license account start a local accessibility build is the open question for ATA-1480.
  • Java and C# local runs. Covered by the docs and release notes, not run here.

SDK-side follow-ups (not in this PR)

  • A local run without browserVersion saves nothing and raises no error.
  • On a browser that can't load the scanner, the Node SDK still logs "Accessibility scan succeeded".
  • With Playwright's use.browserName unset (Playwright's own default), the Node SDK throws in isSupportedPlaywright (reading 'match') and runs the test without scanning.
  • The existing Node setup step npx browserstack-node-sdk setup --username … --key … (pre-existing, not changed here) fails with "Not a valid command" on browserstack-node-sdk 1.75.1.

🤖 Generated with Claude Code

…cans

setupBrowserStackAutomateTests gains two options (ATA-1480):

- accessibility: adds `accessibility: true` to browserstack.yml (or the
  Cypress/WebdriverIO setting), asks for a test of the user's flow when
  there is none, and says how to read the issues with
  fetchAccessibilityIssues after the run.
- runOnLocalBrowser: `browserstackAutomation: false` with one local
  Chrome platform and no tunnel, so a user without an Automate license
  can still get a flow's accessibility issues. Selenium runs on Chrome for
  Testing through SE_FORCE_BROWSER_DOWNLOAD (installed Chrome 142+ blocks
  the scanner); Playwright on its bundled Chromium. Cypress and
  WebdriverIO are refused: BrowserStack documents no local run for them.

The tool and startAccessibilityScan descriptions route a user flow here,
within their budgets. A "Build not found" also names the other cause
seen in testing: a build run under a different account than the server's.

Checked end to end with the Python SDK (1.51.2) on bstackdemo.com: the
local run found 130 issues, 129 of them the same as the same test on
BrowserStack infra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited), Workspace UI (inherited); Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 7cf02d4f-54aa-4e70-8411-bce3e042d39c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Aaryan430 and others added 3 commits October 26, 2026 19:18
…gents look

In a first end-to-end test (Claude Code, strict MCP config) the agent never
loaded setupBrowserStackAutomateTests: clients that defer tools show only
names until one is loaded, and it read "Automate" in the name as "needs an
Automate license", then fell back to its own Playwright + axe-core script.
It had loaded startAccessibilityScan and accessibilityExpert, so those now
say a flow runs without one (runOnLocalBrowser), within their budgets.

In two headless re-runs with the same isolation, the agent called
setupBrowserStackAutomateTests with accessibility and runOnLocalBrowser on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e for it

Checked the Node + Playwright local path end to end (browserstack-node-sdk
1.75.1, Playwright 1.64.1, bstackdemo.com), which is what an agent picks
when the user has no tests:

- Playwright's default 30 s test timeout fails the scanned run: every
  action waits for a scan of a few seconds. The flow step now asks for a
  timeout of several minutes.
- On Playwright's default headless shell the SDK logged every scan as
  succeeded (~10 s each) and saved a report with 0 issues: the shell loads
  no extension. With channel: "chromium" the same test saved 199 issues,
  125 of the 130 the Selenium run found. The browser step now says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second end-to-end test (Claude Code, strict MCP config) routed to
setupBrowserStackAutomateTests and followed its steps, but its
playwright.config set channel: "chromium" without browserName. The Node SDK
(1.75.1) reads use.browserName itself: unset, its isSupportedPlaywright
check throws "Cannot read properties of undefined (reading 'match')", logs
"Not a valid Accessibility Automation session", and the test passes with
no scans and an empty report. Reproduced by removing only browserName from
a config that had saved 199 issues: 0 scans.

The Playwright step now asks for both browserName and channel, and notes
Playwright's Node.js 20 floor (the test machine defaulted to Node 18).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant