Skip to content

Commit

Permalink
Merge pull request #73 from adaptlearning/issue/72
Browse files Browse the repository at this point in the history
Chore: Added text component e2e tests (Issue/72)
  • Loading branch information
lemmyadams authored Feb 19, 2024
2 parents 328ca10 + 99f9691 commit debf5ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/e2e/text.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('Text', function () {
beforeEach(function () {
cy.getData()
cy.visit('/');
});

it('should display the text components', function () {
const textComponents = this.data.components.filter((component) => component._component === 'text')
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
cy.wait(1000)
});
});
});

0 comments on commit debf5ec

Please sign in to comment.