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

interactive mode is unusable if you rely on lifecycle hooks #23627

Open
cameron opened this issue Aug 30, 2022 · 1 comment
Open

interactive mode is unusable if you rely on lifecycle hooks #23627

cameron opened this issue Aug 30, 2022 · 1 comment
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: regression A bug that didn't appear until a specific Cy version release v10.0.0 🐛 Issue present since 10.0.0

Comments

@cameron
Copy link

cameron commented Aug 30, 2022

Current behavior

Lifecycle hooks (e.g., before:spec) do not run when triggering re-runs in interactive mode, which makes tests that rely on lifecycle hooks to pass unrerunnable.

A prior issue on this topic was closed without resolution: #15138

Desired behavior

Lifecycle hooks should run as implied. Treating every re-run, whether for a single spec or all, as a non-interactive run should resolve any apparent ambiguity in how to execute the events.

Test code to reproduce

Don't have a repro repo

Cypress Version

10.6.0

Node version

18.8.0

Operating System

12.5

Debug Logs

No response

Other

No response

@emilyrohrbough
Copy link
Member

@cameron Thank you for logging this issue. I agree it is a big confusing that these interactiveEvents are not triggering as one would expected.

With the latest 10.0 release, it seems experimentalInteractiveRunEvents functionally wasn't carried over. I did a quick analysis and here is what I found:

  • before:run: this event is triggered too early, i.e. before testing type is "selected" and the plugin's on events are registered. This likely trigger when the browser is launched given the user can now change "runs" within the Launchpad for a given testing type.
  • before:spec: existing issue before:spec broken? #22360 -- I just opened a PR to fix this hook specifically
  • after:spec: the documentation states this will execute when the browser is closes -- this worked in 9.x this way because each spec requires a new browser to launch. With 10.x this changed because you can change tests within a single browser instance. Some work would be required to accurately report the spec results that are outlined in the After Spec API docs
  • after:run: The After Run API docs calls out this is triggered when closing a project in open mode. With the 10x changes, it is likely this should fire when the launched browser is closed. I do want to note, the docs call out that in "open" mode the results will be undefined. The update to match the 9.x behavior should be fairly forward..though I do feel it's a bit unexpected we can't provide the same run results and to do that work would take a bit more effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: regression A bug that didn't appear until a specific Cy version release v10.0.0 🐛 Issue present since 10.0.0
Projects
None yet
Development

No branches or pull requests

3 participants