Skip to content

Merge fix/sdk-7711-percy-capture - #219

Merged
Dalwin-Barnard merged 5 commits into
sdk_v9_pre_prodfrom
fix/sdk-7711-percy-capture
Sep 23, 2026
Merged

Dalwin-Barnard merged 5 commits into
sdk_v9_pre_prodfrom
fix/sdk-7711-percy-capture

Conversation

@bsautomation

Copy link
Copy Markdown

Merge into sdk_v9_pre_prod :by automationbs

Percy capture has been silently disabled for any install resolving
@percy/selenium-webdriver 2.2.6 or newer (published 2026-04-01). Tests still
passed, so the only symptoms were a log line and missing visual coverage.

2.2.6 added a top-level require('selenium-webdriver') for a Selenium-only
iframe helper, but that package is shipped as a devDependency only and is never
present in a WebdriverIO project, so the module throws MODULE_NOT_FOUND on load.
tryRequire swallowed the throw and left the Percy entry points as no-op stubs
logging "Unsupported driver for percy" — a message about the driver for what was
actually a failed module load. Our floating "^2.2.2" range is what admitted the
broken version, on the v9 and v8 lines alike.

- Cap @percy/selenium-webdriver below 2.2.6.
- Log the underlying load failure instead of discarding it, so a future
  packaging break surfaces as itself.
- Route all three Percy entry points through a shared helper that logs errors
  rather than propagating them into the user's test. Percy raises its misuse
  guards before its own try/catch, so capping alone would have started throwing
  from snapshot/screenshot calls. PERCY_RAISE_ERROR is honoured for users who
  want failures to fail the build.
- Document Percy in the README for the first time: the percy and
  percyCaptureMode options, that this service runs Percy on Automate, and how to
  drive a Percy web project alongside it.

App Automate is unaffected — it uses @percy/appium-app, a separate package.

The v8 line declares the same floating range and needs the equivalent change on
the v8 branch; this covers v9 only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Percy released 2.2.8, which guards the require that broke module load, so the
cap added in the previous commit is no longer needed and the range returns to
^2.2.2. The lockfile is refreshed onto 2.2.8.

That leaves the second, older defect. The service routes its `snapshot` (Percy
web) export to @percy/selenium-webdriver's percySnapshot, which drives the
browser through Selenium client APIs — executeScript(script) with a single
argument, By, switchTo(). A WebdriverIO browser provides none of those, so the
call fails on the first driver interaction, the SDK swallows the failure, and
zero snapshots are posted. That path has never worked on WebdriverIO at any
version. @percy/webdriverio is the WebdriverIO-native port and is what `snapshot`
now binds to.

percyScreenshot (Percy on Automate) deliberately stays on
@percy/selenium-webdriver: it is driver-agnostic — it reads session metadata and
posts, with capture happening server-side — and carries an explicit wdio branch
in its DriverMetadata.

@percy/webdriverio is pinned below 3.3.3; that release omits a file its own entry
point requires and fails to load.

Verified on a live BrowserStack WebdriverIO v9 session against a web-typed Percy
runtime: through the service's own export, snapshot posts one snapshot carrying a
594-byte serialized DOM, where the Selenium SDK on the identical browser posts
none and logs "Wrong parameters applied for executeScript".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The disabled-path stub stayed synchronous while its enabled branch became
async, so TypeScript inferred the export from the initial assignment and
published `snapshot` as `=> void` while `screenshot` and `screenshotApp`
were `Promise<unknown>`. Consumers awaiting it awaited a void.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bsautomation
bsautomation requested a review from a team as a code owner September 23, 2026 13:00
@bsautomation
bsautomation requested review from AdityaHirapara and rounak610 and removed request for a team September 23, 2026 13:00
@coderabbitai

coderabbitai Bot commented Sep 23, 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

Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 15e2ab98-f3a7-4e95-a7a5-0f61eb103d8c

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

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

@Dalwin-Barnard
Dalwin-Barnard merged commit b131633 into sdk_v9_pre_prod Sep 23, 2026
30 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants