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

feat: Add after:spec event #14178

Merged
merged 20 commits into from Dec 18, 2020
Merged

feat: Add after:spec event #14178

merged 20 commits into from Dec 18, 2020

Conversation

chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Dec 14, 2020

User facing changelog

  • You can now listen to a after:spec event in the plugins file. See the documentation for more information (TODO: link to doc).

Additional details

  • The event fires after a spec is run, but before the video for the spec is processed.
  • It only fires in run mode.
  • The event handler receives two arguments, an object with different versions of the spec file/path, and the results of the spec.
on('after:spec', (spec, results) => {
  // spec:
  //  {
  //    name: 'login_spec.js',
  //    relative: 'cypress/integration/login_spec.js',
  //    absolute: '/Users/janelane/app/cypress/integration/login_spec.js',
  //  }

  // results:
  // {
  //   stats: {
  //     suites: 0,
  //     tests: 1,
  //     passes: 1,
  //     pending: 0,
  //     skipped: 0,
  //     failures: 0,
  //     // ...more properties
  //   }
  //   reporter: 'spec',
  //   tests: [
  //     {
  //       title: ['login', 'logs user in'],
  //       state: 'passed',
  //       body: 'function () {}',
  //       // ...more properties...
  //     }
  //   ],
  //   error: null,
  //   video: '/Users/janelane/app/cypress/videos/login_spec.js.mp4',
  //   screenshots: [],
  //   // ...more properties...
  // }
})

PR Tasks

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 14, 2020

Thanks for taking the time to open a PR!

@chrisbreiding chrisbreiding changed the title refactor before:browser:launch handling into own file feat: refactor before:browser:launch handling into own file Dec 14, 2020
@chrisbreiding chrisbreiding changed the title feat: refactor before:browser:launch handling into own file feat: Add after:spec event Dec 14, 2020
@cypress
Copy link

cypress bot commented Dec 14, 2020



Test summary

9162 0 118 3Flakiness 1


Run details

Project cypress
Status Passed
Commit be3b711
Started Dec 18, 2020 2:29 PM
Ended Dec 18, 2020 2:42 PM
Duration 12:40 💡
OS Linux Debian - 10.5
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/retries.ui.spec.js Flakiness
1 runner/cypress retries.ui.spec > opens attempt on each attempt failure for the screenshot, and closes after test passes

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

mostly for the run_spec.js test's sake, so they don't fail because they don't pass config in
@chrisbreiding chrisbreiding marked this pull request as ready for review December 16, 2020 14:36
@chrisbreiding chrisbreiding mentioned this pull request Dec 16, 2020
2 tasks
@chrisbreiding chrisbreiding changed the base branch from TR-543-before-spec-event to develop December 17, 2020 16:20
@chrisbreiding chrisbreiding merged commit c9916c8 into develop Dec 18, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 21, 2020

Released in 6.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v6.2.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 21, 2020
@chrisbreiding chrisbreiding deleted the TR-544-after-spec-event branch April 5, 2022 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants