Created
February 22, 2021 22:45
-
-
Save bahmutov/6f527fe62a2eeec76b49c343fa74163d to your computer and use it in GitHub Desktop.
Revisions
-
bahmutov created this gist
Feb 22, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ it('until the number 7 appears', () => { const checkAndReload = () => { // get the element's text, convert into a number cy.get('#result').should('not.be.empty') .invoke('text').then(parseInt) .then((number) => { // if the expected number is found // stop adding any more commands if (number === 7) { cy.log('lucky **7**') } else { // otherwise insert more Cypress commands // by calling the function after reload cy.wait(500, { log: false }) cy.reload() checkAndReload() } }) } cy.visit('public/index.html') checkAndReload() })