aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/video-watch.po.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-19 13:58:29 +0200
committerChocobozzz <me@florianbigard.com>2018-05-22 09:17:21 +0200
commit0b33c5206023de0946b247e767087a518e0dec9a (patch)
tree69bebf7db9271c54938ce9457b43eff15222e243 /client/e2e/src/po/video-watch.po.ts
parentcd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86 (diff)
downloadPeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.gz
PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.zst
PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.zip
Improve e2e tests
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r--client/e2e/src/po/video-watch.po.ts46
1 files changed, 41 insertions, 5 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index b5df1cbc5..0f37e3e33 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,15 +1,24 @@
1import { by, element, browser } from 'protractor' 1import { by, element, browser } from 'protractor'
2 2
3export class VideoWatchPage { 3export class VideoWatchPage {
4 async goOnRecentlyAdded () { 4 async goOnVideosList (isIphoneDevice: boolean) {
5 const url = '/videos/recently-added' 5 let url: string
6
7 if (isIphoneDevice === true) {
8 // Local testing is buggy :/
9 url = 'https://peertube2.cpy.re/videos/local'
10 } else {
11 url = '/videos/recently-added'
12 }
6 13
7 await browser.get(url) 14 await browser.get(url)
8 return browser.wait(browser.ExpectedConditions.elementToBeClickable(element(this.getFirstVideoListSelector()))) 15 return browser.wait(browser.ExpectedConditions.elementToBeClickable(element(this.getFirstVideoListSelector())))
9 } 16 }
10 17
11 getVideosListName () { 18 getVideosListName () {
12 return element.all(this.getFirstVideoListSelector()).getText() 19 return element.all(this.getFirstVideoListSelector())
20 .getText()
21 .then((texts: any) => texts.map(t => t.trim()))
13 } 22 }
14 23
15 waitWatchVideoName (videoName: string) { 24 waitWatchVideoName (videoName: string) {
@@ -24,7 +33,19 @@ export class VideoWatchPage {
24 .then(seconds => parseInt(seconds, 10)) 33 .then(seconds => parseInt(seconds, 10))
25 } 34 }
26 35
27 async pauseVideo (pauseAfterMs: number) { 36 async pauseVideo (pauseAfterMs: number, isMobileDevice: boolean, isIphoneDevice: boolean) {
37 if (isMobileDevice === true) {
38 if (isIphoneDevice === false) {
39 const playButton = element(by.css('.vjs-big-play-button'))
40 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
41 await playButton.click()
42 } else {
43 const playButton = element(by.css('video'))
44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
45 await playButton.click()
46 }
47 }
48
28 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 49 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
29 50
30 const el = element(by.css('div.video-js')) 51 const el = element(by.css('div.video-js'))
@@ -32,15 +53,30 @@ export class VideoWatchPage {
32 53
33 await browser.sleep(pauseAfterMs) 54 await browser.sleep(pauseAfterMs)
34 55
35 return el.click() 56 if (isIphoneDevice === true) {
57 // document.webkitCancelFullScreen()
58 } else {
59 return el.click()
60 }
36 } 61 }
37 62
38 async clickOnVideo (videoName: string) { 63 async clickOnVideo (videoName: string) {
39 const video = element(by.css('.videos .video-miniature .video-thumbnail[title="' + videoName + '"]')) 64 const video = element(by.css('.videos .video-miniature .video-thumbnail[title="' + videoName + '"]'))
65 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
66 await video.click()
67
68 await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
69 }
70
71 async clickOnFirstVideo () {
72 const video = element(by.css('.videos .video-miniature:first-child .video-miniature-name'))
73 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
74 const textToReturn = video.getText()
40 75
41 await video.click() 76 await video.click()
42 77
43 await browser.wait(browser.ExpectedConditions.urlContains('/watch/')) 78 await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
79 return textToReturn
44 } 80 }
45 81
46 private getFirstVideoListSelector () { 82 private getFirstVideoListSelector () {