-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screenshot naming on test failure #27665
Comments
i met the question too, a scene is the test name is too long, greater than 256 words ,the opertation system cut the string,can give me some suggestion solve this,ths |
I met the similar issue that the screenshot name seems unpredictable. And after test for days, seems the {adjustedSpecPath} === Cypress.spec.relative - screenshotsFolder(the folder levels). Did not have real evidence, I mean something from the code. It might just be a coincidence. But this workaround seems solve our problem. |
Hi @jennifer-shehane, |
Hi @jennifer-shehane , there is a way to configure the default name of the screenshot (not using the cy.screenshot() command). We are runnin in our CI (gitlab): In the after:screeshot API the name of the screenshot is a concatenation of the description of the keyword (describe, context, it) if the length of the concatenation is more then 255 chars it will be truncated. For what i understand in this API is not possible use the test informations, i am wrong? I need to manupulate the screenshot file name to be accessible in a local report (not cypress cloud) Do you have some suggestion? For the moment i ask to manage this 'problem' to not exceeding the chars, taken in consideration the whole concatenation. Thank you in advance. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
Still relevant today. |
Current behavior
Hello,
The documentation says:
Cf https://docs.cypress.io/api/commands/screenshot#Naming-conventions
However, it seams it is not always the case. For example, when an error occurs in a before/after(each) hook, a screenshot can be named:
cypress\screenshots\commerce-segment-creation.e2e.cy.ts\Should create commerce segment -- after all hook CheckEmptiedStubRequests (failed).png
As you can see, the screenshot name includes the function that failed (
CheckEmptiedStubRequests
). It makes them unpredictable and impossible to attach in the report as test context (cfaddContext
of mochawesome).Desired behavior
The screenshot naming should be predictable.
The best would be having an option to customize the pattern, or at least make it possible to name them with the test UUID, e.g.
{screenshotsFolder}/be7dae96-573b-420f-bc59-2ec273dd4396 (failed).png
. AFAIK, hooks also have a UUID.Test code to reproduce
Cypress Version
12.17.2
Node version
16.14.0
Operating System
Windows 10 Enterprise 22H2
Debug Logs
No response
Other
Thank you
The text was updated successfully, but these errors were encountered: