examples: a real third-party SPA, and the fill-timing race it exposes - #7
Merged
Merged
Conversation
The other examples are all self-contained local fixtures. This one is a real, live site over the real internet (saucedemo.com, the widely-used QA-industry practice storefront), driven by a stock puppeteer-core client, with a genuine activity afterward (add to cart), not just a login check. It also documents a real thing found by instrumenting the bridge directly: saucedemo.com is a React app that keeps mutating history for a moment after its initial load event fires. Snapshotting the live generation once, right after page.goto() resolves, is a race against that -- a Page.navigatedWithinDocument landed in exactly that window and aborted the fill with reason "navigated". The fix demonstrated here: track real navigation events and wait for them to go quiet before requesting the fill, instead of guessing a fixed count. A static page's generation is stable the instant it loads; a live SPA's is not. Ran repeatedly against the real site to confirm this isn't a lucky timing hit -- consistent pass, settling at the same generation each run.
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.
Every other example is a self-contained local fixture. This one is a real, live site over the real internet — saucedemo.com, the widely-used QA-industry practice storefront — driven by a stock
puppeteer-coreclient, with a genuine activity afterward (add to cart), not just a login check.Depends on an external site, unlike the rest — worth knowing if it ever needs updating because saucedemo.com changes its markup or goes away.
The reason it's worth having, beyond "one more site": it surfaced a real timing race that only shows up against a live single-page app. saucedemo.com is a React app that keeps mutating history (router setup,
history.replaceState) for a moment after its initial load event fires. I confirmed this by instrumenting the bridge directly — aPage.navigatedWithinDocumentlanded in the exact window between this script's generation snapshot (taken right afterpage.goto()resolved) and the fill engine's own re-check, aborting with{"status":"aborted","reason":"navigated"}.The fix demonstrated here isn't a fixed number — it tracks real
framenavigatedevents on the main frame and waits for them to go quiet before requesting the fill. A static page's generation is stable the instant it loads; a live SPA's isn't, and guessing a constant per site is fragile in a way that doesn't show up until you point this at something that isn't a plain server-rendered form.Ran it three times in a row against the real site to make sure this wasn't a lucky timing hit — consistent pass, settling at the same generation (2) every run.
pnpm typecheckis clean.