
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
cypress-slow-down
Advanced tools
Slow down your Cypress tests
Watch the introduction to this plugin in the video Slow Down Cypress Tests. For advanced usage, see the lessons in my Cypress Plugins course.
Add this NPM package to your project
# install using NPM
$ npm i -D cypress-slow-down
# or install using Yarn
$ yarn add -D cypress-slow-down
Include the plugin and call its function from your spec or support file
// cypress/e2e/spec.cy.js
// https://github.com/bahmutov/cypress-slow-down
import { slowCypressDown } from 'cypress-slow-down'
// slow down each command by the default amount
// which is 1 second
slowCypressDown()
You can control the delay before each command (in milliseconds)
// when calling the slowCypressDown function
slowCypressDown(1000)
You can also control the delay using the Cypress environment variable commandDelay
.
// cypress.config.js
const { defineConfig } = require('cypress')
module.exports = defineConfig({
e2e: {
env: {
// https://github.com/bahmutov/cypress-slow-down
commandDelay: 500,
},
},
})
// cypress/e2e/spec.cy.js
import { slowCypressDown } from 'cypress-slow-down'
slowCypressDown() // slows down each command by 500ms
You can disable the default slowdown by using false
. For example, from the command line you can pass the boolean value:
$ npx cypress run --env commandDelay=false
Or you can use the process (OS) environment variable
$ CYPRESS_commandDelay=false npx cypress run
Or you can use the cypress.config.js
to disable the slowdown
// cypress.config.js
const { defineConfig } = require('cypress')
module.exports = defineConfig({
e2e: {
env: {
// https://github.com/bahmutov/cypress-slow-down
commandDelay: false,
},
},
})
Because this plugin uses 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>)
The re-run the tests by pressing the key "R" or clicking "Run All Tests" button.
You can slow down a part of your test by using the custom dual commands cy.slowDown(ms)
and cy.slowDownEnd()
.
// your spec file
// cypress/e2e/spec.cy.js
// https://github.com/bahmutov/cypress-slow-down
import { slowCypressDown } from 'cypress-slow-down'
// registers the cy.slowDown and cy.slowDownEnd commands
import 'cypress-slow-down/commands'
// must enable the plugin using slowCypressDown
// can disable the slow down by default or use some default delay
slowCypressDown(false)
it('runs the middle part slowly', () => {
cy.visit('/')
cy.get('...').should('...').slowDown(1000)
// these commands have 1 second delay
...
cy.slowDownEnd()
// back to the normal speed
})
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2022
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github
Copyright (c) 2022 Gleb Bahmutov <gleb.bahmutov@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Slow down your Cypress tests
The npm package cypress-slow-down receives a total of 26,086 weekly downloads. As such, cypress-slow-down popularity was classified as popular.
We found that cypress-slow-down demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.