For Demonstration Purposes Only
The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.
This repository will hold multiple examples on how to run Cypress tests locally and with the Sauce Labs saucectl CLI.
It is based on the following user journey:
- A QA/DEV already has Cypress tests which he/she can run on his local machine
- A QA/DEV wants to run his existing tests on Sauce Labs VMs
- Please check our documentation for installing SauceCTL
- Make sure you've set up your credentials on your local machine and or CI-pipeline, see this-doc
- Check the Cypress-docs for all options
You can install all dependencies by running the following command
npm install
This will install all needed dependencies that are listed in the package.json
-file
NOTE: Make sure you are in the folder
demo-Cypresss
when you execute this command
You can install only saucectl by running the following command
npm install -g saucectl
More information about Cypress and writing Cypress tests can be found here
More information about the Sauce Labs saucectl can be found here
All below mentioned examples can be found in the .sauce
-folder. You can run the configurations by running
the following command from the root of this folder
saucectl run --config ./.sauce/config-ex{#}.yml
# OR for use with the EU data center
npm run test.sauce.ex{#}.eu
# OR for use with the US data center
npm run test.sauce.ex{#}.us
The #
stands for the number of the below mentioned examples.
config-ex1.yml
provides a minimum configuration needed to run the Cypress tests.
In this example, all tests are executed on a single chrome browser in sequential order.
config-ex2.yml
run all tests on chrome. saucectl automatically
splits the tests by using "shard" property with the value "spec" so that they can easily run in parallel.
config-ex3.yml
run the login and the swag item tests on 3 different types of browsers where saucectl automatically splits the tests by using "shard" property with the value "spec" so that they can easily run in parallel.
config-ex4.yml
run all tests on different Chrome versions where saucectl automatically
splits the tests by using "shard" property with the value "shard" so that they can easily run in parallel.
config-ex5.yml
run the login tests that include the login.failed.cy spec with a failed test. Use the retries property to rerun the failed spec.