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

feat: Passing --browser flag alone will launch after test selection #28538

Merged
merged 115 commits into from
Aug 27, 2024

Conversation

raygdev
Copy link
Contributor

@raygdev raygdev commented Dec 16, 2023

Additional details

  • This was a feature request made in the issue listed above
  • When the --browser flag is passed alone, after selecting the testing type, the selected browser will automatically launch.
  • I used the localSettings field in the OpenBrowser query to check if the browser was set in the cli. That query was passed as a prop to OpenBrowserList and used on mount and emits the already defined launch function if the browser was set.

Steps to test

In development yarn cypress:open --browser <browser-name-or-path>. Select your testing type in the GUI. After testing type selection, the browser specified will automatically launch. Clicking switch testing type will navigate back to select another testing type. When a new type is selected the user will have to select the browser from the UI. If an invalid browser name or path is passed, the cached browser will not launch and the error will show as intended. The user will either have to select from the list of available browsers or relaunch from the cli.

How has the user experience changed?

Previously, when a user only passed the --browser flag, they would still be prompted to select the browser and click the Start testing in <browser-name> button to open the browser. The only other option was to pass a testing type flag and browser flag together to automatically launch.

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Dec 16, 2023

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@raygdev raygdev changed the title feat: passing --browser flag alone will launch after test selection feat: Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. Dec 16, 2023
@raygdev raygdev changed the title feat: Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. Dec 16, 2023
@raygdev raygdev changed the title Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. feat: Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. Addresses [#22003](https://github.com/cypress-io/cypress/issues/22003). Dec 16, 2023
@raygdev raygdev changed the title feat: Passing --browser flag alone will launch after test selection in the GUI, the browser will automatically launch. Addresses [#22003](https://github.com/cypress-io/cypress/issues/22003). feat: Passing --browser flag alone will launch after test selection Dec 16, 2023
cli/CHANGELOG.md Outdated Show resolved Hide resolved
@raygdev
Copy link
Contributor Author

raygdev commented Dec 18, 2023

Currently the way the code is, when running the command yarn cypress:open --browser chrome it launches as intended. Let's say we provide a browser that isn't on the list like yarn cypress:open --browser something. The warning shows as intended, however... the last cached browser still launches even though a warning, about the browser passed not being found, is displayed. I'm wondering what the outcome should be for this. Should we still allow launch of the cached browser for convenience, and let the user dismiss the warning? Or do we want to negate launching altogether if an incorrect or unsupported browser is passed?

@marktnoonan
Copy link
Contributor

Currently the way the code is, when running the command yarn cypress:open --browser chrome it launches as intended. Let's say we provide a browser that isn't on the list like yarn cypress:open --browser something. The warning shows as intended, however... the last cached browser still launches even though a warning, about the browser passed not being found, is displayed. I'm wondering what the outcome should be for this. Should we still allow launch of the cached browser for convenience, and let the user dismiss the warning? Or do we want to negate launching altogether if an incorrect or unsupported browser is passed?

My suggestion is that if we couldn't find the browser that was passed, we should not open any browser and let you see the warning, then you'd have to either relaunch passing in a different browser name, or pick the browser you want from the list.

@raygdev
Copy link
Contributor Author

raygdev commented Aug 8, 2024

@marktnoonan that was exactly how I was trying to assert... but it kept failing. I wasn't sure if it was an actual bug or my misunderstanding! I would have battled for a little while to find that. Thank you for looking into it. Those changes have been made.

cli/CHANGELOG.md Outdated Show resolved Hide resolved
@jennifer-shehane
Copy link
Member

@raygdev Trying to get this in for today's release. If the tests seem to be passing - we'll get it in. PLEASE do not merge in develop. We'll handle keeping the branch up to date.

@raygdev
Copy link
Contributor Author

raygdev commented Aug 27, 2024

@jennifer-shehane sounds good! Thank you for your help! Sorry it took me a while to flesh all of it out.

Should I update the cypress documentation for this as well? I haven't done it yet.

@jennifer-shehane
Copy link
Member

@raygdev You could open a PR against this branch: cypress-io/cypress-documentation#5898 We could also update it later, so it's not a big deal if it doesn't make it into that branch in time.

@jennifer-shehane jennifer-shehane removed the request for review from mschile August 27, 2024 13:50
@jennifer-shehane jennifer-shehane merged commit efe577a into cypress-io:develop Aug 27, 2024
67 of 68 checks passed
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 27, 2024

Released in 13.14.0.

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

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Aug 27, 2024
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 27, 2024
@raygdev raygdev deleted the issue-22003 branch August 27, 2024 19:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
10 participants