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: run-all-specs opens in new tab rather than new browser #25074

Merged
merged 5 commits into from Dec 12, 2022

Conversation

ZachJW34
Copy link
Contributor

@ZachJW34 ZachJW34 commented Dec 8, 2022

User facing changelog

Run All Specs will open in a new tab rather than close and reopen the browser

Additional details

Following the same run.ts logic for retaining the browser and switching out the tab with a fresh one.

Steps to test

Choose a project that has Cypress setup and add e2e.experimentalRunAllSpecs = true to the config. Check out this branch, run yarn and the yarn cypress:open. Open up a browser and verify that, after clicking "Run all specs", the browser isn't closed and the current tab is replaced with a new one.

Electron still spawns a new window since there is no "New Tab" in Electron.

Not sure the best way to test this change, since any tests around launchProject require opening and closing browsers.

How has the user experience changed?

Screen.Recording.2022-12-08.at.11.58.07.AM.mov

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 8, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Dec 8, 2022



Test summary

25005 0 2489 0Flakiness 21


Run details

Project cypress
Status Passed
Commit ccaad05
Started Dec 8, 2022 10:40 PM
Ended Dec 8, 2022 10:57 PM
Duration 17:08 💡
OS Linux Debian -
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/e2e/origin/cookie_behavior.cy.ts Flakiness
1 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
2 ... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
3 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
4 ... > same site / cross origin > fetch > sets same-site cookies if "include" credentials option is specified from request, but does not attach same-site cookies to request by default (same-origin)
5 ... > same site / cross origin > XMLHttpRequest > sets cookie on same-site request if withCredentials is true, and attaches to same-site request if withCredentials is true
This comment includes only the first 5 flaky tests. See all 21 flaky tests in the 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

@@ -1255,7 +1255,7 @@ type Mutation {
internal_clearProjectPreferencesCache(projectTitle: String!): Boolean

"""Launches project from open_project global singleton"""
launchOpenProject(specPath: String): CurrentProject
launchOpenProject(shouldLaunchNewTab: Boolean, specPath: String): CurrentProject
Copy link
Contributor

Choose a reason for hiding this comment

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

Something is strange here - the order of the arguments is the opposite on the client mutation? https://github.com/cypress-io/cypress/pull/25074/files#diff-4efefe4d3a02c250b8acd5d08fb87caf32cf883ccff71ea7965d0e6c0448fe68R25

Also, I think it makes sense for the specPath to be first arg, and shouldLaunchNewTab to be second - it follows the usual convention of putting the options as the second argument.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am surprised this works at all - GraphQL should be erroring, the types don't match.

Copy link
Contributor Author

@ZachJW34 ZachJW34 Dec 8, 2022

Choose a reason for hiding this comment

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

I think this is just sorted alphabetically (this is generated). Look at:

cloudProjectCreate(campaign: String, ciProviders: [String!], cohort: String, medium: String, name: String!, orgId: ID!, public: Boolean!, source: String): CloudProject

Order doesn't matter since all the args resolve to an args object.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I see. I didn't realize that (and it's quite confusing - the order generally DOES matter in GraphQL, I guess not if you are using Nexus).

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

I tested it out, works great. Curious about the order of the GraphQL mutation arguments, though.

@@ -1255,7 +1255,7 @@ type Mutation {
internal_clearProjectPreferencesCache(projectTitle: String!): Boolean

"""Launches project from open_project global singleton"""
launchOpenProject(specPath: String): CurrentProject
launchOpenProject(shouldLaunchNewTab: Boolean, specPath: String): CurrentProject
Copy link
Contributor

Choose a reason for hiding this comment

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

I am surprised this works at all - GraphQL should be erroring, the types don't match.

@@ -1255,7 +1255,7 @@ type Mutation {
internal_clearProjectPreferencesCache(projectTitle: String!): Boolean

"""Launches project from open_project global singleton"""
launchOpenProject(specPath: String): CurrentProject
launchOpenProject(shouldLaunchNewTab: Boolean, specPath: String): CurrentProject
Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I see. I didn't realize that (and it's quite confusing - the order generally DOES matter in GraphQL, I guess not if you are using Nexus).

Copy link
Contributor

@rockindahizzy rockindahizzy left a comment

Choose a reason for hiding this comment

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

LGTM

@lmiller1990
Copy link
Contributor

lmiller1990 commented Dec 10, 2022

Oh, one last thing we should check @ZachJW34 - are videos getting recorded correctly? How does this manifest in Cypress Cloud?

Edit: actually doesn't matter for Cloud, this is open mode only - still relevant locally though, since you can record videos locally (although not as common/useful, worth knowing if/how this works).

Copy link
Contributor

@astone123 astone123 left a comment

Choose a reason for hiding this comment

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

I tested this and it works well 👍🏻

@ZachJW34
Copy link
Contributor Author

@lmiller1990 you cannot record videos when in open mode. Since this feature is only related to open-mode, this should have no affect on video recording.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 13, 2022

Released in 12.1.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 13, 2022
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.

experimentalRunAllSpecs: Replace with new tab when selecting specs rather than closing browser
5 participants