cypress-parallel-specs-locally
cypress-parallel-specs-locally copied to clipboard
Script for parallel Cypress specs execution locally
cypress-parallel-specs-locally
Example scripts to play with Cypress locally and running in several processes.
Arguments
Each script supports arguments:
executors- number of chainers which are picking specs to run;filter- filtering specs path by keyword;
Scripts
runner_recursive
Is a pool of promises using recursion - runner_recursive.js
Commands
yarn cy:run:recursive- single executoryarn cy:run:recursive:parallel:empty- with filteringyarn cy:run:recursive:parallel- all specs
runner_queue
Is an event based runner with queue - runner_queue.js. Node v12+ is required.
runner_queue tries to solve an issue with several Cypress xvfb instances spawned at same time and fighting for same resource causing skipping some suites. Now a parameter timeout could be configured, which blocks new instance from spawning cypress if timeout from previous start has not finished. Value of timeout should be some +/- average time between starting cypress and opened browser, and it depends on your test suite size and available machine resources.
Commands
yarn cy:run:queue- single executoryarn cy:run:queue:parallel:empty- with filteringyarn cy:run:queue:parallel- all specs
runner_recursive_service
Is basically a runner_recursive but handles spec files with external parallel-specs service to distribute spec files across processes - runner_recursive_service.js
Uses parallel-specs-client library to interact with parallel-specs service api.
runner_recursive_service is meant to solve an issue of distributing spec files by their expected duration in order to optimize total execution time
Pre-requisites
- obtain account at parallel-specs
- obtain api key at api keys page
- set
.envfile variablesPARALLEL_SPECS_PROJECT_NAMEandPARALLEL_SPECS_API_KEY, example - example.env
Commands
yarn cy:run:recursive:service- single executoryarn cy:run:recursive:service:parallel:empty- with filteringyarn cy:run:recursive:service:parallel- all specs
How to run any command with mochawesome report:
yarn prereportyarn cy:run:recursive:parallel:emptyyarn postreport