Skip to content

Commit

Permalink
Changed back to wait
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmyadams committed Feb 7, 2024
1 parent 2c87514 commit 99f9691
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions test/e2e/text.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,12 @@ describe('Text', function () {
textComponents.forEach((textComponent) => {
cy.visit(`/#/preview/${textComponent._id}`);
const bodyWithoutHtml = textComponent.body.replace(/<[^>]*>/g, '');


cy.testContainsOrNotExists('.text__title', textComponent.displayTitle)
cy.testContainsOrNotExists('.text__body', bodyWithoutHtml)
// Make sure the current component is tested before moving to the next one
// Custom cypress tests are async so we need to wait for them to pass first
let waited = false
function waitOneSecond() {
return new Cypress.Promise((resolve, reject) => {
setTimeout(() => {
waited = true

resolve()
}, 1000)
})
}

cy.wrap(null).then(() => {
return waitOneSecond().then(() => {
cy.testContainsOrNotExists('.text__title', textComponent.displayTitle)
cy.testContainsOrNotExists('.text__body', bodyWithoutHtml)
expect(waited).to.be.true
})
})
cy.wait(1000)
});
});
});

0 comments on commit 99f9691

Please sign in to comment.