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: UNIFY-676 browsers should be configurable in setupNodeEvents #20367

Merged
merged 10 commits into from
Mar 1, 2022

Conversation

tgriesser
Copy link
Member

@tgriesser tgriesser commented Feb 25, 2022

Adds a system test to show that filtering browsers is working properly & $ExpectType assertion for dtslint to assert the correct type, @JessicaSachs' original issue

@tgriesser tgriesser requested a review from a team as a code owner February 25, 2022 17:27
@tgriesser tgriesser requested review from jennifer-shehane and removed request for a team February 25, 2022 17:27
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 25, 2022

Thanks for taking the time to open a PR!

@tgriesser tgriesser changed the base branch from develop to 10.0-release February 25, 2022 17:27
@cypress
Copy link

cypress bot commented Feb 25, 2022



Test summary

18015 0 229 0Flakiness 1


Run details

Project cypress
Status Passed
Commit da6eca1
Started Feb 28, 2022 8:47 PM
Ended Feb 28, 2022 8:59 PM
Duration 11:45 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/commands/net_stubbing.cy.ts Flakiness
1 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"

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

@jennifer-shehane jennifer-shehane requested review from tbiethman and removed request for jennifer-shehane February 25, 2022 18:30
@jennifer-shehane
Copy link
Member

@tgriesser There's a failure in the types:

lib/browsers/chrome.ts(407,66): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@tbiethman
Copy link
Contributor

We just need to interpolate the majorVersion now:

if (CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING.includes(majorVersion)) {

@tgriesser
Copy link
Member Author

I had updated the type because it seemed to be wrong but who knows, the types in the server layer are pretty tough to follow. Didn't need to address it as part of this PR.

@tgriesser tgriesser requested a review from a team February 25, 2022 20:25
tbiethman
tbiethman previously approved these changes Feb 25, 2022
elevatebart
elevatebart previously approved these changes Feb 25, 2022
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

(whoops, meant to request changes. I really wish you could delete these things)

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Doesn't work, Tim and I DM'd about it already.

image

@tgriesser tgriesser dismissed stale reviews from elevatebart and tbiethman via 2b005eb February 25, 2022 22:00
Copy link
Contributor

@elevatebart elevatebart left a comment

Choose a reason for hiding this comment

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

Would this mean that now config.browser is available in the types of setupNodeEvents()?

The value will always be null and setting it should have no effect.

How far off am I ?

@lmiller1990
Copy link
Contributor

lmiller1990 commented Feb 28, 2022

Seems fine to me, I followed https://docs.cypress.io/guides/guides/launching-browsers#Customize-available-browsers and got this:

image

I also fixed the typing errors in an effort to get this over the line: 97ba5cf

@lmiller1990 lmiller1990 self-requested a review February 28, 2022 08:19
lmiller1990
lmiller1990 previously approved these changes Feb 28, 2022
@lmiller1990
Copy link
Contributor

Alrighty I got this green, let's get one more test/approval. The types are working fine for me, too, from what I can see. I had to specify headless and isHeaded which seems weird, but fixing the types in the entirely of Cypress is a huge task.

@tgriesser tgriesser marked this pull request as draft February 28, 2022 12:45
@tgriesser
Copy link
Member Author

tgriesser commented Feb 28, 2022

Changing to draft to investigate why the $ExpectType types aren't being checked

@tgriesser tgriesser marked this pull request as ready for review February 28, 2022 20:41
@tgriesser
Copy link
Member Author

@elevatebart:

Would this mean that now config.browser is available in the types of setupNodeEvents()?

Nah, it's using a Partial so it'll be Browser | undefined

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.

Seems fine to me! I tried it as mentioned in a previous review and it worked okay, including types.

Copy link
Contributor

@elevatebart elevatebart left a comment

Choose a reason for hiding this comment

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

@tgriesser I beg to disagree, the problem is still here:
The code below seems to be valid typed configFile.

import { defineConfig } from 'cypress'

export default defineConfig({
  e2e: {
    setupNodeEvents (on, config) {
      config.browser = 'chrome'
    },
  },
})

What I am saying is that the types are not correct since they contain more than the actual object. Instead of helping the types we have here could confuse users.
I prefer that we do not fix it in this PR though.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 1, 2022

@elevatebart I think what Tim means is since it's a Partial everything is going to be nullable, which seems fine - users will basically need to assume any of the properties they are accessing are nullable and do the required defensive checks.

I agree the idea would be the exact types (no nullable) but like you said we cannot do this right now, it's pretty complex and outside the scope of this PR.

Edit: looks like we are on the same page, you've approved too - definitely good to improve the types more in the future.

@lmiller1990 lmiller1990 merged commit 58ccda5 into 10.0-release Mar 1, 2022
@lmiller1990 lmiller1990 deleted the tgriesser/fix/UNIFY-676 branch March 1, 2022 07:54
tgriesser added a commit that referenced this pull request Mar 2, 2022
* 10.0-release:
  fix: comment link to accurate docs (#20437)
  fix: scaffold commands file (#20398)
  fix(launchpad): support default export (#20383)
  feat(launchpad): support for Vue CLI 5 (#20413)
  fix: UNIFY-676 browsers should be configurable in setupNodeEvents (#20367)
  fix: make launchpad link open default browser (#20399)
  fix(icons): publish the files in the package
  fix: build icons in build-prod (#20411)
  test: migrate module-api to 10.0
  chore: build this branch
  test: migrate module_api to system tests (#20265)
  chore: remove pkg/driver //@ts-nocheck final (#20169)
  chore: fix "cannot find module" in clone-repo-and-checkout-release-branch (#20293)
  chore: Update Chrome (beta) to 99.0.4844.45 (#20234)
  chore: fix CI cache state for darwin (#20339)
  Add TODO comments
  feedback
  chore: move tests to its own file.
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.

6 participants