Cypress Testing
Cypress provides easy and fast testing on Chrome, Firefox and Microsoft Edge.
TestingBot has a CLI tool that will run your Cypress tests on the TestingBot browser grid.
Perform Cypress automation in the cloud, with TestingBot's browser grid. This will allow you to run Cypress tests in parallel on a wide collection of browsers; test on different versions and operating systems.
By default the CLI is using Cypress v13.3.3 (change). Testing is available on these platforms:
key | value | possible values |
---|---|---|
platform | The Operating System (OS) you want to run the tests on. |
|
browserName | The browser you want to run the tests on. |
chrome , firefox and microsoftedge
|
version | The version of the browser |
Chrome: version 70 to latest
Firefox: version 70 to latest
Edge: version 80 to latest (WIN10 only)
|
screenResolution | Specify a screen resolution for your test. | See a list of screen resolutions |
Install the CLI
To get started with the CLI, please install it with npm
or yarn
:
You can find the repository for the CLI on github@testingbot-cypress-cli
Configuration
Once installed, you'll need to provide the CLI with a testingbot.json
configuration file.
This file contains various settings, including the path to your Cypress tests.
To generate a configuration file, you can use the init
command:
Please add the key
and secret
you obtained from the TestingBot member dashboard in the testingbot.json
file.
Next, please supply cypress_proj_dir
with the path to the folder that contains the cypress.json
or cypress.config.js
file.
As an example, you can use the Cypress Kitchen Sink Example.
Before you can run your tests, you need to specify on which browser (version) and platform you'd like to test.
You can specify the browsers you want to use in the testingbot.json
file:
{
"auth": {
"key": "TESTINGBOT_KEY",
"secret": "TESTINGBOT_SECRET"
},
"browsers": [
{
"browserName": "chrome",
"platform": "VENTURA",
"version": "latest"
},
{
"browserName": "chrome",
"platform": "WIN10",
"version": "latest"
}
],
"run_settings": {
"cypress_project_dir": ".../cypress/cypress-example-kitchensink",
"build_name": "cypress-build",
"npm_dependencies": {},
"package_config_options": {},
"start_tunnel": true,
"local_ports": [8080],
"realTimeLogs": true,
"parallel": 5
},
"tunnel_settings": {
"verbose": false
}
}
Run tests
You are now ready to run your Cypress tests on TestingBot. Instead of using the Cypress test runner, you can use TestingBot's test runner.
Run the following command:
This will zip your Cypress tests, upload them to TestingBot and instruct TestingBot to start running the tests on the platform(s) you specified in the configuration file. The CLI will then display a link to view a live feed of your Cypress tests and will return realtime logs of the Cypress client running on TestingBot.
Once the tests have finished running, the CLI will exit with code 1
(failure) or code 0
(success).
Example
As an example, you can use cypress-example-kitchensink
These are the steps you need to follow to run the example on TestingBot:
-
Clone the kitchensink repo and install the dependencies:
npm install
-
Start the kitchensink example:
npm start
-
Add the local port used by kitchensink (8080) to the
local_ports
array, this way the TestingBot VMs can access the port. -
Change the
cypress_project_dir
to point to the path where you installed the example. - Run the tests:
- Test results will appear in your console and on the TestingBot dashboard.
Options
Several options are available in the testingbot.json
file.
-
cypress_project_dir
: this needs to be specified and is the directory (absolute path) where your cypress configuration file is located.cypress.json
orcypress.config.js
. -
build_name
: this will set the build name on TestingBot. All Cypress tests will be grouped under this name. -
npm_dependencies
: you can list the NPM dependencies that your Cypress project requires here: -
package_config_options
: the config options for each of the npm dependencies you specified: -
start_tunnel
: should the CLI start a TestingBot Tunnel to access websites on your local computer/network? -
local_ports
: an array of ports that Cypress is using on your local computer. Use this in combination withstart_tunnel = true
to run tests from your local computer or network. -
realTimeLogs
: should the CLI display a real-time feed of the Cypress logs? -
tunnel_settings
: add additional Tunnel options to the TestingBot tunnel process.
Environment Variables
The CLI supports various Environment Variables:
-
You can use
TESTINGBOT_KEY
andTESTINGBOT_SECRET
to pass the TestingBot credentials to the CLI. -
If you set
TESTINGBOT_CI=1
then the CLI will output theTestingBotSessionID
which can be used in combination with one of our CI plugins.
Limitations
While TestingBot supports most of the features Cypress provides, there are some that are not yet supported.
Below is a list of features we currently do not support. If you'd like us to add support for these, please reach out.
- Cypress Component Testing
- Module API
- Test Replay