aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/video-watch.po.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-17 10:55:01 +0200
committerChocobozzz <me@florianbigard.com>2018-05-17 15:20:21 +0200
commit5f92c4dc5f08094548be9d23080dd3ca75741c65 (patch)
treea5fd5e2e7f46b28817733afc3cd1a3afcdab0c3a /client/e2e/src/po/video-watch.po.ts
parent74af5a8361f4ccb460001706ce249d50c747f361 (diff)
downloadPeerTube-5f92c4dc5f08094548be9d23080dd3ca75741c65.tar.gz
PeerTube-5f92c4dc5f08094548be9d23080dd3ca75741c65.tar.zst
PeerTube-5f92c4dc5f08094548be9d23080dd3ca75741c65.zip
Add videos e2e tests
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r--client/e2e/src/po/video-watch.po.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
new file mode 100644
index 000000000..266c9850c
--- /dev/null
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -0,0 +1,45 @@
1import { by, element, browser } from 'protractor'
2
3export class VideoWatchPage {
4 async goOnRecentlyAdded () {
5 const url = '/videos/recently-added'
6
7 await browser.get(url)
8 return browser.wait(browser.ExpectedConditions.elementToBeClickable(element(this.getFirstVideoListSelector())))
9 }
10
11 getVideosListName () {
12 return element.all(this.getFirstVideoListSelector()).getText()
13 }
14
15 waitWatchVideoName (videoName: string) {
16 const elem = element(by.css('.video-info .video-info-name'))
17 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
18 }
19
20 getWatchVideoPlayerCurrentTime () {
21 return element(by.css('.video-js .vjs-current-time-display'))
22 .getText()
23 .then((t: string) => t.split(':')[1])
24 .then(seconds => parseInt(seconds, 10))
25 }
26
27 async pauseVideo () {
28 const el = element(by.css('video'))
29 await browser.wait(browser.ExpectedConditions.elementToBeClickable(el))
30
31 return el.click()
32 }
33
34 async clickOnFirstVideoOfList () {
35 const video = element(by.css('.videos .video-miniature:first-child .video-thumbnail'))
36
37 await video.click()
38
39 await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
40 }
41
42 private getFirstVideoListSelector () {
43 return by.css('.videos .video-miniature-name')
44 }
45}