Pytorch-NLU icon indicating copy to clipboard operation
Pytorch-NLU copied to clipboard

Screenshot cache with previous test?

Open bendanye opened this issue 4 years ago • 7 comments

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

bendanye avatar Nov 18 '20 08:11 bendanye

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 avatar Nov 18 '20 08:11 benjamingr

I think it would make sense to warn here though?

benjamingr avatar Nov 18 '20 08:11 benjamingr

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?

bendanye avatar Nov 18 '20 08:11 bendanye

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

Bnaya avatar Nov 18 '20 08:11 Bnaya

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

Bnaya avatar Nov 18 '20 09:11 Bnaya

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

benjamingr avatar Nov 18 '20 10:11 benjamingr

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

Thanks for the suggestion, it works!

bendanye avatar Nov 18 '20 12:11 bendanye