Skip to content

feat: PER-7348 add waitForReady() call before serialize()#426

Draft
Shivanshu-07 wants to merge 1 commit intomasterfrom
PER-7348-readiness-in-serialize
Draft

feat: PER-7348 add waitForReady() call before serialize()#426
Shivanshu-07 wants to merge 1 commit intomasterfrom
PER-7348-readiness-in-serialize

Conversation

@Shivanshu-07
Copy link
Copy Markdown

Summary

Adopts the readiness gate from percy/cli#2184 (PER-7348). New WaitForReady(driver, options) internal helper runs PercyDOM.waitForReady via ExecuteAsyncScript (callback signal) before the existing serialize ExecuteScript inside getSerializedDom. Diagnostics are attached to the snapshot as readiness_diagnostics. Serialize is unchanged.

Contract

  • Config precedence: options["readiness"]cliConfig.snapshot.readiness → empty (CLI balanced default)
  • Backward compat: in-browser typeof PercyDOM.waitForReady === 'function' guard
  • Disabled preset short-circuits
  • Graceful: rejection/exception logged at debug; serialize still runs

Tests

Two [Fact] tests in UnitTests:

  • PostsSnapshotWithReadinessEnabledreadiness: { preset: "balanced" } → snapshot posts
  • PostsSnapshotWithReadinessDisabledreadiness: { preset: "disabled" } → snapshot posts

Test results

Check Status Notes
Build (dotnet build Percy/Percy.csproj) pass, 0 errors Only pre-existing warnings
Unit tests (dotnet test) ⚠️ not executed locally Test project targets net10.0 (pre-existing, unrelated to this PR); this machine has .NET 9. Reviewer to run with .NET 10 SDK
Smoke test ⚠️ skipped: toolchain missing

Related

Adds the readiness gate from percy/cli#2184. New WaitForReady() internal
helper runs PercyDOM.waitForReady via ExecuteAsyncScript (callback
signal) BEFORE the existing PercyDOM.serialize ExecuteScript inside
getSerializedDom. Diagnostics are attached to domSnapshot as
readiness_diagnostics. Serialize is unchanged.

Config precedence: options["readiness"] > cliConfig.snapshot.readiness >
empty (CLI applies balanced default). Backward compat via in-browser
typeof guard. Disabled preset short-circuits. Graceful on any exception.

Tests: two integration-style Facts exercise readiness-enabled and
readiness-disabled paths via the public Snapshot API.
dotnet build Percy/Percy.csproj → 0 errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions Bot added the 🍞 stale Closed due to inactivity label May 5, 2026
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.

1 participant