Skip to content

Commit

Permalink
Add assertions to songs and stories tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcauliffe committed Dec 20, 2024
1 parent 9d25dc6 commit 96f16ba
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
34 changes: 22 additions & 12 deletions cypress/e2e/songs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
)
Expand Down
28 changes: 16 additions & 12 deletions cypress/e2e/stories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
)
Expand Down

0 comments on commit 96f16ba

Please sign in to comment.