aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/player.po.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-07 10:25:07 +0200
committerChocobozzz <me@florianbigard.com>2020-08-07 11:12:59 +0200
commit7f90579c04383ca883083548f40782352605d778 (patch)
tree7abeba248d6621b2df324c4def4271b9469288ee /client/e2e/src/po/player.po.ts
parent5ab7fd9da92463ade6b31d49bdc0f559174b4c57 (diff)
downloadPeerTube-7f90579c04383ca883083548f40782352605d778.tar.gz
PeerTube-7f90579c04383ca883083548f40782352605d778.tar.zst
PeerTube-7f90579c04383ca883083548f40782352605d778.zip
Add playlist embed E2E test
Diffstat (limited to 'client/e2e/src/po/player.po.ts')
-rw-r--r--client/e2e/src/po/player.po.ts54
1 files changed, 54 insertions, 0 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 @@
1import { browser, by, element, ExpectedConditions } from 'protractor'
2import { browserSleep, isIOS, isMobileDevice } from '../utils'
3
4export 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}