UNPKG

cypress-docker-swarm-runner

Version:

A CLI tool for running Cypress tests in parallel using Docker Swarm services.

43 lines (29 loc) 1.33 kB
# 🐳 Cypress Docker Swarm Runner ## Overview This CLI tool automates the creation, monitoring, and cleanup of Cypress test services in a Docker Swarm environment. It dynamically creates Docker services based on a mapping of Cypress spec files and their test case IDs, enabling efficient parallel test execution. --- ## Features - Automated dynamic Docker Swarm service creation for each Cypress spec. - Supports long-running tests (15-20 minutes). - Enforces a 30-minute timeout to avoid infinite loops. - Continuously monitors service status and logs output. - Automatically removes services after execution. - Retries failed commands up to 3 times. - Saves test logs as styled HTML files for easier review. --- ## Prerequisites - Docker & Docker Swarm installed and initialized (`docker swarm init`). - Node.js (v14 or later). --- ## Usage ### Programmatic Usage Import and call the main function with your test specs mapping: ```js const { createServices } = require("cypress-docker-swarm-runner"); const specTestCasesMap = new Map([ ["cypress/e2e/login.cy.js", ["TC_01", "TC_02"]], ["cypress/e2e/signup.cy.js", ["TC_03"]] ]); const SECRET_NAME = "cypress-secret"; // docker secret credentials const IMAGE_NAME = "your-docker-image:latest"; createServices({ specTestCasesMap, SECRET_NAME, IMAGE_NAME });