diff options
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r-- | client/e2e/src/po/player.po.ts | 54 | ||||
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 55 |
2 files changed, 66 insertions, 43 deletions
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 @@ | |||
1 | import { browser, by, element, ExpectedConditions } from 'protractor' | ||
2 | import { browserSleep, isIOS, isMobileDevice } from '../utils' | ||
3 | |||
4 | export class PlayerPage { | ||
5 | |||
6 | getWatchVideoPlayerCurrentTime () { | ||
7 | return element(by.css('.video-js .vjs-current-time-display')) | ||
8 | .getText() | ||
9 | .then((t: string) => t.split(':')[1]) | ||
10 | .then(seconds => parseInt(seconds, 10)) | ||
11 | } | ||
12 | |||
13 | waitUntilPlaylistInfo (text: string) { | ||
14 | const elem = element(by.css('.video-js .vjs-playlist-info')) | ||
15 | |||
16 | return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, text)) | ||
17 | } | ||
18 | |||
19 | async playAndPauseVideo (isAutoplay: boolean) { | ||
20 | // Autoplay is disabled on iOS | ||
21 | if (isAutoplay === false || await isIOS()) { | ||
22 | await this.clickOnPlayButton() | ||
23 | } | ||
24 | |||
25 | await browserSleep(2000) | ||
26 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) | ||
27 | |||
28 | const videojsEl = element(by.css('div.video-js')) | ||
29 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) | ||
30 | |||
31 | // On Android, we need to click twice on "play" (BrowserStack particularity) | ||
32 | if (await isMobileDevice()) { | ||
33 | await browserSleep(5000) | ||
34 | |||
35 | await videojsEl.click() | ||
36 | } | ||
37 | |||
38 | browser.ignoreSynchronization = false | ||
39 | await browserSleep(7000) | ||
40 | browser.ignoreSynchronization = true | ||
41 | |||
42 | await videojsEl.click() | ||
43 | } | ||
44 | |||
45 | async playVideo () { | ||
46 | return this.clickOnPlayButton() | ||
47 | } | ||
48 | |||
49 | private async clickOnPlayButton () { | ||
50 | const playButton = element(by.css('.vjs-big-play-button')) | ||
51 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) | ||
52 | await playButton.click() | ||
53 | } | ||
54 | } | ||
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 @@ | |||
1 | import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' | 1 | import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' |
2 | import { browserSleep, isIOS, isMobileDevice } from '../utils' | 2 | import { browserSleep, isMobileDevice } from '../utils' |
3 | 3 | ||
4 | export class VideoWatchPage { | 4 | export class VideoWatchPage { |
5 | async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { | 5 | async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { |
@@ -37,43 +37,24 @@ export class VideoWatchPage { | |||
37 | return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) | 37 | return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) |
38 | } | 38 | } |
39 | 39 | ||
40 | getWatchVideoPlayerCurrentTime () { | ||
41 | return element(by.css('.video-js .vjs-current-time-display')) | ||
42 | .getText() | ||
43 | .then((t: string) => t.split(':')[1]) | ||
44 | .then(seconds => parseInt(seconds, 10)) | ||
45 | } | ||
46 | |||
47 | getVideoName () { | 40 | getVideoName () { |
48 | return this.getVideoNameElement().getText() | 41 | return this.getVideoNameElement().getText() |
49 | } | 42 | } |
50 | 43 | ||
51 | async playAndPauseVideo (isAutoplay: boolean) { | 44 | async goOnAssociatedEmbed () { |
52 | // Autoplay is disabled on iOS | 45 | let url = await browser.getCurrentUrl() |
53 | if (isAutoplay === false || await isIOS()) { | 46 | url = url.replace('/watch/', '/embed/') |
54 | const playButton = element(by.css('.vjs-big-play-button')) | 47 | url = url.replace(':3333', ':9001') |
55 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) | ||
56 | await playButton.click() | ||
57 | } | ||
58 | |||
59 | await browserSleep(2000) | ||
60 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) | ||
61 | |||
62 | const videojsEl = element(by.css('div.video-js')) | ||
63 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) | ||
64 | |||
65 | // On Android, we need to click twice on "play" (BrowserStack particularity) | ||
66 | if (await isMobileDevice()) { | ||
67 | await browserSleep(5000) | ||
68 | 48 | ||
69 | await videojsEl.click() | 49 | return browser.get(url) |
70 | } | 50 | } |
71 | 51 | ||
72 | browser.ignoreSynchronization = false | 52 | async goOnP2PMediaLoaderEmbed () { |
73 | await browserSleep(7000) | 53 | return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50') |
74 | browser.ignoreSynchronization = true | 54 | } |
75 | 55 | ||
76 | await videojsEl.click() | 56 | async goOnP2PMediaLoaderPlaylistEmbed () { |
57 | return browser.get('https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a') | ||
77 | } | 58 | } |
78 | 59 | ||
79 | async clickOnVideo (videoName: string) { | 60 | async clickOnVideo (videoName: string) { |
@@ -101,18 +82,6 @@ export class VideoWatchPage { | |||
101 | return textToReturn | 82 | return textToReturn |
102 | } | 83 | } |
103 | 84 | ||
104 | async goOnAssociatedEmbed () { | ||
105 | let url = await browser.getCurrentUrl() | ||
106 | url = url.replace('/watch/', '/embed/') | ||
107 | url = url.replace(':3333', ':9001') | ||
108 | |||
109 | return browser.get(url) | ||
110 | } | ||
111 | |||
112 | async goOnP2PMediaLoaderEmbed () { | ||
113 | return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50') | ||
114 | } | ||
115 | |||
116 | async clickOnUpdate () { | 85 | async clickOnUpdate () { |
117 | const dropdown = element(by.css('my-video-actions-dropdown .action-button')) | 86 | const dropdown = element(by.css('my-video-actions-dropdown .action-button')) |
118 | await dropdown.click() | 87 | await dropdown.click() |