Rayrun
← Back to Discord Forum

How to add delay to --update-snapshots command option?

I am trying to find a way to make the --update-snapshots flag wait for a few seconds before taking the snapshots since I have certain elements on my pages that take a few seconds to appear. The comparison spec seems to be slightly slower and the reference snapshots that I get from the aforementioned flag end up having missing elements, that I'd rather not omit from the tests. Has anyone tackled this problem and how did you solve it?

This thread is trying to answer question "How to add delay to --update-snapshots command option?"

5 replies

How to add delay to --update-snapshots command option?

Add assertions or waits for those elements to make sure they rendered before .toHaveScreenshot assertion

Any other artificial wait will be just flaky and an anti-pattern

waitForLoadState('networkidle')

I'm using this one and it works perfectly

Thank you all; I think this helps 🙂

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.