Skip to content

feat(advanced): PER-8195 — advanced example for @percy/cypress#168

Draft
Shivanshu-07 wants to merge 2 commits into
masterfrom
per-8195-phase-1-cypress
Draft

feat(advanced): PER-8195 — advanced example for @percy/cypress#168
Shivanshu-07 wants to merge 2 commits into
masterfrom
per-8195-phase-1-cypress

Conversation

@Shivanshu-07
Copy link
Copy Markdown

@Shivanshu-07 Shivanshu-07 commented May 21, 2026

Summary

Adds an advanced/ example covering the full applicable @percy/cypress SDK feature surface. 14 it() blocks in cypress/e2e/todomvc_advanced.cy.js, one per matrix row: widths, percyCSS, minHeight, enableJavaScript, scope, discovery, domTransformation, responsiveSnapshotCapture, labels, testCase, devicePixelRatio, regions, readiness preset, browsers.

Issue: PER-8195.

Smoke result (local)

  • 14/14 tests pass under cypress 13 + chromium electron + percy exec --testing.
  • 19/19 covered matrix rows assert green via the shared assert-advanced-snapshots.sh helper.

Notes

  • cypress bumped to ^13.6.4 in advanced/package.json because @percy/cypress 3.1.8's optional-chaining syntax doesn't compile under cypress 10's webpack-preprocessor. Basic example stays at 10.11.0.
  • @percy/cli pinned to ^1.31.13 (bundled sdk-utils has getResponsiveWidths, needed by responsiveSnapshotCapture).
  • scope/discovery/domTransformation are Cypress-specific (iframe runner context) — see advanced/matrix.yml notes.

Open question (D8)

The advanced CI job currently curls the shared assertion helper from raw.githubusercontent.com/percy/percy-public-repos-parent/main/scripts/… — placeholder URL until D8 (npm package vs curl-from-tag vs composite action) is picked. Don't merge until that's decided.

Test plan

  • Wait for the advanced CI job to run green in --testing mode (no real PERCY_TOKEN needed).
  • Verify advanced-requests.json contains 13 /percy/snapshot POSTs + 1 /percy/widths-config GET.
  • Verify the matrix-row coverage assertion exits 0.

🤖 Generated with Claude Code

Shivanshu-07 and others added 2 commits May 20, 2026 10:52
Phase 1 stub for PER-8195 (advanced example for every Percy SDK sample
repo). matrix.yml populated from SDK API research, README placeholder
notes test code is TO BE WRITTEN.

Carries the Phase 0 pattern: per-SDK matrix.yml is the canonical
machine-readable source of truth; advanced/README.md table + the
aggregate docs/advanced-example-feature-matrix.md grid are generated
downstream.

No test code committed — needs per-SDK smoke-test validation against
the matching SDK toolchain (next step). Most rows currently 'Planned';
some 'Covered' rows reflect behavior automatic via the basic SDK usage
(cross-origin iframe handling, cookie capture, environmentInfo).

See parent: docs/plans/2026-05-19-001-feat-per-8195-advanced-sdk-examples-plan.md
…press

Adds advanced/ exercising the full applicable @percy/cypress SDK feature
surface. 14 it() blocks in cypress/e2e/todomvc_advanced.cy.js, one per
matrix row: widths, percyCSS, minHeight, enableJavaScript, scope,
discovery, domTransformation, responsiveSnapshotCapture, labels,
testCase, devicePixelRatio, regions, readiness preset, browsers.

Local smoke (cypress 13 + electron --testing mode): 14/14 tests pass;
19/19 covered matrix rows assert green via the shared
assert-advanced-snapshots.sh helper.

Cypress 13.x in advanced/ (not 10.x like basic) — @percy/cypress 3.1.8's
optional-chaining syntax doesn't compile under cypress 10's
webpack-preprocessor. Basic stays at 10.11.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment on lines +36 to +86
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: advanced
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install jq + yq
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq jq
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
- name: Install advanced/ dependencies
run: npm install
- name: Fetch shared advanced-snapshot assertion helper
# TODO(PER-8195 D8): pin to a tagged commit once percy-public-repos-parent
# publishes the scripts/ dir to a stable URL or to an npm package.
run: |
curl -fsSL -o /tmp/assert-advanced-snapshots.sh \
https://raw.githubusercontent.com/percy/percy-public-repos-parent/main/scripts/assert-advanced-snapshots.sh
chmod +x /tmp/assert-advanced-snapshots.sh
- name: Start static server (background)
run: |
npx --no-install serve -l 8000 .. &
for i in {1..30}; do
if curl -fsS http://localhost:8000 >/dev/null 2>&1; then
echo "static server ready"
exit 0
fi
sleep 1
done
echo "static server did not start in 30s" >&2
exit 1
- name: Run cypress advanced tests (--testing) + capture /test/requests
env:
PERCY_TOKEN: fake_token
run: |
npx --no-install percy exec --testing -- bash -c '
npx --no-install cypress run --config-file cypress.config.js --browser electron
ec=$?
curl -fsS http://localhost:5338/test/requests > advanced-requests.json || true
exit $ec
'
- name: Assert matrix-row coverage
env:
PERCY_REQUESTS_FILE: ${{ github.workspace }}/advanced/advanced-requests.json
run: /tmp/assert-advanced-snapshots.sh ./matrix.yml
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