Uploaded March 2024 | Updated September 2026, 1 week ago
In this video, I show how to run the same test N times to "burn" it to see if it has flake. We can run the test using a regular JavaScript "for loop", or by using "Cypress._.times" utility function, or even by installing a plugin github.com/bahmutov/cy-grep Find the starting source code in the repo github.com/bahmutov/flaky-test-cypress branch "level2" If you like hands-on testing coding challenges, check out my Cypress/Playwright courses at https://cypress.tips/courses
In this video, I show how to run the same test N times to "burn" it to see if it has flake. We can run the test using a regular JavaScript "for loop", or by using "Cypress._.times" utility function, or even by installing a plugin github.com/bahmutov/cy-grep Find the starting source code in the repo github.com/bahmutov/flaky-test-cypress branch "level2" If you like hands-on testing coding challenges, check out my Cypress/Playwright courses at https://cypress.tips/courses







![Escape Regular Expression Text When Using cy.contains Command
This video shows how to escape special characters like $, [], and ^ when creating regular expressions to use with cy.contains command. You can escape the characters yourself or use the Lodash method Cypress._.escapeRegExp bundled with Cypress to do it for you
const suffix = $/day
const regex = new RegExp(Cypress._.escapeRegExp(suffix))
cy.contains(regex).should(have.id, rate)
Find the full recipe at https://glebbahmutov.com/cypress-examples Escape Regular Expression Text When Using cy.contains Command](https://i.ytimg.com/vi/hMzqiSUVGwA/mqdefault.jpg)


