Closed plegner closed 4 years ago
Hey @plegner, thanks for the issue! What kind of page is being snapshotted here? It seems like this line is silently failing: https://github.com/percy/percy-script/blob/master/snapshot.js#L22-L24 we're relying on PercyAgent
to be available on the window object later on here: https://github.com/percy/percy-script/blob/master/snapshot.js#L39
I have a feeling the issue is a timing one: https://github.com/mathigon/textbooks/pull/181/files#diff-e50531e6b40c4b9d0853ded9c646bd0dR28-R33 looping over URLs like this (without any wait between the visit and then percySnapshot
) will result in flaky snapshots. Try adding an await -- I'm curious if this error goes away:
PercyScript.run(async (page, percySnapshot) => {
for (const p of pages) {
await page.goto(`http://localhost:5000/${p}#full`);
await page.waitFor(2000);
await percySnapshot(`${p}-en`, {widths: [1200, 374], percyCSS});
}
});
Thanks so much for investigating, @Robdel12! adding a waitFor
did not fix the error, but I played around with it some more and noticed that we had a typo when generating the list of URLs to test, so that all of them responded with a 404 error…
I'm sorry for troubling you – although it might still be useful to have more specific error messages in these cases.
When running
percy exec -- node test/snapshots.js
on MacOS, with v1.1.0 of@percy/script
, I get the following error: