Skip to content

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

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

feat: PER-7348 add waitForReady() call before serialize()#308
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(jse, options) helper runs PercyDOM.waitForReady via executeAsyncScript (callback signal) before the existing serialize executeScript inside getSerializedDOM. Diagnostics are attached to readiness_diagnostics on the snapshot. 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 on any exception.

Visibility

getSerializedDOM is now package-private (was private) so tests can call it directly.

Tests

3 new Mockito tests in SdkTest:

  • ✅ diagnostics attached + readiness script contains waitForReady
  • ✅ disabled preset skips executeAsyncScript
  • ✅ readiness throw leaves serialize intact

Test results

Check Status Notes
Compile ✅ pass
Unit tests (mvn test -Dtest=...) 3 passed, 0 failed
Smoke test ⚠️ skipped: toolchain missing

Related

Adds the readiness gate from percy/cli#2184. New waitForReady() helper
runs PercyDOM.waitForReady via executeAsyncScript (callback signal)
before the existing PercyDOM.serialize executeScript inside
getSerializedDOM. Diagnostics are attached to the mutable snapshot as
readiness_diagnostics. serialize is unchanged.

Config precedence: options['readiness'] > cliConfig.snapshot.readiness >
empty. Backward compat via in-browser typeof guard. Disabled preset
short-circuits. Graceful on exception.

Visibility: getSerializedDOM is now package-private so tests can call it
directly; it was previously private.

Tests (Mockito): diagnostics attached + readiness script contains
waitForReady, disabled preset skips executeAsyncScript, readiness throw
leaves serialize intact. Local: mvn test → 3 passed, 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant