Skip to content

fix(webdriver-utils): propagate labels onto comparisonData for POA snapshots#2239

Open
prklm10 wants to merge 6 commits into
masterfrom
fix/poa-labels-propagation
Open

fix(webdriver-utils): propagate labels onto comparisonData for POA snapshots#2239
prklm10 wants to merge 6 commits into
masterfrom
fix/poa-labels-propagation

Conversation

@prklm10
Copy link
Copy Markdown
Contributor

@prklm10 prklm10 commented May 25, 2026

Summary

  • POA (Percy on Automate) snapshots silently dropped per-screenshot labelsWebdriverUtils.captureScreenshot forwarded sync, testCase, and thTestCaseExecutionId from options onto the returned comparisonData but not labels, so labels never reached percy.uploadsendComparisoncreateSnapshot (which converts labels to tags on the snapshot POST). The result: POA tags were always empty regardless of SDK input.
  • One-line fix at packages/webdriver-utils/src/index.js:42.
  • Tests added at three layers to lock the contract end-to-end.

Root cause

packages/webdriver-utils/src/index.js

comparisonData.sync = options.sync;
comparisonData.testCase = options.testCase;
comparisonData.labels = options.labels;            // <- added
comparisonData.thTestCaseExecutionId = options.thTestCaseExecutionId;

Tests

  • packages/webdriver-utils/test/index.test.js (new) — 5 specs for WebdriverUtils.captureScreenshot:
    • forwards labels onto comparisonData
    • undefined when not provided
    • does not lose labels when provider response has none
    • works for playwright provider
    • re-throws provider errors
  • packages/client/test/client.test.jssendComparison spec asserts labels: 'qa, smoke,release' becomes tags: [{id: null, name: 'qa'}, ...] on the snapshot POST body.
  • packages/core/test/api.test.js/percy/automateScreenshot spec asserts labels survive percyAutomateRequestHandler and reach percy.upload.

Test plan

  • cd packages/webdriver-utils && yarn test — 231/231 pass (incl. 5 new specs)
  • cd packages/client && yarn test — new sendComparison labels spec passes (one pre-existing unrelated PAC-proxy test fails on Node URL message format)
  • cd packages/core && yarn test — full suite has pre-existing Chromium install failures unrelated to this change; new API spec was added following the existing /automateScreenshot test patterns
  • Manual verification: run any POA SDK with labels set and confirm tags are populated on the resulting snapshot in the Percy dashboard

🤖 Generated with Claude Code

…apshots

POA snapshots dropped any `labels` set on per-screenshot options because
WebdriverUtils.captureScreenshot only forwarded `sync`, `testCase`, and
`thTestCaseExecutionId` from options onto the returned comparisonData.
Labels never reached percy.upload → sendComparison → createSnapshot
(which converts labels to `tags` for the API), so POA tags were always
empty regardless of SDK input.

Adds the missing forward and tests at three layers:
- webdriver-utils: new unit specs for captureScreenshot covering label
  propagation, missing labels, playwright provider, and error rethrow.
- client: sendComparison spec asserting labels become `tags` on the
  snapshot POST body.
- core: /percy/automateScreenshot spec asserting labels survive the API
  handler and reach percy.upload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@prklm10 prklm10 requested a review from a team as a code owner May 25, 2026 00:46
prklm10 and others added 4 commits May 25, 2026 06:27
…n test

Drop the full-stack /automateScreenshot labels propagation spec. The
labels behavior is already covered by the focused unit specs in
webdriver-utils (captureScreenshot) and client (sendComparison).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ptureScreenshot

Branch coverage for captureScreenshot dropped to 66.67% (lines 17-18)
because every existing spec passes both `options` and `buildInfo`,
leaving the default-parameter branches untaken. Adds a spec that
calls captureScreenshot with both omitted to exercise the defaults.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…agation

# Conflicts:
#	packages/core/test/api.test.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants