From 12d6b873cd4c5eb8c4fd298885e0c7fa6deb3756 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 2 Sep 2021 08:57:59 +0200 Subject: Improve e2e workflow and add doc --- client/e2e/src/po/player.po.ts | 19 ++++++++----------- client/e2e/src/po/video-watch.po.ts | 9 +++------ 2 files changed, 11 insertions(+), 17 deletions(-) (limited to 'client/e2e/src/po') diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts index 9d6e21009..372e8ab20 100644 --- a/client/e2e/src/po/player.po.ts +++ b/client/e2e/src/po/player.po.ts @@ -5,13 +5,12 @@ export class PlayerPage { getWatchVideoPlayerCurrentTime () { const elem = $('video') - if (isIOS()) { - return elem.getAttribute('currentTime') - .then(t => parseInt(t, 10)) - .then(t => Math.round(t)) - } + const p = isIOS() + ? elem.getAttribute('currentTime') + : elem.getProperty('currentTime') - return elem.getProperty('currentTime') + return p.then(t => parseInt(t + '', 10)) + .then(t => Math.ceil(t)) } waitUntilPlaylistInfo (text: string, maxTime: number) { @@ -26,7 +25,7 @@ export class PlayerPage { }) } - async playAndPauseVideo (isAutoplay: boolean) { + async playAndPauseVideo (isAutoplay: boolean, waitUntilSec: number) { const videojsElem = () => $('div.video-js') await videojsElem().waitForExist() @@ -43,10 +42,8 @@ export class PlayerPage { await browserSleep(2000) await browser.waitUntil(async () => { - return !await $('.vjs-loading-spinner').isDisplayedInViewport() - }, { timeout: 20 * 1000 }) - - await browserSleep(4000) + return (await this.getWatchVideoPlayerCurrentTime()) >= 2 + }) await videojsElem().click() } diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index 01061d5d4..c07f4b25f 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts @@ -1,3 +1,4 @@ +import { FIXTURE_URLS } from '../urls' import { browserSleep, go } from '../utils' export class VideoWatchPage { @@ -50,15 +51,11 @@ export class VideoWatchPage { } goOnP2PMediaLoaderEmbed () { - return go( - 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50' - ) + return go(FIXTURE_URLS.HLS_EMBED) } goOnP2PMediaLoaderPlaylistEmbed () { - return go( - 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a' - ) + return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED) } async clickOnVideo (videoName: string) { -- cgit v1.2.3