fix(e2e-cypress): make --headless work with --browser chrome #5108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information:
When running vue-cli-service test:e2e,w e currently use the -headless flag to distinguish wether to run
cypress run
(headless) orcypress open
(interactive mode). Therefore, we remove the--headless
flag from the args before passing them on to cypress: we expectcypress run
to run headless anyway by default.Since then, Cypress.io added the possibility to have
cypress run
execute with a Chrome window open, but not in interactive mode likecypress open
.So now when you run
cypress run --browser chrome
(b< callingvue-ci-service test:e2e --browser chrome
) the tests run automatically, but not headless anymore. To make cypress run chrome truly headless, we have to pass the --headless flag explictily.This PR allows for that but at the same time, it prevents users from running with an open chrome window (except in interactive mode of course).
It think this makes sense as a fix for now nontheless, as it ensures that people running
--headless
get that behaviour wether or not they have defined--browser chrome
.But for the next major version, we should consider changing this plugin's cli API to allow to get all posible cypress behaviours.