Skip to content

Commit

Permalink
Fix: e2e tests to check _canCycleThroughPagination (fixes #312) (#313)
Browse files Browse the repository at this point in the history
* Fix: e2e tests to check _canCycleThroughPagination

* Update test/e2e/hotGraphic.cy.js

Co-authored-by: Cahir O'Doherty <41006337+cahirodoherty-learningpool@users.noreply.github.com>

* Update test/e2e/hotGraphic.cy.js

Co-authored-by: Cahir O'Doherty <41006337+cahirodoherty-learningpool@users.noreply.github.com>

---------

Co-authored-by: Cahir O'Doherty <41006337+cahirodoherty-learningpool@users.noreply.github.com>
  • Loading branch information
joe-allen-89 and cahirodoherty-learningpool committed Jun 20, 2024
1 parent a9c0197 commit 16602b9
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions test/e2e/hotGraphic.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
describe('Hot Graphic', function () {
function loopThroughHotGraphic(hotGraphicComponent) {
const items = hotGraphicComponent._items;
const canCycle = hotGraphicComponent._canCycleThroughPagination;
cy.get('.hotgraphic__pin-item').should('have.length', items.length);
// Check each pin works correctly
items.forEach((item, index) => {
items.forEach((item, index) => {
cy.get(`.hotgraphic__pin-item .item-${index}.is-visited`).should('not.exist');
cy.get('.notify__popup.hotgraphic').should('not.exist');
cy.get(`.hotgraphic__pin-item .item-${index}`).click();
Expand All @@ -16,18 +17,33 @@ describe('Hot Graphic', function () {

// Check pin popup navigation works as expected
cy.get('.hotgraphic__pin-item .item-0').click();
items.forEach(item => {
items.forEach(item => {
cy.testContainsOrNotExists('.hotgraphic-popup__item-title-inner', item.title);
cy.testContainsOrNotExists('.hotgraphic-popup__item-body-inner', item.body);
cy.get('.hotgraphic-popup__controls.next').click();
})
cy.get('.hotgraphic-popup__controls.next.is-disabled').should('exist');
items.forEach(item => {
});

if (!canCycle) {
cy.get('.hotgraphic-popup__controls.next.is-disabled').should('exist');
} else {
cy.get('.hotgraphic-popup__controls.next')
.should('exist')
.and('not.have.class', 'is-disabled')
}

items.forEach(item => {
cy.testContainsOrNotExists('.hotgraphic-popup__item-title-inner', item.title);
cy.testContainsOrNotExists('.hotgraphic-popup__item-body-inner', item.body);
cy.get('.hotgraphic-popup__controls.back').click();
})
cy.get('.hotgraphic-popup__controls.back.is-disabled').should('exist');
});

if (!canCycle) {
cy.get('.hotgraphic-popup__controls.back.is-disabled').should('exist');
} else {
cy.get('.hotgraphic-popup__controls.back')
.should('exist')
.and('not.have.class', 'is-disabled')
}
};

beforeEach(function () {
Expand Down

0 comments on commit 16602b9

Please sign in to comment.