Skip to content

test(regression): 100% E2E coverage for CLI configs (PER-8250)#2312

Draft
AkashBrowserStack wants to merge 5 commits into
masterfrom
PER-8250_cli-config-e2e-coverage
Draft

test(regression): 100% E2E coverage for CLI configs (PER-8250)#2312
AkashBrowserStack wants to merge 5 commits into
masterfrom
PER-8250_cli-config-e2e-coverage

Conversation

@AkashBrowserStack

@AkashBrowserStack AkashBrowserStack commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds 100% E2E coverage for the percy snapshot CLI config surface
(PER-8250). The existing
test/regression/ harness covered only a subset of asset-discovery options;
this extends it to every non-excluded option across the percy, snapshot,
discovery, and project namespaces plus the cli-snapshot static/sitemap
and per-snapshot capture options.

Three complementary tracks (full per-option matrix in
test/regression/COVERAGE.md):

  • Config validation (config-validation.test.js) — token-free
    percy snapshot --dry-run that loads fixtures setting every option and
    asserts the CLI accepts them all (no Invalid config:). This is the
    literal-100% backbone and gates every PR (including forks) without a token.
    Includes a negative self-test proving the validator actually fires.
  • Visual (regression.test.js, new pages/config-*.html) — render-affecting
    options reviewed as visual diffs: scope/scopeOptions, per-snapshot percyCSS
    override, execute + additionalSnapshots, domTransformation,
    discovery.scrollToBottom, disableShadowDOM, forceShadowAsLightDOM,
    responsiveSnapshotCapture.
  • Functional (functional.test.js, gated server.js routes) — discovery
    options asserted on what the test servers observed (robust to log-format
    changes): requestHeaders, authorization, cookies, userAgent, captureSrcset,
    disallowedHostnames.

CI: the regression job in test.yml now runs config validation token-free
always, plus visual + functional with PERCY_REGRESSION_TOKEN.

Scope

onlyAutomate snapshot options (fullPage, freezeAnimation,
freezeAnimatedImage, freezeAnimatedImageOptions, ignoreRegions,
considerRegions) are out of scope — unreachable via the percy snapshot
web flow; they belong to the SDK/Automate path. Test-only changes; no
production code touched.

Test plan

  • yarn test:regression:config — passes locally, token-free (12 assertions
    incl. negative self-test; 25 + 8 snapshots enumerated, no Invalid config:)
  • Gated server routes verified token-free (headers/auth/cookies/UA/srcset
    recorded; auth route 401s without creds)
  • eslint test/regression/ clean
  • Visual track — verified by CI regression job (Percy dashboard review)
  • Functional track — verified by CI regression job (PERCY_REGRESSION_TOKEN)

Draft until CI confirms the two token-gated tracks and the visual build is
reviewed in the Percy dashboard.


🤖 Generated with Claude Code

Covers every non-excluded CLI config option (percy/snapshot/discovery/
project + cli-snapshot static/sitemap + per-snapshot capture options) via
`percy snapshot --dry-run`, asserting the CLI loads & validates each with no
"Invalid config:" output. Runs token-free and discovery-free, so it can gate
every PR in CI. Includes a negative self-test fixture proving the validator
detector fires.

PER-8250
…s (Track V)

New pages + snapshots.yml entries exercise scope/scopeOptions, per-snapshot
percyCSS override, execute + additionalSnapshots, domTransformation,
discovery.scrollToBottom, disableShadowDOM, forceShadowAsLightDOM, and
responsiveSnapshotCapture. Visual diffs are reviewed via Percy's dashboard on
token-gated runs; the suite skips cleanly without PERCY_TOKEN. Bumped Track C
expected snapshot count 16 -> 25 to match.

PER-8250
Adds gated server routes that record the headers/auth/cookies/user-agent
Percy sends during discovery plus a cross-origin disallowed-hostname probe.
functional.test.js runs one real snapshot and asserts on those server
observations (robust to log-format changes) for discovery.requestHeaders,
authorization, cookies, userAgent, captureSrcset and disallowedHostnames.
Token-gated; skips cleanly without PERCY_TOKEN. Server-route behavior is
verified token-free; the end-to-end Percy assertions run when a token is set.

PER-8250
…cks in CI

Adds COVERAGE.md (per-option E2E coverage matrix with explicit onlyAutomate
exclusions), rewrites the regression README around the three tracks, and adds
config-validation (token-free) + functional (token-gated) steps to the
regression job in test.yml.

PER-8250
Comment on lines +10 to +15
const child = spawn('npx', ['percy', ...args], {
env: { ...process.env, ...env },
cwd,
stdio: ['ignore', 'pipe', 'pipe'],
shell: true
});
Comment thread test/regression/pages/functional-discovery.html Fixed
- lib/percy-cli.js: justify spawn shell:true with a nosemgrep comment (static,
  test-controlled args — no injection surface; mirrors regression.test.js).
- functional-discovery.html: load the cross-origin disallowed-host probe via
  @import instead of a <link> so it needs no Subresource Integrity hash
  (meaningless for a dynamic localhost test resource); discovery still attempts
  the request.

PER-8250
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.

2 participants