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

[@vue/cli-plugin-e2e-cypress] Option to NOT start development server without overriding baseUrl with --url #5341

Open
ajewers opened this issue Mar 31, 2020 · 2 comments

Comments

@ajewers
Copy link

ajewers commented Mar 31, 2020

What problem does this feature solve?

When using vue-cli-service test:e2e a development server is started and the cypress config value baseUrl is overridden with the address of the development server. Passing the --url argument will stop the development server from starting, but still overrides the baseUrl config value.

It would be useful to be able to pass an option to NOT start the development server, but leave the baseUrl config value unchanged. The option could be --remote or similar.

The desired end user experience is this:

  • Maintainer sets test:e2e script in package.json to read vue-cli-service test:e2e --remote
  • User sets desired target server URL in cypress.json config file
  • User runs npm run test:e2e with no need for additional parameters
  • Cypress starts WITHOUT a development server, and correctly targets the specified server

Currently the baseUrl value is always overriden, unless the user specifies one, e.g.

npm run test:e2e -- --url <url>,

which is not clear to the user. It is not desirable to hard code a URL into package.json, as different users may require different target servers. When looking at the Cypress docs for information on changing the target URL, it directs you to change the baseUrl in cypress.json, and the user will then be confused that this does not work, not knowing that the value is being overriden by either vue-cli-service if no --url value is passed, or package.json if one is hardcoded there.

What does the proposed API look like?

Add additional option '--remote' or similar to command 'vue-cli-service test:e2e' to instruct it NOT to start a development server, and use the baseUrl value as specified in cypress.json (the default expected behaviour)

@LinusBorg
Copy link
Member

It is not desirable to hard code a URL into package.json, as different users may require different target servers.

But you want to hard-code it into cypress' config file (as that's also committed to git)? That doesn't seem to be an improvement, really.

If you need to locally customize the url that cypress is using, use an ENV:

# .env.local
# this file is git-ignored
CYPRESS_REMOTE_URL=http:// .....
"scripts": {
  "test:e2e:remote": "vue-cli-service test:e2e --url $CYPRESS_REMOTE_URL"
}

Would that be an alternative? everyone can customize the URL with their .env.local file and nothing is hardcoded in source control.

@migsar
Copy link

migsar commented Jun 26, 2020

I am not sure if a --remote flag would be the best idea, probably an additional flag is not needed, but I completely agree with @ajewers about the expected behavior being to be able to overwrite this on cypress.json or cypress.env.json.

I think a good first step would be to make this a bit more explicit on the documentation.

@migsar migsar mentioned this issue Jun 26, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants