-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stage' into production
- Loading branch information
Showing
37 changed files
with
502 additions
and
73 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
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
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
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
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
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
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,115 @@ | ||
describe('The Listen Page', () => { | ||
it('successfully loads', () => { | ||
cy.visit('/listen') | ||
|
||
cy.get('[data-testid=listen]').should('exist') | ||
}) | ||
|
||
it('can listen to a clip', () => { | ||
cy.visit('/listen') | ||
|
||
const playButton = cy.get('[data-testid=play-button]') | ||
|
||
playButton.should('exist') | ||
|
||
// assert video is paused | ||
cy.get('audio').should('have.prop', 'paused', true) | ||
|
||
playButton.click() | ||
|
||
// assert video is playing | ||
cy.get('audio').should('have.prop', 'paused', false) | ||
}) | ||
|
||
it('votes yes', () => { | ||
cy.visit('/listen') | ||
|
||
const yesButton = cy.get('[data-testid=vote-yes-button]') | ||
|
||
// assert yes and no buttons should be disabled before listening to a clip | ||
yesButton.should('be.disabled') | ||
|
||
const playButton = cy.get('[data-testid=play-button]') | ||
|
||
playButton.click() | ||
|
||
// vote yes | ||
yesButton.click() | ||
|
||
cy.get('[data-testid=instruction]').should( | ||
'have.text', | ||
"Great work! Listen again when you're ready" | ||
) | ||
}) | ||
|
||
it('votes no', () => { | ||
cy.visit('/listen') | ||
|
||
const playButton = cy.get('[data-testid=play-button]') | ||
const noButton = cy.get('[data-testid=vote-no-button]') | ||
|
||
// play the next clip | ||
playButton.click() | ||
|
||
// vote no | ||
noButton.click() | ||
|
||
cy.get('[data-testid=instruction]').should( | ||
'have.text', | ||
"Great work! Listen again when you're ready" | ||
) | ||
}) | ||
|
||
it('skips a clip', () => { | ||
cy.visit('/listen') | ||
|
||
const skipButton = cy.get('[data-testid=skip-button]') | ||
|
||
cy.get('[data-testid=card-1]') | ||
.invoke('text') | ||
.then(text1 => { | ||
skipButton.click() | ||
|
||
cy.get('[data-testid=card-1]') | ||
.invoke('text') | ||
.should(text2 => { | ||
// when skipped the contents of the card should be different | ||
expect(text1).not.eq(text2) | ||
}) | ||
}) | ||
}) | ||
|
||
it('listens to 5 clips', () => { | ||
cy.visit('/listen') | ||
|
||
const playButton = cy.get('[data-testid=play-button]') | ||
|
||
const yesButton = cy.get('[data-testid=vote-yes-button]') | ||
const noButton = cy.get('[data-testid=vote-no-button]') | ||
|
||
playButton.click() | ||
noButton.click() | ||
|
||
playButton.click() | ||
yesButton.click() | ||
|
||
playButton.click() | ||
noButton.click() | ||
|
||
playButton.click() | ||
noButton.click() | ||
|
||
playButton.click() | ||
yesButton.click() | ||
|
||
const successPage = cy.get('[data-testid=contribution-success]') | ||
successPage.should('exist') | ||
|
||
const contributeMoreButton = cy.get('[data-testid=contribute-more-button]') | ||
|
||
contributeMoreButton.click() | ||
|
||
// expect card to be visible | ||
cy.get('[data-testid=card-1]').should('exist') | ||
}) | ||
}) |
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
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
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
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
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
Oops, something went wrong.