Answers for "cypress set viewport"

9

cypress support ability to set viewport in `before`

// pass viewport in cmd, this will over ride settings in cypress.json

"script_name": "./node_modules/.bin/cypress run --browser chrome --config viewportWidth=414,viewportHeight=896 --spec 'cypress/integration/file_name.js'"
Posted by: Guest on July-15-2020
10

cypress set viewport

//add this in cypress.json
{  
  "viewportWidth": 1280,
  "viewportHeight": 720
}
Posted by: Guest on July-15-2020
8

cypress set viewport

//for all test files, add this in cypress.json
{  
  "viewportWidth": 1280,
  "viewportHeight": 720
}
//for individual file(applies for all test cases inside this file)
//add a script in package.json

"script_name": "./node_modules/.bin/cypress run --browser chrome --config viewportWidth=414,viewportHeight=896 --spec 'cypress/integration/file_name.js'"
Posted by: Guest on July-15-2020

Code answers related to "cypress set viewport"

Code answers related to "Javascript"

Browse Popular Code Answers by Language