From 96f16ba612a310c20de4b08b7b92ef4e45f582a0 Mon Sep 17 00:00:00 2001 From: Guy McAuliffe <38873380+gmcauliffe@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:12:06 -0800 Subject: [PATCH] Add assertions to songs and stories tests --- cypress/e2e/songs.cy.js | 34 ++++++++++++++++++++++------------ cypress/e2e/stories.cy.js | 28 ++++++++++++++++------------ 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/cypress/e2e/songs.cy.js b/cypress/e2e/songs.cy.js index 6491858f..7b691266 100644 --- a/cypress/e2e/songs.cy.js +++ b/cypress/e2e/songs.cy.js @@ -13,33 +13,43 @@ describe( it('10.3 - Click on songs grid view', () => { cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`) - cy.get('[data-testid=navigation-learn-btn]').click() - cy.get('[data-testid=navigation-songs-link]').click() - cy.get('[data-testid=song-story-grid-tile]', { timeout: 10000 }).each( + cy.contains('p', 'Learn').should('be.visible') + cy.get('[data-testid="navigation-learn-btn"]').click() + cy.get('[data-testid="navigation-songs-link"]').click() + cy.location('pathname').should( + 'match', + `/${Cypress.env('DIALECT')}/songs`, + ) + cy.get('[data-testid="song-story-grid-tile"]', { timeout: 10000 }).each( (_song) => { cy.wrap(_song).scrollIntoView() cy.wrap(_song).click() cy.contains('Loading').should('not.exist') - cy.get('[data-testid=song-link]').scrollIntoView() - cy.get('[data-testid=song-link]').should('be.visible') + cy.get('[data-testid="song-link"]').scrollIntoView() + cy.get('[data-testid="song-link"]').should('be.visible') cy.get('#CloseDrawerBtn').click() - cy.get('[data-testid=song-link]').should('not.exist') + cy.get('[data-testid="song-link"]').should('not.exist') }, ) }) it('10.4 - Check list view songs', () => { cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`) - cy.get('[data-testid=navigation-learn-btn]').click() - cy.get('[data-testid=navigation-songs-link]').click() - cy.get('[data-testid=grid-off-btn]').click() - cy.get('[data-testid=song-story-list-row]', { timeout: 10000 }).each( + cy.contains('p', 'Learn').should('be.visible') + cy.get('[data-testid="navigation-learn-btn"]').click() + cy.get('[data-testid="navigation-songs-link"]').click() + cy.location('pathname').should( + 'match', + `/${Cypress.env('DIALECT')}/songs`, + ) + cy.get('[data-testid="grid-off-btn"]').click() + cy.get('[data-testid="song-story-list-row"]', { timeout: 10000 }).each( (_song) => { cy.wrap(_song).scrollIntoView() cy.wrap(_song).should('be.enabled') cy.wrap(_song).click() - cy.get('[data-testid=song-link]').scrollIntoView() - cy.get('[data-testid=song-link]').should('be.visible') + cy.get('[data-testid="song-link"]').scrollIntoView() + cy.get('[data-testid="song-link"]').should('be.visible') cy.get('#CloseDrawerBtn').click() }, ) diff --git a/cypress/e2e/stories.cy.js b/cypress/e2e/stories.cy.js index a4b641af..c662981a 100644 --- a/cypress/e2e/stories.cy.js +++ b/cypress/e2e/stories.cy.js @@ -14,34 +14,38 @@ describe( it('10.1 - Click on stories grid view', () => { cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`) - cy.get('[data-testid=navigation-learn-btn]').click() - cy.get('[data-testid=navigation-stories-link]').click() - cy.get('[data-testid=song-story-grid-tile]', { timeout: 10000 }).each( + cy.contains('p', 'Learn').should('be.visible') + cy.get('[data-testid="navigation-learn-btn"]').click() + cy.get('[data-testid="navigation-stories-link"]').click() + cy.location('pathname').should('eq', `/${Cypress.env('DIALECT')}/stories`) + cy.get('[data-testid="song-story-grid-tile"]', { timeout: 10000 }).each( (_story) => { cy.wrap(_story).scrollIntoView() cy.wrap(_story).click() - cy.get('[data-testid=story-link]').scrollIntoView() - cy.get('[data-testid=story-link]').should('be.visible') + cy.get('[data-testid="story-link"]').scrollIntoView() + cy.get('[data-testid="story-link"]').should('be.visible') cy.get('#CloseDrawerBtn').click() - cy.get('[data-testid=story-link]').should('not.exist') + cy.get('[data-testid="story-link"]').should('not.exist') }, ) }) it('10.2 - Check list view stories', () => { cy.visit(`${Cypress.env('baseUrl')}${Cypress.env('DIALECT')}`) - cy.get('[data-testid=navigation-learn-btn]').click() - cy.get('[data-testid=navigation-stories-link]').click() - cy.get('[data-testid=grid-off-btn]').click() - cy.get('[data-testid=song-story-list-row]', { timeout: 10000 }).each( + cy.contains('p', 'Learn').should('be.visible') + cy.get('[data-testid="navigation-learn-btn"]').click() + cy.get('[data-testid="navigation-stories-link"]').click() + cy.location('pathname').should('eq', `/${Cypress.env('DIALECT')}/stories`) + cy.get('[data-testid="grid-off-btn"]').click() + cy.get('[data-testid="song-story-list-row"]', { timeout: 10000 }).each( (_story) => { cy.wrap(_story).scrollIntoView() cy.wrap(_story).should('be.enabled') cy.wrap(_story).click() - cy.get('[data-testid=story-link]').scrollIntoView() - cy.get('[data-testid=story-link]').should('be.visible') + cy.get('[data-testid="story-link"]').scrollIntoView() + cy.get('[data-testid="story-link"]').should('be.visible') cy.get('#CloseDrawerBtn').click() }, )