feat: PER-7348 add waitForReady() call before serialize()#134
Draft
Shivanshu-07 wants to merge 1 commit intomainfrom
Draft
feat: PER-7348 add waitForReady() call before serialize()#134Shivanshu-07 wants to merge 1 commit intomainfrom
Shivanshu-07 wants to merge 1 commit intomainfrom
Conversation
Adds the readiness gate from percy/cli#2184. A new _wait_for_ready() helper uses page.evaluate (sync Playwright auto-awaits Promises) with a typeof guard so older CLI versions that lack waitForReady are no-ops. The return value is attached to dom_snapshot['readiness_diagnostics'] so the CLI can log timing and pass/fail. serialize itself is unchanged. Config precedence: kwargs['readiness'] > healthcheck-cached percy.config.snapshot.readiness > {} (CLI applies balanced default). Disabled preset skips the evaluate call. Graceful on exception. Tests cover happy path (call order), config pass-through, disabled preset, and readiness raising. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adopts the readiness gate from percy/cli#2184 (PER-7348). New
_wait_for_ready(page, kwargs)helper runsPercyDOM.waitForReady(config)viapage.evaluate(sync Playwright auto-awaits Promises). Its return value is attached todom_snapshot['readiness_diagnostics']. ThePercyDOM.serializecall is unchanged.Contract
kwargs['readiness']→ healthcheck-cachedpercy.config.snapshot.readiness→{}(CLI appliesbalanceddefault).typeof PercyDOM.waitForReady === 'function'guard.Tests
4 new tests in
TestPercySnapshot: happy path (call order), config pass-through, disabled preset, readiness raising.Test results
python -c ast.parse)make test)Related