From 503426e68c58eb1879ac41e2e1fc46174fb7ea95 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Tue, 3 Sep 2024 15:54:09 +0100 Subject: [PATCH] Fix: Tests now account for scenarios where _externalTranscript is turned on or _inlineTranscript is turned off --- test/e2e/media.cy.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/e2e/media.cy.js b/test/e2e/media.cy.js index ad5f984..e561391 100644 --- a/test/e2e/media.cy.js +++ b/test/e2e/media.cy.js @@ -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); }); }); -}); \ No newline at end of file +});