aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po
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
parentcd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86 (diff)
downloadPeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.gz
PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.zst
PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.zip
Improve e2e tests
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r--client/e2e/src/po/app.po.ts12
-rw-r--r--client/e2e/src/po/login.po.ts6
-rw-r--r--client/e2e/src/po/video-upload.po.ts4
-rw-r--r--client/e2e/src/po/video-watch.po.ts46
4 files changed, 47 insertions, 21 deletions
diff --git a/client/e2e/src/po/app.po.ts b/client/e2e/src/po/app.po.ts
deleted file mode 100644
index e3e293d7b..000000000
--- a/client/e2e/src/po/app.po.ts
+++ /dev/null
@@ -1,12 +0,0 @@
1import { browser, by, element } from 'protractor'
2
3export class AppPage {
4 navigateTo () {
5 browser.waitForAngularEnabled(false)
6 return browser.get('/')
7 }
8
9 getHeaderTitle () {
10 return element(by.css('.instance-name')).getText()
11 }
12}
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index 5a36fd611..40f958d2b 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -4,8 +4,10 @@ export class LoginPage {
4 async loginAsRootUser () { 4 async loginAsRootUser () {
5 await browser.get('/login') 5 await browser.get('/login')
6 6
7 await element(by.css('input#username')).sendKeys('root') 7 element(by.css('input#username')).sendKeys('root')
8 await element(by.css('input#password')).sendKeys('test1') 8 element(by.css('input#password')).sendKeys('test1')
9
10 await browser.sleep(1000)
9 11
10 await element(by.css('form input[type=submit]')).click() 12 await element(by.css('form input[type=submit]')).click()
11 13
diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts
index 741914d2d..1ac696107 100644
--- a/client/e2e/src/po/video-upload.po.ts
+++ b/client/e2e/src/po/video-upload.po.ts
@@ -1,6 +1,6 @@
1import { browser, element, by } from 'protractor' 1import { browser, by, element } from 'protractor'
2import { join } from 'path'
3import { FileDetector } from 'selenium-webdriver/remote' 2import { FileDetector } from 'selenium-webdriver/remote'
3import { join } from 'path'
4 4
5export class VideoUploadPage { 5export class VideoUploadPage {
6 navigateTo () { 6 navigateTo () {
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 () {