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

fix rerun before/after hooks on top navigation #7035

Merged
merged 8 commits into from
Apr 23, 2020

Conversation

kuceb
Copy link
Contributor

@kuceb kuceb commented Apr 16, 2020

User facing changelog

  • Bug fix: We no longer rerun before/after hooks of already ran suites on domain navigation

Additional details

How has the user experience changed?

PR Tasks

  • rename duplicate issue number
  • add testcase for navigation inside suite
  • this introduced another bug due to other broken behavior in cypress related to global hooks, so this currently skips global after hooks after navigation - add small exclusion for this edge case
  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 16, 2020

Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.

  • Please write [WIP] in the title of your Pull Request if your PR is not ready for review - someone will review your PR as soon as the [WIP] is removed.
  • Please familiarize yourself with the PR Review Checklist and feel free to make updates on your PR based on these guidelines.

PR Review Checklist

If any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'.

User Experience

  • The feature/bugfix is self-documenting from within the product.
  • The change provides the end user with a way to fix their problem (no dead ends).

Functionality

  • The code works and performs its intended function with the correct logic.
  • Performance has been factored in (for example, the code cleans up after itself to not cause memory leaks).
  • The code guards against edge cases and invalid input and has tests to cover it.

Maintainability

  • The code is readable (too many nested 'if's are a bad sign).
  • Names used for variables, methods, etc, clearly describe their function.
  • The code is easy to understood and there are relevant comments explaining.
  • New algorithms are documented in the code with link(s) to external docs (flowcharts, w3c, chrome, firefox).
  • There are comments containing link(s) to the addressed issue (in tests and code).

Quality

  • The change does not reimplement code.
  • There's not a module from the ecosystem that should be used instead.
  • There is no redundant or duplicate code.
  • There are no irrelevant comments left in the code.
  • Tests are testing the code’s intended functionality in the best way possible.

Internal

  • The original issue has been tagged with a release in ZenHub.

@kuceb kuceb requested a review from jennifer-shehane April 16, 2020 14:12
@cypress
Copy link

cypress bot commented Apr 16, 2020



Test summary

7185 0 98 0


Run details

Project cypress
Status Passed
Commit f10a042
Started Apr 23, 2020 9:18 AM
Ended Apr 23, 2020 9:24 AM
Duration 06:00 💡
OS Linux Debian - 10.1
Browser Multiple

View run in Cypress Dashboard ➡️


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

@kuceb kuceb mentioned this pull request Apr 16, 2020
15 tasks
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does address the issue of before hooks running multiple times when navigating to a different cross-domain across separate tests. (I actually wasn't able to replicate this happening with after hooks before this fix).

This does not address #2777 which is the before hook running twice when there is no baseUrl, so it navigates to our localhost:randomport - runs before hook, then redirects to the url under cy.visit() and runs the before hook again. Not sure if that is important for you to address to move forward with your other work.

packages/driver/src/cypress/runner.js Outdated Show resolved Hide resolved
packages/driver/src/cypress/runner.js Outdated Show resolved Hide resolved
packages/server/test/e2e/3_issue_1987.ts Show resolved Hide resolved
@kuceb kuceb changed the title fix rerun before/after hooks on top navigation WIP: fix rerun before/after hooks on top navigation Apr 20, 2020
@kuceb kuceb changed the title WIP: fix rerun before/after hooks on top navigation fix rerun before/after hooks on top navigation Apr 20, 2020
@kuceb kuceb force-pushed the fix-rerun-hooks-on-navigation branch from 1bc41ff to 16e963b Compare April 20, 2020 18:03
@kuceb kuceb requested a review from jennifer-shehane April 20, 2020 18:06
@kuceb kuceb force-pushed the fix-rerun-hooks-on-navigation branch from 16e963b to 6ce2903 Compare April 20, 2020 18:07
packages/driver/src/cypress/runner.js Outdated Show resolved Hide resolved
packages/driver/src/cypress/runner.js Outdated Show resolved Hide resolved
@kuceb kuceb requested a review from brian-mann April 22, 2020 01:14
@kuceb
Copy link
Contributor Author

kuceb commented Apr 23, 2020

Well, I clicked the update branch button and it looks like it merged it instead

@chrisbreiding
Copy link
Contributor

Does this also fix #3904?

@jennifer-shehane
Copy link
Member

New PR to follow is here: #7154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants