Giter Site home page Giter Site logo

Cypress cannot interpret multiple arguments on the command line to change viewports, when there are already viewports configured by default about cypress HOT 4 CLOSED

raulpacheco2k avatar raulpacheco2k commented on June 14, 2024
Cypress cannot interpret multiple arguments on the command line to change viewports, when there are already viewports configured by default

from cypress.

Comments (4)

MikeMcC399 avatar MikeMcC399 commented on June 14, 2024 1

@raulpacheco2k

I can't reproduce your issue.

What happens if you execute the following using npx?

npx cypress open --config viewportWidth=1280,viewportHeight=720

It looks like you may have Cypress installed globally in addition. It's recommended to install locally only:

npm install cypress --save-dev

from cypress.

MikeMcC399 avatar MikeMcC399 commented on June 14, 2024 1

@raulpacheco2k

It's good to hear that your problem is solved!

The command you need to run depends on which package manager you are using, so all the commands are listed without npx, yarn or pnpm. This is explained in the documentation.


See Getting Started > Opening the App. If you are using npm, then you use npx:

cypress open

You can open Cypress from your project root one of the following ways:

Using npx

npx cypress open

Or by using yarn

yarn run cypress open

After a moment, the Cypress Launchpad will open.


See also Guides > Command Line > How to run commands:

How to run commands

For brevity we've omitted the full path to the cypress executable in each command's documentation.

To run a command, you'll need to prefix each command in order to properly locate the cypress executable.

npx cypress run

...or by using Yarn...

yarn cypress run

from cypress.

MikeMcC399 avatar MikeMcC399 commented on June 14, 2024 1

@raulpacheco2k

Since this is not a Cypress bug, you should close this issue now.

The Cypress technical community on Discord welcomes new users

Discord chat (click on button)

You can share your problems and get advice from other users there.

from cypress.

raulpacheco2k avatar raulpacheco2k commented on June 14, 2024

@MikeMcC399 , thanks for your response.

Excellent, that's how it works. I was following the Cypress documentation, it does not specify the npx parameter in the command. Maybe it's because you don't need npx to run the script in headless mode...

I'm new to Cypress, so I might end up saying nonsense.

I believe there may be an error in the documentation, the npx parameter must be added to the command line. When running the command requested in the documentation an error is thrown, but when adding npx it works successfully.

PS C:\Users\eu\Documents\Curso-TAT-Cypress-Basico> cypress run --browser chrome --config viewportWidth=1280,viewportHeight=720


DevTools listening on ws://127.0.0.1:54550/devtools/browser/5a0e387b-d3ee-46e0-ba08-a56ec59283eb
An invalid configuration value was set.

Expected viewportWidth to be a number.

Instead the value was: "1280 viewportHeight=720"
PS C:\Users\eu\Documents\Curso-TAT-Cypress-Basico> npx cypress run --browser chrome --config viewportWidth=1280,viewportHeight=720


DevTools listening on ws://127.0.0.1:54560/devtools/browser/ce29aa2a-d939-4081-b77c-c02976aebd5f

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        13.6.3                                                                         │
  │ Browser:        Chrome 121 (headless)                                                          │
  │ Node Version:   v21.4.0 (C:\Program Files\nodejs\node.exe)                                     │
  │ Specs:          1 found (CAC-TAT.cy.js)                                                        │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


from cypress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.