Skip to content

Commit

Permalink
Fix: Tests now account for scenarios where _externalTranscript is tur…
Browse files Browse the repository at this point in the history
…ned on or _inlineTranscript is turned off (fixes #301)
  • Loading branch information
cahirodoherty-learningpool authored Sep 9, 2024
1 parent 198bba4 commit 15315ab
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions test/e2e/media.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,27 @@ describe('Media', function () {
};

if (mediaComponent._transcript) {
cy.get('.media__transcript-body-inline').should('not.be.visible');
cy.get('button.media__transcript-btn').should('contain', mediaComponent._transcript.inlineTranscriptButton).click();
cy.get('.media__transcript-body-inline-inner').should('be.visible').should('contain', mediaComponent._transcript.inlineTranscriptBody);
cy.get('button.media__transcript-btn').should('contain', mediaComponent._transcript.inlineTranscriptCloseButton).click();
cy.get('.media__transcript-body-inline').should('not.be.visible');
if (mediaComponent._transcript._inlineTranscript) {
cy.get('.media__transcript-body-inline').should('not.be.visible');
cy.get('button.media__transcript-btn-inline').should('be.visible');
cy.get('button.media__transcript-btn-inline').should('contain', mediaComponent._transcript.inlineTranscriptButton).click();
cy.get('.media__transcript-body-inline-inner').should('be.visible').should('contain', mediaComponent._transcript.inlineTranscriptBody);
cy.get('button.media__transcript-btn-inline').should('contain', mediaComponent._transcript.inlineTranscriptCloseButton).click();
cy.get('.media__transcript-body-inline').should('not.be.visible');
} else {
cy.get('button.media__transcript-btn-inline').should('not.be.visible');
}

if (mediaComponent._transcript._externalTranscript) {
cy.get('button.media__transcript-btn-external').should('be.visible')
cy.get('button.media__transcript-btn-external').should('contain', mediaComponent._transcript.transcriptLinkButton);
} else {
cy.get('button.media__transcript-btn-external').should('not.be.visible')
}
};

// Allow the component to load and run external custom tests
cy.wait(1000);
});
});
});
});

0 comments on commit 15315ab

Please sign in to comment.