diff options
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 45 |
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 @@ | |||
1 | import { by, element, browser } from 'protractor' | ||
2 | |||
3 | export 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 | } | ||