Integrate Cypress with alternative cloud services like Currents or Sorry Cypress.
Currents - a drop-in replacement for Cypress Dashboard. Run, debug, troubleshoot and analyze parallel CI tests in cloud. This is an enhanced version of Sorry Cypress with better security, performance, analytics, integrations and support.
Sorry Cypress - is an open-source, free alternative to Cypress Dashboard that unlocks unlimited parallelization, test recordings, and integration with GitHub, Slack and more.
Changelog | Compatibility | Documentation | License
- Cypress version 10+
- NodeJS 14.7.0+
Install the package:
npm install cypress-cloud- Create a new configuration file:
currents.config.jsin the Cypress project’s root - Set the
projectIdand the record key obtained from Currents or your self-hosted instance of Sorry Cypress:
// currents.config.js
module.exports = {
projectId: "Ij0RfK",
recordKey: "xxx",
// Sorry Cypress users - set the director service URL
cloudServiceUrl: "https://cy.currents.dev",
};Add cypress-cloud/plugin to cypress.config.{js|ts|mjs}
// cypress.config.js
const { defineConfig } = require("cypress");
const { cloudPlugin } = require("cypress-cloud/plugin");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
return cloudPlugin(on, config);
},
},
});npx cypress-cloud --parallel --record --key <your_key> --ci-build-id hello-cypress-cloudcypress-cloud is designed for use in a headless mode in a CI environment, it provides the same flags and options as cypress command, but certain flags are preset and hidden. See all the available options npx cypress-cloud --help.
Learn more about CI Build ID and Parallelization.
See an example in examples/webapp directory.
// currents.config.js
module.exports = {
projectId: "Ij0RfK", // Project Id obtained from https://app.currents.dev or Sorry Cypress
recordKey: "XXXXXXX", // Record key obtained from https://app.currents.dev, any value for Sorry Cypress
cloudServiceUrl: "https://cy.currents.dev", // Sorry Cypress users - the director service URL
e2e: {
batchSize: 3, // orchestration batch size for e2e tests (Currents only, read below)
},
component: {
batchSize: 5, // orchestration batch size for component tests (Currents only, read below)
},
};cypress-cloud will search for currents.config.js at the project's root location (defined with -P --project CLI option).
Override the default configuration values via environment variables:
CURRENTS_API_URL- sorry-cypress users - set the URL of your director serviceCURRENTS_PROJECT_ID- set theprojectIdCURRENTS_RECORD_KEY- cloud service record key
The configuration variables will resolve as follows:
- the corresponding CLI flag or
runfunction parameter, otherwise - environment variable if exist, otherwise
currents.config.jsvalue, otherwise- the default value, otherwise throw
This package uses its own orchestration and reporting protocol that is independent of cypress native implementation. The new orchestration protocol uses cypress in "offline" mode and allows batching multiple spec files for better efficiency. You can adjust the batching configuration in currents.config.js and use different values for e2e and component tests.
Run Cypress tests programmatically. See ./examples/webapp/scripts for examples.
run(params: CurrentsRunAPI): Promise<CypressCommandLine.CypressRunResult | undefined>params-CurrentsRunAPIlist of params. It is an extended version of Cypress Module API- return execution results as
CypressCommandLine.CypressRunResult | undefined
Example:
import { run } from "cypress-cloud";
const results = await run({
recordKey: "some",
reporter: "junit",
browser: "chrome",
config: {
baseUrl: "http://localhost:8080",
video: true,
},
});cypress-cloud/plugin needs access to certain environment variables that are injected into the config parameter of setupNodeEvents(on, config).
Please make sure to preserve the original config.env parameters in case you are using additional plugins, e.g.:
const { defineConfig } = require("cypress");
const { cloudPlugin } = require("cypress-cloud/plugin");
module.exports = defineConfig({
e2e: {
// ...
setupNodeEvents(on, config) {
// alternative: activate the plugin first
// cloudPlugin(on, config)
const enhancedConfig = {
env: {
// preserve the original env
...config.env,
customVariable: "value",
},
};
return cloudPlugin(on, enhancedConfig);
},
},
});As an alternative, you can activate the cloudPlugin first, and then implement the custom setup. Please contact our support if you have a complex plugin configuration to get assistance with the setup.
cypress-cloud discovers the spec files using globby patterns according to the following logic:
- if no
--specis provided, use thespecPatterndefined incypress.config.{jt}s - if
--specflag is provided, use the intersection ofspecPatternand--spec - if no spec files were discovered, halt the execution and show a warning
Enable the debug mode to troubleshoot files discovery: DEBUG=currents:specs npx cypress-cloud ...
Enable the debug mode and run the command:
DEBUG=currents:* npx cypress-cloud run ...Capture all the logs in a plain text file and submit an issue.
npm run testPlease note, we use
esbuildfor building andswcfor testing. In addition, jest has built-in module aliases, but eslint does not. Beware of importing aliases in non-testing code.
cd packages/cypress-cloud
npm run release -- --preRelease=beta && npm run release:npm -- -t betacd packages/cypress-cloud
npm run release && npm run release:npm -- -t latestPublishing from packages/cypress-cloud:
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
npm adduser --registry http://localhost:4873
npm login --registry http://localhost:4873
npm_config_registry=http://localhost:4873 npm run release:npm -- --tag latestUsing:
npm install cypress-cloud --registry http://localhost:4873