-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feat: pass list of browsers to plugins file #5068
Conversation
Testing it locally with command
Which shows the browser detection happens first, and then the plugins file loading, so we do have this information
|
Test summaryRun details
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of the API changes, @brian-mann mentioned that we should have a method call like setBrowser
or setBrowsers
so that we could actually do some validation on what is passed in - instead of the static overriding of the object. A user could mutate it and just completely mess up the launching of Cypress browser and we want to try and avoid that situation if possible.
I think simplicity right now wins - if you mutate the other configuration values, you can screw things up, but how often users would screw the list of browsers and leave the invalid configuration? If they send an invalid browser, we could validate - just like we should validate the entire modified config object after getting it back. |
This PR also enables to run tests in Microsft Edge Beta (Chromium-based) or Brave browser by simply returning them from the plugins file module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
const pathToBrave =
'/Applications/Brave Browser.app/Contents/MacOS/Brave Browser'
config.browsers.push({
name: 'brave',
family: 'chrome',
displayName: 'Brave',
version: 'unknown',
path: pathToBrave,
majorVersion: 'unknown'
})
return config
} |
…ress-io/cypress into pass-list-of-browsers-to-config-5067
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add an e2e test that mutates
config.browsers
with an object - so that the error is handled and is snapshotted - ensure that we are validating invalid
config
after its returned from thepluginsFile
- added e2e tests
- fix nested objects such as
browsers
jumping when you click on the arrow and expands them - add in the missing
:
colon when nested objects are expanded - show
Array(len)
when arrays are expanded in the preview area of the array - think about maybe adding a "Copy" button that copies the derived final configuration object (non blocking, low priority)
- reduce the line height to match dev tools
- adjust spacing of items - distinguish between arrays and objects (via expanded arrays having the text `"Array ({length})"` after the colon
Co-Authored-By: Zach Bloomquist <[email protected]>
Co-Authored-By: Zach Bloomquist <[email protected]>
Co-Authored-By: Zach Bloomquist <[email protected]>
…ress-io/cypress into pass-list-of-browsers-to-config-5067
Passes list of detected browsers to the plugins file and lets the user modify the list.
User facing changelog
config.browsers
. The currently available browsers is also displayed within the configuration panel under Settings in the Test Runner.Additional details
Reworking browser detection and config to do the following:
cypress open
)electron
, which if the user removes from the list will cause an error--browser <name>
CLI then pick that browser from the current updated list of browsers--browser <path>
disregard the updated list and discover the browser just like we do nowHow has the user experience changed?
Example use: https://github.com/cypress-io/cypress-example-electron/blob/master/cypress/plugins/index.js
Config Before
Config After
PR Tasks
cypress-documentation
been submitted to document any user-facing changes? explain how to modify list of browsers in the plugins file cypress-documentation#2245[object], ...
for the list of browserscypress.json
but in the plugins only