cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.67k stars 3.16k forks source link

Better message when a supported browser in not found. #28914

Open asashour opened 7 months ago

asashour commented 7 months ago

What would you like?

Browser: chrome was not found on your system or is not supported by Cypress.

Should be

Browser: chrome was not found on your system.

Why is this needed?

If any of the supported browsers is not found, a specific message would be better. This is a better user experience.

If a non-supported browser is specified, e.g. abc, then Browser: abc is not supported by Cypress. is also a little better.

Other

No response

0v00 commented 7 months ago

@jennifer-shehane I think I may have a simple fix by adding an initial check if the given browser is supported in ensureAndGetByNameOrPath in packages/server/lib/browers/utils.ts, and then adding an additional error in packages/errors/src/errors.ts specifically for unsupported browsers.

Then we can simplify the BROWSER_NOT_FOUND_BY_NAME error to just print out Browser: ${fmt.highlight(browser)} was not found on your system etc as per @asashour's request

Let me know - happy to create a small PR.

jennifer-shehane commented 7 months ago

@0v00 Sounds like a plan. You'll need to update many of our snapshot tests I imagine that is testing this is printed correctly.