-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: e2e tests on slider component (Issue/201) (#202)
- Loading branch information
1 parent
1b5e1b1
commit 4e21470
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe('Slider', function () { | ||
beforeEach(function () { | ||
cy.getData(); | ||
cy.visit('/'); | ||
}); | ||
|
||
it('should display the slider component', function () { | ||
const sliderComponents = this.data.components.filter(component => component._component === 'slider'); | ||
sliderComponents.forEach(sliderComponent => { | ||
cy.visit(`/#/preview/${sliderComponent._id}`); | ||
const stripHtml = cy.helpers.stripHtml; | ||
cy.testContainsOrNotExists('.slider__body', stripHtml(sliderComponent.body)); | ||
cy.testContainsOrNotExists('.slider__title', stripHtml(sliderComponent.displayTitle)); | ||
cy.testContainsOrNotExists('.slider__instruction', stripHtml(sliderComponent.instruction)); | ||
|
||
cy.get('.slider__number').should('contain', sliderComponent._scaleStart); | ||
cy.get('.slider__number').should('contain', sliderComponent._scaleEnd); | ||
|
||
// 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); | ||
}); | ||
}); | ||
}); |