cypress-slow-down
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "cypress-slow-down", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Slow down your Cypress tests", | ||
@@ -27,3 +27,6 @@ "main": "src/index.js", | ||
"url": "https://github.com/bahmutov/cypress-slow-down.git" | ||
}, | ||
"dependencies": { | ||
"cypress-plugin-config": "^1.0.0" | ||
} | ||
} |
@@ -5,2 +5,4 @@ # cypress-slow-down ![cypress version](https://img.shields.io/badge/cypress-10.3.1-brightgreen) [![ci](https://github.com/bahmutov/cypress-slow-down/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-slow-down/actions/workflows/ci.yml) [![cypress-slow-down](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/q3727b&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/q3727b/runs) | ||
Watch this plugin in the video [Slow Down Cypress Tests](https://youtu.be/lxx-_nAkQo8). | ||
## Install | ||
@@ -21,2 +23,3 @@ | ||
// cypress/e2e/spec.cy.js | ||
// https://github.com/bahmutov/cypress-slow-down | ||
import { slowCypressDown } from 'cypress-slow-down' | ||
@@ -46,2 +49,3 @@ // slow down each command by the default amount | ||
env: { | ||
// https://github.com/bahmutov/cypress-slow-down | ||
commandDelay: 500, | ||
@@ -79,2 +83,3 @@ }, | ||
env: { | ||
// https://github.com/bahmutov/cypress-slow-down | ||
commandDelay: false, | ||
@@ -86,2 +91,10 @@ }, | ||
## Change the command delay from DevTools | ||
Because this plugin uses [cypress-plugin-config](https://github.com/bahmutov/cypress-plugin-config) to read the command delay option, you can change its value or disable the plugin completely from the DevTools console using the command `Cypress.setPluginConfigValue('commandDelay', <value>)` | ||
![Change the command delay from the DevTools](./images/set-delay.png) | ||
The re-run the tests by pressing the key "R" or clicking "Run All Tests" button. | ||
## Small print | ||
@@ -88,0 +101,0 @@ |
@@ -1,3 +0,8 @@ | ||
function slowCypressDown(commandDelay = Cypress.env('commandDelay')) { | ||
import { getPluginConfigValue } from 'cypress-plugin-config' | ||
function slowCypressDown(commandDelay) { | ||
if (typeof commandDelay === 'undefined') { | ||
commandDelay = getPluginConfigValue('commandDelay') | ||
} | ||
if (typeof commandDelay === 'undefined') { | ||
commandDelay = 1000 | ||
@@ -13,3 +18,3 @@ } | ||
throw new Error( | ||
`Command delay cannot be negative, you passed ${commandDelay}`, | ||
`Time is linear (I think), the command delay cannot be negative, you passed ${commandDelay}`, | ||
) | ||
@@ -16,0 +21,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6092
23
137
1
+ Addedcypress-plugin-config@^1.0.0
+ Addedcypress-plugin-config@1.2.1(transitive)