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/po/player.po.ts | 54 ++++++++++++++++++++++++++++++++++++ client/e2e/src/po/video-watch.po.ts | 55 ++++++++----------------------------- 2 files changed, 66 insertions(+), 43 deletions(-) create mode 100644 client/e2e/src/po/player.po.ts (limited to 'client/e2e/src/po') diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts new file mode 100644 index 000000000..c03f20c68 --- /dev/null +++ b/client/e2e/src/po/player.po.ts @@ -0,0 +1,54 @@ +import { browser, by, element, ExpectedConditions } from 'protractor' +import { browserSleep, isIOS, isMobileDevice } from '../utils' + +export class PlayerPage { + + getWatchVideoPlayerCurrentTime () { + return element(by.css('.video-js .vjs-current-time-display')) + .getText() + .then((t: string) => t.split(':')[1]) + .then(seconds => parseInt(seconds, 10)) + } + + waitUntilPlaylistInfo (text: string) { + const elem = element(by.css('.video-js .vjs-playlist-info')) + + return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, text)) + } + + async playAndPauseVideo (isAutoplay: boolean) { + // Autoplay is disabled on iOS + if (isAutoplay === false || await isIOS()) { + await this.clickOnPlayButton() + } + + await browserSleep(2000) + await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) + + const videojsEl = element(by.css('div.video-js')) + await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) + + // On Android, we need to click twice on "play" (BrowserStack particularity) + if (await isMobileDevice()) { + await browserSleep(5000) + + await videojsEl.click() + } + + browser.ignoreSynchronization = false + await browserSleep(7000) + browser.ignoreSynchronization = true + + await videojsEl.click() + } + + async playVideo () { + return this.clickOnPlayButton() + } + + private async clickOnPlayButton () { + const playButton = element(by.css('.vjs-big-play-button')) + await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) + await playButton.click() + } +} diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index 35ec773af..fb9c3a000 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts @@ -1,5 +1,5 @@ import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' -import { browserSleep, isIOS, isMobileDevice } from '../utils' +import { browserSleep, isMobileDevice } from '../utils' export class VideoWatchPage { async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { @@ -37,43 +37,24 @@ export class VideoWatchPage { return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) } - getWatchVideoPlayerCurrentTime () { - return element(by.css('.video-js .vjs-current-time-display')) - .getText() - .then((t: string) => t.split(':')[1]) - .then(seconds => parseInt(seconds, 10)) - } - getVideoName () { return this.getVideoNameElement().getText() } - async playAndPauseVideo (isAutoplay: boolean) { - // Autoplay is disabled on iOS - if (isAutoplay === false || await isIOS()) { - const playButton = element(by.css('.vjs-big-play-button')) - await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) - await playButton.click() - } - - await browserSleep(2000) - await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) - - const videojsEl = element(by.css('div.video-js')) - await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) - - // On Android, we need to click twice on "play" (BrowserStack particularity) - if (await isMobileDevice()) { - await browserSleep(5000) + async goOnAssociatedEmbed () { + let url = await browser.getCurrentUrl() + url = url.replace('/watch/', '/embed/') + url = url.replace(':3333', ':9001') - await videojsEl.click() - } + return browser.get(url) + } - browser.ignoreSynchronization = false - await browserSleep(7000) - browser.ignoreSynchronization = true + async goOnP2PMediaLoaderEmbed () { + return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50') + } - await videojsEl.click() + async goOnP2PMediaLoaderPlaylistEmbed () { + return browser.get('https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a') } async clickOnVideo (videoName: string) { @@ -101,18 +82,6 @@ export class VideoWatchPage { return textToReturn } - async goOnAssociatedEmbed () { - let url = await browser.getCurrentUrl() - url = url.replace('/watch/', '/embed/') - url = url.replace(':3333', ':9001') - - return browser.get(url) - } - - async goOnP2PMediaLoaderEmbed () { - return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50') - } - async clickOnUpdate () { const dropdown = element(by.css('my-video-actions-dropdown .action-button')) await dropdown.click() -- cgit v1.2.3