Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Screenshot cache with previous test? #88

Open
bendanye opened this issue Nov 18, 2020 · 7 comments
Open

Screenshot cache with previous test? #88

bendanye opened this issue Nov 18, 2020 · 7 comments

Comments

@bendanye
Copy link

Hi there,

I am using the jest-puppeteer example shown in integration-examples/another-jest-and-puppeteer/example.test.js and I been noticing that the first screenshot of every tests are based on last screen of the previous tests that are being run.

Attached the code and the root cause run result.

example.test.zip

.root-cause.zip

@benjamingr
Copy link
Contributor

Screenshots are taken before a step is run - so if your browser is in another page before you navigate - it will show "wherever the browser was before navigation started" basically :]

@benjamingr
Copy link
Contributor

I think it would make sense to warn here though?

@bendanye
Copy link
Author

I think it would make sense to warn here though?

or is there a way to reset the page. my thinking is better to show a white screen then the previous test's last screen?

@Bnaya
Copy link
Contributor

Bnaya commented Nov 18, 2020

jest-puppeteer has a resetPage method for such use cases
https://github.com/smooth-code/jest-puppeteer#globaljestpuppeteerresetpage

@Bnaya
Copy link
Contributor

Bnaya commented Nov 18, 2020

Also i think that showing the screenshot is actually good thing to do,
It does exactly what it should do, showing the developer the state of the page, reminding him that he is not starting from a clean slate

@benjamingr
Copy link
Contributor

It does exactly what it should do, showing the developer the state of the page, reminding him that he is not starting from a clean slate

Yeah, I agree it's correct but we can show a (helpful) warning so the developer knows how they got there

@bendanye
Copy link
Author

jest-puppeteer has a resetPage method for such use cases
https://github.com/smooth-code/jest-puppeteer#globaljestpuppeteerresetpage

Thanks for the suggestion, it works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants