Skip to content

Conversation

ZachJW34
Copy link
Contributor

User facing changelog

Allows the changing of the browser from within the runner while keeping the current spec active.

Additional details

We didn't have the functionality of routing to a spec, so I added it. Since the convention of running a spec with the app open is /runner?file={relativePathToSpec}, the server changes accommodate for this convention by flagging the new routing under process.env.LAUNCHPAD.

Screen.Recording.2021-11-22.at.1.57.08.PM.mov

I'm not sure how to test this thoroughly, since spying on mutations inside component tests don't work and writing an e2e test that targets the runner page causes all sorts of issues (another instance of Cypress causes the reporter and AUT to switch).

PR Tasks

  • Have tests been added/updated?

@ZachJW34 ZachJW34 requested a review from a team as a code owner November 22, 2021 20:06
@ZachJW34 ZachJW34 requested review from jennifer-shehane and removed request for a team November 22, 2021 20:06
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 22, 2021

Thanks for taking the time to open a PR!

@ZachJW34 ZachJW34 changed the title Switch browser runner feat: switch browser runner Nov 22, 2021
@ZachJW34 ZachJW34 requested a review from lmiller1990 November 22, 2021 20:07
@cypress
Copy link

cypress bot commented Nov 22, 2021



Test summary

18698 1 204 0Flakiness 6


Run details

Project cypress
Status Failed
Commit a6f9c11
Started Nov 24, 2021 4:34 PM
Ended Nov 24, 2021 4:47 PM
Duration 12:39 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Failures

cypress/integration/e2e/redirects_spec.js Failed
1 redirection > meta > binds to the new page after a timeout

Flakiness

net_stubbing_spec.ts Flakiness
1 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
2 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
3 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"
4 network stubbing > waiting and aliasing > should handle aborted requests
navigation_spec.js Flakiness
1 src/cy/commands/navigation > #visit > window immediately resolves and doesn't reload when visiting the same URL with hashes
This comment includes only the first 5 flaky tests. See all 6 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

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.

Few small comments

async getCurrentSpecByAbsolute (projectRoot: string, absolute: string) {
// TODO: should cache current specs so we don't need to
// call findSpecs each time we ask for the current spec.
const specs = await this.findSpecs(projectRoot, null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just use this.ctx.currentProject.specs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do!

t.liveMutation('launchOpenProject', {
description: 'Launches project from open_project global singleton',
args: {
specPath: stringArg(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this nonNull(stringArg())?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, since this mutation is used in other places that don't require routing to a specific spec.

const spec: Cypress.Spec = {
// launchProject expects a spec when opening browser for url navigation.
// We give it an empty spec if none is passed so as to land on home page
const emptySpec: Cypress.Spec = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we still need this? You could try removing it and see what happens - I don't know if this is necessary now we launch into unified (no need for a fake spec url to visit).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need this. It could be removed but it would require refactoring a chunk of server code that is outside the scope of this PR.

@jennifer-shehane jennifer-shehane removed their request for review November 23, 2021 16:27

return specs.filter((spec) => spec.specType === specType)
}
project.specs = !specType ? specs : specs.filter((spec) => spec.specType === specType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, why are we mutating project.specs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the currentProject.specs field was never being set, so they had to be set somewhere. I'll revert to just using findSpecs for the getCurrentSpecByAbsolute function. There will be some changes to how specs are managed here soon, we can tackle the inefficiencies soon

@lmiller1990 lmiller1990 self-requested a review November 24, 2021 05:52
@ZachJW34 ZachJW34 merged commit a4bec4a into 10.0-release Nov 24, 2021
@ZachJW34 ZachJW34 deleted the switch-browser-runner branch November 24, 2021 17:57
tgriesser added a commit that referenced this pull request Nov 29, 2021
* 10.0-release:
  refactor: remove @packages/desktop-gui (#19127)
  feat: switch browser runner (#19048)
  fix: bump resource class for tests that require node_modules install (#19079)
  fix(unify): reporter styles (#19034)
  fix test
  feat(unify): add number of matches to specs search (#19076)
  feat(launchpad): open in IDE modal and feature (#18975)
  fix: 10.0 appveyor updateyaml (#19074)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants