Cypress
Requirements
- Node >=16
- Cypress 10 || 11 || 12 || 13
Installing the Plugin
Install the plugin using your favorite package manager.
npm install @testradar/cypress --save-dev
Configuring the Plugin
You can view the source code in our working example repository.
To configure the plugin, pass Cypress' on
function and an options object to the setupTestRadar
function exported from @testradar/cypress
.
import { defineConfig } from 'cypress';
import { setupTestRadar } from '@testradar/cypress';
export default defineConfig({
e2e: {
setupNodeEvents(on) {
// Replace the example values.
// See the plugin options documented below.
setupTestRadar(on, { repositoryId: 123456789 });
},
},
retries: 2,
});
Plugin Options:
Option | Description | Type | Required |
---|---|---|---|
repositoryId | Your repository's id, as shown on the Repositories page in TestRadar. | number | Yes |
If you have additional event handlers registered using setupNodeEvents
, the example above may not work as expected because Cypress has a bug #22428 registering multiple event handlers. You can easily patch that using cypress-on-fix
.
Test retries are required. Flaky test detection won't work without it.
You're almost done, you just need to set your API key to communicate with TestRadar.
Setting Your API Key
TestRadar requires your API key be set on process.env
as TESTRADAR_API_KEY
. We recommend you store this as a secret with your CI provider and set it inside your CI configuration file. For more information, see "Continuous Integration".
Your API key should be treated as a secret. Don't share it with others or store it in plain text.