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

Cypress --browser option is not functional #3837

Closed
lachiesainsbury opened this issue Apr 17, 2019 · 2 comments
Closed

Cypress --browser option is not functional #3837

lachiesainsbury opened this issue Apr 17, 2019 · 2 comments

Comments

@lachiesainsbury
Copy link

Version

3.6.3

Reproduction link

https://github.com/lachiesainsbury/cypress-browser-chrome

Environment info

System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 10.14.1 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.3
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.3
    @vue/babel-preset-app:  3.6.0
    @vue/babel-preset-jsx:  1.0.0-beta.3
    @vue/babel-sugar-functional-vue:  1.0.0-beta.3
    @vue/babel-sugar-inject-h:  1.0.0-beta.3
    @vue/babel-sugar-v-model:  1.0.0-beta.3
    @vue/babel-sugar-v-on:  1.0.0-beta.3
    @vue/cli-overlay:  3.6.0
    @vue/cli-plugin-babel: ^3.6.0 => 3.6.0
    @vue/cli-plugin-e2e-cypress: ^3.6.0 => 3.6.0
    @vue/cli-plugin-eslint: ^3.6.0 => 3.6.0
    @vue/cli-service: ^3.6.0 => 3.6.0
    @vue/cli-shared-utils:  3.6.0
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2
    vue: ^2.6.10 => 2.6.10
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

In root directory:

  1. npm install
  2. npm run test:e2e

What is expected?

The test.js test should run in a chrome browser (as specified by the --browser chrome option in package.json).

What is actually happening?

The local server starts up but the test is not being run, and no error/log information is printed to console.

I believe this is due to a cypress bug where you can't change the baseUrl property of the --config option whilst using the --browser chrome option.
See:
cypress-io/cypress#2518

We can work around this in cypress by specifying the baseUrl in cypress.json, and not using the --config baseUrl option. The problem here is that cli-plugin-e2e-cypress always uses the --config option with the baseUrl set to the server url (see). If you specify the baseUrl in cypress.json and then comment out the default baseUrl option in index.js, then the test runs as expected.
e.g.

'--config', [/*`baseUrl=${url}`,*/ ...configs].join(','),

This isn't a huge issue if using the GUI, as you can simply select which browser to use, but I want to run cypress in headless mode with the chrome browser.
e.g.

"test:e2e": "vue-cli-service test:e2e --headless --browser chrome"
@lachiesainsbury lachiesainsbury changed the title Cypress CLI --browser option is not functional Cypress --browser option is not functional Apr 17, 2019
@quentinus95
Copy link

@lachiesainsbury Cypress does not support chrome in headless mode for now.

cypress-io/cypress#832

@andywgarcia
Copy link

It looks like cypress does now support running Chrome headless, and in fact, running vue-cli-service test:e2e --headless --browser chrome does run Chrome in headless mode. I think these docs just need to be updated https://cli.vuejs.org/core-plugins/e2e-cypress.html#vue-cli-plugin-e2e-cypress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants