From 7f90579c04383ca883083548f40782352605d778 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Aug 2020 10:25:07 +0200 Subject: Add playlist embed E2E test --- client/e2e/src/videos.e2e-spec.ts | 47 ++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'client/e2e/src/videos.e2e-spec.ts') diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 75fa89e28..97d1b827c 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts @@ -2,6 +2,7 @@ import { browser } from 'protractor' import { AppPage } from './po/app.po' import { LoginPage } from './po/login.po' import { MyAccountPage } from './po/my-account' +import { PlayerPage } from './po/player.po' import { VideoUpdatePage } from './po/video-update.po' import { VideoUploadPage } from './po/video-upload.po' import { VideoWatchPage } from './po/video-watch.po' @@ -23,6 +24,7 @@ describe('Videos workflow', () => { let myAccountPage: MyAccountPage let loginPage: LoginPage let appPage: AppPage + let playerPage: PlayerPage let videoName = new Date().getTime() + ' video' const video2Name = new Date().getTime() + ' second video' @@ -36,6 +38,7 @@ describe('Videos workflow', () => { myAccountPage = new MyAccountPage() loginPage = new LoginPage() appPage = new AppPage() + playerPage = new PlayerPage() if (await isIOS()) { // iOS does not seem to work with protractor @@ -99,8 +102,8 @@ describe('Videos workflow', () => { it('Should play the video', async () => { videoWatchUrl = await browser.getCurrentUrl() - await videoWatchPage.playAndPauseVideo(true) - expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) + await playerPage.playAndPauseVideo(true) + expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) }) it('Should watch the associated embed video', async () => { @@ -108,8 +111,8 @@ describe('Videos workflow', () => { await videoWatchPage.goOnAssociatedEmbed() - await videoWatchPage.playAndPauseVideo(false) - expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) + await playerPage.playAndPauseVideo(false) + expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) await browser.waitForAngularEnabled(true) }) @@ -119,8 +122,8 @@ describe('Videos workflow', () => { await videoWatchPage.goOnP2PMediaLoaderEmbed() - await videoWatchPage.playAndPauseVideo(false) - expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) + await playerPage.playAndPauseVideo(false) + expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) await browser.waitForAngularEnabled(true) }) @@ -178,19 +181,44 @@ describe('Videos workflow', () => { await myAccountPage.playPlaylist() + await browser.waitForAngularEnabled(false) + await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000) + + await browser.waitForAngularEnabled(true) }) it('Should watch the webtorrent playlist in the embed', async () => { if (await skipIfUploadNotSupported()) return + const accessToken = await browser.executeScript(`return window.localStorage.getItem('access_token');`) + const refreshToken = await browser.executeScript(`return window.localStorage.getItem('refresh_token');`) + await browser.waitForAngularEnabled(false) await myAccountPage.goOnAssociatedPlaylistEmbed() - await videoWatchPage.playAndPauseVideo(false) + await browser.executeScript(`window.localStorage.setItem('access_token', '${accessToken}');`) + await browser.executeScript(`window.localStorage.setItem('refresh_token', '${refreshToken}');`) + await browser.executeScript(`window.localStorage.setItem('token_type', 'Bearer');`) - await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000) + await browser.refresh() + + await playerPage.playVideo() + + await playerPage.waitUntilPlaylistInfo('2/2') + + await browser.waitForAngularEnabled(true) + }) + + it('Should watch the HLS playlist in the embed', async () => { + await browser.waitForAngularEnabled(false) + + await videoWatchPage.goOnP2PMediaLoaderPlaylistEmbed() + + await playerPage.playVideo() + + await playerPage.waitUntilPlaylistInfo('2/2') await browser.waitForAngularEnabled(true) }) @@ -198,6 +226,9 @@ describe('Videos workflow', () => { it('Should delete the video 2', async () => { if (await skipIfUploadNotSupported()) return + // Go to the dev website + await browser.get(videoWatchUrl) + await myAccountPage.navigateToMyVideos() await myAccountPage.removeVideo(video2Name) -- cgit v1.2.3