Skip to content
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

Question - test:after:run event #61

Closed
GabRog opened this issue Feb 9, 2021 · 7 comments · Fixed by #63 or #66
Closed

Question - test:after:run event #61

GabRog opened this issue Feb 9, 2021 · 7 comments · Fixed by #63 or #66
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@GabRog
Copy link

GabRog commented Feb 9, 2021

I am adding context to display screenshots and videos from failed test.

Cypress.on('test:after:run', (test, runnable) => {
  if (test.state === 'failed') {
    addContext({ test }, `screenshots/${Cypress.spec.name}/${runnable.parent.title} -- ${test.title} (failed).png``);
    addContext({ test },  `videos/${Cypress.spec.name}.mp4`);
  }
});

However when cypress-fast-fail plugin is enabled, adding context is not executed at all.
Could you tell me what am I doing wrong or provide some workaround for this issue?

@javierbrea javierbrea added the stage: needs investigating Someone needs to look at this label Feb 9, 2021
@javierbrea javierbrea added this to To do in Open source issues via automation Feb 9, 2021
@javierbrea javierbrea moved this from To do to Triage in Open source issues Feb 9, 2021
@javierbrea
Copy link
Owner

Hi @GabRog,

I will investigate it to fix it or provide a workaround as soon as possible.

Thanks for your feedback! 🙂

@javierbrea javierbrea moved this from Triage to To do in Open source issues Feb 9, 2021
@jmtimko5
Copy link

I saw this issue as well, thanks for investigating @javierbrea

@javierbrea javierbrea self-assigned this Feb 21, 2021
@javierbrea javierbrea moved this from To do to In progress in Open source issues Feb 21, 2021
@javierbrea javierbrea added enhancement New feature or request and removed stage: needs investigating Someone needs to look at this labels Feb 21, 2021
javierbrea added a commit that referenced this issue Feb 21, 2021
…d_skip flag parallely, so test:after:run event is executed
javierbrea added a commit that referenced this issue Feb 21, 2021
@javierbrea javierbrea added this to the v2.1.0 milestone Feb 21, 2021
@javierbrea javierbrea moved this from In progress to Ready for release in Open source issues Feb 21, 2021
This was referenced Feb 21, 2021
Open source issues automation moved this from Ready for release to Done Feb 21, 2021
@javierbrea
Copy link
Owner

Hi @GabRog and @jmtimko5,
A solution has been added and published in release v2.1.0. Thanks again for your feedback!

@javierbrea
Copy link
Owner

I'm sorry, but the provided solution seems to not be working fine. E2E tests were added and seemed to be working properly, but I have just realized that are unstable. I will revert the change to make the plugin stable again, and reopen this issue until a better solution is found.

@javierbrea javierbrea reopened this Feb 21, 2021
Open source issues automation moved this from Done to In progress Feb 21, 2021
@javierbrea javierbrea modified the milestones: v2.1.0, v2.2.0 Feb 21, 2021
Open source issues automation moved this from In progress to Done Feb 21, 2021
@javierbrea
Copy link
Owner

Finally resolved in release v2.2.0.

@GabRog
Copy link
Author

GabRog commented Feb 23, 2021

I have still problem with screenshots.
When I comment line where screenshot are added:

Cypress.on('test:after:run', (test, runnable) => {
  if (test.state === 'failed') {
    // addContext({ test }, `screenshots/${Cypress.spec.name}/${runnable.parent.title} -- ${test.title} (failed).png``);
    addContext({ test },  `videos/${Cypress.spec.name}.mp4`);
  }
});

I have in my report video attached.

When this line is uncommented, video nor screenshots are added to report.
I tried also with screenshots only - they don't appear in report.
Can you check if this can be caused by your latest changes?

@javierbrea
Copy link
Owner

Hi @GabRog , I don't think that the plugin may be related now. I added screenshots also while developing the E2E tests and it worked properly (finally I replaced it by adding a simple text just for performance improvement, but the screenshots were working too).

It seems to be a problem just in the line where you are adding the screenshots as context. Have you noticed that you have a double ` character closing the string, for example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

3 participants