diff options
Diffstat (limited to 'client/e2e/src')
-rw-r--r-- | client/e2e/src/po/player.po.ts | 19 | ||||
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 9 | ||||
-rw-r--r-- | client/e2e/src/urls.ts | 10 | ||||
-rw-r--r-- | client/e2e/src/videos.e2e-spec.ts | 9 |
4 files changed, 26 insertions, 21 deletions
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 { | |||
5 | getWatchVideoPlayerCurrentTime () { | 5 | getWatchVideoPlayerCurrentTime () { |
6 | const elem = $('video') | 6 | const elem = $('video') |
7 | 7 | ||
8 | if (isIOS()) { | 8 | const p = isIOS() |
9 | return elem.getAttribute('currentTime') | 9 | ? elem.getAttribute('currentTime') |
10 | .then(t => parseInt(t, 10)) | 10 | : elem.getProperty('currentTime') |
11 | .then(t => Math.round(t)) | ||
12 | } | ||
13 | 11 | ||
14 | return elem.getProperty('currentTime') | 12 | return p.then(t => parseInt(t + '', 10)) |
13 | .then(t => Math.ceil(t)) | ||
15 | } | 14 | } |
16 | 15 | ||
17 | waitUntilPlaylistInfo (text: string, maxTime: number) { | 16 | waitUntilPlaylistInfo (text: string, maxTime: number) { |
@@ -26,7 +25,7 @@ export class PlayerPage { | |||
26 | }) | 25 | }) |
27 | } | 26 | } |
28 | 27 | ||
29 | async playAndPauseVideo (isAutoplay: boolean) { | 28 | async playAndPauseVideo (isAutoplay: boolean, waitUntilSec: number) { |
30 | const videojsElem = () => $('div.video-js') | 29 | const videojsElem = () => $('div.video-js') |
31 | 30 | ||
32 | await videojsElem().waitForExist() | 31 | await videojsElem().waitForExist() |
@@ -43,10 +42,8 @@ export class PlayerPage { | |||
43 | await browserSleep(2000) | 42 | await browserSleep(2000) |
44 | 43 | ||
45 | await browser.waitUntil(async () => { | 44 | await browser.waitUntil(async () => { |
46 | return !await $('.vjs-loading-spinner').isDisplayedInViewport() | 45 | return (await this.getWatchVideoPlayerCurrentTime()) >= 2 |
47 | }, { timeout: 20 * 1000 }) | 46 | }) |
48 | |||
49 | await browserSleep(4000) | ||
50 | 47 | ||
51 | await videojsElem().click() | 48 | await videojsElem().click() |
52 | } | 49 | } |
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 @@ | |||
1 | import { FIXTURE_URLS } from '../urls' | ||
1 | import { browserSleep, go } from '../utils' | 2 | import { browserSleep, go } from '../utils' |
2 | 3 | ||
3 | export class VideoWatchPage { | 4 | export class VideoWatchPage { |
@@ -50,15 +51,11 @@ export class VideoWatchPage { | |||
50 | } | 51 | } |
51 | 52 | ||
52 | goOnP2PMediaLoaderEmbed () { | 53 | goOnP2PMediaLoaderEmbed () { |
53 | return go( | 54 | return go(FIXTURE_URLS.HLS_EMBED) |
54 | 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50' | ||
55 | ) | ||
56 | } | 55 | } |
57 | 56 | ||
58 | goOnP2PMediaLoaderPlaylistEmbed () { | 57 | goOnP2PMediaLoaderPlaylistEmbed () { |
59 | return go( | 58 | return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED) |
60 | 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a' | ||
61 | ) | ||
62 | } | 59 | } |
63 | 60 | ||
64 | async clickOnVideo (videoName: string) { | 61 | async clickOnVideo (videoName: string) { |
diff --git a/client/e2e/src/urls.ts b/client/e2e/src/urls.ts new file mode 100644 index 000000000..664c65931 --- /dev/null +++ b/client/e2e/src/urls.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | const FIXTURE_URLS = { | ||
2 | WEBTORRENT_VIDEO: 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e', | ||
3 | |||
4 | HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50', | ||
5 | HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a' | ||
6 | } | ||
7 | |||
8 | export { | ||
9 | FIXTURE_URLS | ||
10 | } | ||
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 7f7c814e1..e09e8c675 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts | |||
@@ -4,6 +4,7 @@ import { PlayerPage } from './po/player.po' | |||
4 | import { VideoUpdatePage } from './po/video-update.po' | 4 | import { VideoUpdatePage } from './po/video-update.po' |
5 | import { VideoUploadPage } from './po/video-upload.po' | 5 | import { VideoUploadPage } from './po/video-upload.po' |
6 | import { VideoWatchPage } from './po/video-watch.po' | 6 | import { VideoWatchPage } from './po/video-watch.po' |
7 | import { FIXTURE_URLS } from './urls' | ||
7 | import { browserSleep, go, isIOS, isMobileDevice, isSafari } from './utils' | 8 | import { browserSleep, go, isIOS, isMobileDevice, isSafari } from './utils' |
8 | 9 | ||
9 | function isUploadUnsupported () { | 10 | function isUploadUnsupported () { |
@@ -91,7 +92,7 @@ describe('Videos workflow', () => { | |||
91 | let videoNameToExcept = videoName | 92 | let videoNameToExcept = videoName |
92 | 93 | ||
93 | if (isMobileDevice() || isSafari()) { | 94 | if (isMobileDevice() || isSafari()) { |
94 | await go('https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e') | 95 | await go(FIXTURE_URLS.WEBTORRENT_VIDEO) |
95 | videoNameToExcept = 'E2E tests' | 96 | videoNameToExcept = 'E2E tests' |
96 | } else { | 97 | } else { |
97 | await videoWatchPage.clickOnVideo(videoName) | 98 | await videoWatchPage.clickOnVideo(videoName) |
@@ -103,21 +104,21 @@ describe('Videos workflow', () => { | |||
103 | it('Should play the video', async () => { | 104 | it('Should play the video', async () => { |
104 | videoWatchUrl = await browser.getUrl() | 105 | videoWatchUrl = await browser.getUrl() |
105 | 106 | ||
106 | await playerPage.playAndPauseVideo(true) | 107 | await playerPage.playAndPauseVideo(true, 2) |
107 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 108 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
108 | }) | 109 | }) |
109 | 110 | ||
110 | it('Should watch the associated embed video', async () => { | 111 | it('Should watch the associated embed video', async () => { |
111 | await videoWatchPage.goOnAssociatedEmbed() | 112 | await videoWatchPage.goOnAssociatedEmbed() |
112 | 113 | ||
113 | await playerPage.playAndPauseVideo(false) | 114 | await playerPage.playAndPauseVideo(false, 2) |
114 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 115 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
115 | }) | 116 | }) |
116 | 117 | ||
117 | it('Should watch the p2p media loader embed video', async () => { | 118 | it('Should watch the p2p media loader embed video', async () => { |
118 | await videoWatchPage.goOnP2PMediaLoaderEmbed() | 119 | await videoWatchPage.goOnP2PMediaLoaderEmbed() |
119 | 120 | ||
120 | await playerPage.playAndPauseVideo(false) | 121 | await playerPage.playAndPauseVideo(false, 2) |
121 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 122 | expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
122 | }) | 123 | }) |
123 | 124 | ||