feat: PER-7348 add waitForReady() call before serialize()#30
Draft
Shivanshu-07 wants to merge 1 commit intomainfrom
Draft
feat: PER-7348 add waitForReady() call before serialize()#30Shivanshu-07 wants to merge 1 commit intomainfrom
Shivanshu-07 wants to merge 1 commit intomainfrom
Conversation
Adds the readiness gate from percy/cli#2184. New wait_for_ready() helper runs PercyDOM.waitForReady via driver.execute_async_script (callback signal) before the existing PercyDOM.serialize execute_script inside get_serialized_dom. The return value is attached to the domSnapshot hash as 'readiness_diagnostics'. serialize is unchanged. Config precedence: options[:readiness] (or 'readiness') > @cli_config.dig('snapshot','readiness') > {} (CLI applies balanced default). Backward compat via in-browser typeof guard. Disabled preset skips the execute_async_script. Graceful on any StandardError. Tests (RSpec): happy path (execute_async_script called with waitForReady + typeof guard, diagnostics on snapshot), per-snapshot config embedded, disabled preset skips execute_async_script, and execute_async_script raising leaves serialize intact. 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(driver, options)helper runsPercyDOM.waitForReadyviadriver.execute_async_script(callback signal) before the existingPercyDOM.serializeexecute_scriptinsideget_serialized_dom. The return value is attached to the snapshot hash as'readiness_diagnostics'. Serialize is unchanged.Contract
options[:readiness]/options['readiness']→@cli_config.dig('snapshot','readiness')→{}(CLIbalanceddefault)typeof PercyDOM.waitForReady === 'function'guardStandardError; logged at debugTests
4 new RSpec tests inside
describe '.get_serialized_dom':execute_async_scriptcalled withwaitForReady+ typeof guard; diagnostics attachedexecute_async_scriptexecute_async_scriptleaves serialize intactTest results
ruby -c)bundle exec rspec)bundle installneeds capybara ~> 3.35; not present on fan-out machineRelated