-
-
Notifications
You must be signed in to change notification settings - Fork 22
Extra images for tests #300
-
I think I maybe doing something wrong, or just simply misunderstanding what is happening, but from my understanding, the #index
in the file name is to separate the different screenshots taken within a test (i.e. if there are 2 different snapshots to be taken, there will be a #0
and a #1
image). I'm also aware that it can be used for retries as well.
However, in tests where there are only 1 snapshot taken and retries are not set (default to 0
) or explicitly set to 0
, I'm still seeing other images (i.e. #1
, #2
, etc.).
Can someone please explain what scenario I'm unaware of or where my understanding is wrong?
Edit: I could be wrong in my understanding of what is happening, but isn't the logic in generateScreenshotPath
in screenshotPath.utils.ts
problematic? From what I can tell, nameCacheCounter[screenshotPath]
will be undefined
for the first run, but have a value of 0
for the next run, incrementing for each run. I can see the lastRetryNameCacheCounter
is used when a retry is triggered, but not when a new run is triggered. I'm not sure if this is a completely wrong reading of this, but considering that I am seeing that sometimes, there are test failures and the tests are automatically being re-triggered no matter what options I set, this is exacerbating the problem (or rather, not helping to deal with it). I'm not aware of how Cypress plugins work, so maybe this isn't doable, but I'd expect that on a new test run, the nameCacheCounter
to be reset.
It's worth noting that this is never an issue when running cypress run
, only with cypress open
.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments
-
Hey!
As you wrote - the #index
in the file name is needed when there are screenshots to be taken within the same it
block. In such case one image would overwrite the other as they would have the same name, which we're trying to avoid.
It might be that there is a bug in this feature or that some changes in Cypress had broken it (it has happened in the past).
Can you please report a bug with all of the needed info? (package version, OS, node version, cypress version).
Also - please add reproducible scenario if possible as this scenario might be really hard for me to reproduce
Beta Was this translation helpful? Give feedback.
All reactions
-
I know it's been nearly a year, but I've not been able to re-create it outside of our current repo, which I can't share unfortunately.
Beta Was this translation helpful? Give feedback.
All reactions
-
That fine, thanks for responding! But you know - without repro it's hard to fix the issue 😄
Do I understand it correctly that your issue is connected to the same issue and we can continue discussion there?
Beta Was this translation helpful? Give feedback.