Merge fix/sdk-7711-percy-capture - #219
Merged
Merged
Conversation
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
requested review from
AdityaHirapara and
rounak610
and removed request for
a team
September 23, 2026 13:00
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited) Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge into sdk_v9_pre_prod :by automationbs