Skip to content

Commit

Permalink
Fix: Update tests to meet new standards (fixes #75) (#76)
Browse files Browse the repository at this point in the history
* Updated test

* moved out html
  • Loading branch information
lemmyadams committed Jun 18, 2024
1 parent e19b899 commit 573d972
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/e2e/text.cy.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
describe('Text', function () {
beforeEach(function () {
cy.getData()
cy.visit('/');
cy.getData();
});

it('should display the text components', function () {
const textComponents = this.data.components.filter((component) => component._component === 'text')
textComponents.forEach((textComponent) => {
const textComponents = this.data.components.filter(component => component._component === 'text');
const stripHtml = cy.helpers.stripHtml;
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)
cy.testContainsOrNotExists('.text__body', stripHtml(textComponent.body));
cy.testContainsOrNotExists('.text__title', stripHtml(textComponent.displayTitle));

// 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)
cy.wait(1000);
});
});
});

0 comments on commit 573d972

Please sign in to comment.