aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r--client/e2e/src/po/video-upload.po.ts16
-rw-r--r--client/e2e/src/po/video-watch.po.ts49
2 files changed, 40 insertions, 25 deletions
diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts
index 1ac696107..1978707e3 100644
--- a/client/e2e/src/po/video-upload.po.ts
+++ b/client/e2e/src/po/video-upload.po.ts
@@ -3,16 +3,26 @@ import { FileDetector } from 'selenium-webdriver/remote'
3import { join } from 'path' 3import { join } from 'path'
4 4
5export class VideoUploadPage { 5export class VideoUploadPage {
6 navigateTo () { 6 async navigateTo () {
7 return browser.get('/videos/upload') 7 await element(by.css('.header .upload-button')).click()
8
9 return browser.wait(browser.ExpectedConditions.visibilityOf(element(by.css('.upload-video-container'))))
8 } 10 }
9 11
10 async uploadVideo () { 12 async uploadVideo () {
11 browser.setFileDetector(new FileDetector()) 13 browser.setFileDetector(new FileDetector())
12 14
13 const fileToUpload = join(__dirname, '../../fixtures/video.mp4') 15 const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
16 const fileInputSelector = '.upload-video-container input[type=file]'
17 const parentFileInput = '.upload-video .button-file'
18
19 // Avoid sending keys on non visible element
20 await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
21 // await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`)
22 await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`)
14 23
15 await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload) 24 const elem = element(by.css(fileInputSelector))
25 await elem.sendKeys(fileToUpload)
16 26
17 // Wait for the upload to finish 27 // Wait for the upload to finish
18 await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton())) 28 await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton()))
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 0f37e3e33..19d02ff51 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,7 +1,7 @@
1import { by, element, browser } from 'protractor' 1import { by, element, browser } from 'protractor'
2 2
3export class VideoWatchPage { 3export class VideoWatchPage {
4 async goOnVideosList (isIphoneDevice: boolean) { 4 async goOnVideosList (isIphoneDevice: boolean, isSafari: boolean) {
5 let url: string 5 let url: string
6 6
7 if (isIphoneDevice === true) { 7 if (isIphoneDevice === true) {
@@ -12,11 +12,16 @@ export class VideoWatchPage {
12 } 12 }
13 13
14 await browser.get(url) 14 await browser.get(url)
15 return browser.wait(browser.ExpectedConditions.elementToBeClickable(element(this.getFirstVideoListSelector()))) 15
16 // Waiting the following element does not work on Safari...
17 if (isSafari === true) return browser.sleep(3000)
18
19 const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
20 return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
16 } 21 }
17 22
18 getVideosListName () { 23 getVideosListName () {
19 return element.all(this.getFirstVideoListSelector()) 24 return element.all(by.css('.videos .video-miniature .video-miniature-name'))
20 .getText() 25 .getText()
21 .then((texts: any) => texts.map(t => t.trim())) 26 .then((texts: any) => texts.map(t => t.trim()))
22 } 27 }
@@ -33,19 +38,19 @@ export class VideoWatchPage {
33 .then(seconds => parseInt(seconds, 10)) 38 .then(seconds => parseInt(seconds, 10))
34 } 39 }
35 40
36 async pauseVideo (pauseAfterMs: number, isMobileDevice: boolean, isIphoneDevice: boolean) { 41 async pauseVideo (pauseAfterMs: number, isAutoplay: boolean, isSafari: boolean) {
37 if (isMobileDevice === true) { 42 if (isAutoplay === false) {
38 if (isIphoneDevice === false) { 43 const playButton = element(by.css('.vjs-big-play-button'))
39 const playButton = element(by.css('.vjs-big-play-button')) 44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
40 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 45 await playButton.click()
41 await playButton.click() 46 }
42 } else { 47
43 const playButton = element(by.css('video')) 48 if (isSafari === true) {
44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 49 await browser.sleep(1000)
45 await playButton.click() 50 await element(by.css('.vjs-play-control')).click()
46 }
47 } 51 }
48 52
53 await browser.sleep(1000)
49 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 54 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
50 55
51 const el = element(by.css('div.video-js')) 56 const el = element(by.css('div.video-js'))
@@ -53,11 +58,7 @@ export class VideoWatchPage {
53 58
54 await browser.sleep(pauseAfterMs) 59 await browser.sleep(pauseAfterMs)
55 60
56 if (isIphoneDevice === true) { 61 return el.click()
57 // document.webkitCancelFullScreen()
58 } else {
59 return el.click()
60 }
61 } 62 }
62 63
63 async clickOnVideo (videoName: string) { 64 async clickOnVideo (videoName: string) {
@@ -69,7 +70,7 @@ export class VideoWatchPage {
69 } 70 }
70 71
71 async clickOnFirstVideo () { 72 async clickOnFirstVideo () {
72 const video = element(by.css('.videos .video-miniature:first-child .video-miniature-name')) 73 const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
73 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video)) 74 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
74 const textToReturn = video.getText() 75 const textToReturn = video.getText()
75 76
@@ -79,7 +80,11 @@ export class VideoWatchPage {
79 return textToReturn 80 return textToReturn
80 } 81 }
81 82
82 private getFirstVideoListSelector () { 83 async goOnAssociatedEmbed () {
83 return by.css('.videos .video-miniature-name') 84 let url = await browser.getCurrentUrl()
85 url = url.replace('/watch/', '/embed/')
86 url = url.replace(':3333', ':9001')
87
88 return browser.get(url)
84 } 89 }
85} 90}