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/app.po.ts12
-rw-r--r--client/e2e/src/po/login.po.ts14
-rw-r--r--client/e2e/src/po/video-upload.po.ts31
-rw-r--r--client/e2e/src/po/video-watch.po.ts45
4 files changed, 102 insertions, 0 deletions
diff --git a/client/e2e/src/po/app.po.ts b/client/e2e/src/po/app.po.ts
new file mode 100644
index 000000000..e3e293d7b
--- /dev/null
+++ b/client/e2e/src/po/app.po.ts
@@ -0,0 +1,12 @@
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
new file mode 100644
index 000000000..ada52cb24
--- /dev/null
+++ b/client/e2e/src/po/login.po.ts
@@ -0,0 +1,14 @@
1import { browser, element, by } from 'protractor'
2
3export class LoginPage {
4 async loginAsRootUser () {
5 await browser.get('/login')
6
7 element(by.css('input#username')).sendKeys('root')
8 element(by.css('input#password')).sendKeys('test1')
9
10 await element(by.css('form input[type=submit]')).click()
11
12 return browser.wait(browser.ExpectedConditions.urlContains('/videos/'))
13 }
14}
diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts
new file mode 100644
index 000000000..4f09bb2fa
--- /dev/null
+++ b/client/e2e/src/po/video-upload.po.ts
@@ -0,0 +1,31 @@
1import { browser, element, by } from 'protractor'
2import { join } from 'path'
3
4export class VideoUploadPage {
5 navigateTo () {
6 return browser.get('/videos/upload')
7 }
8
9 async uploadVideo () {
10 const fileToUpload = join(__dirname, '../../fixtures/video.mp4')
11
12 await element(by.css('.upload-video-container input[type=file]')).sendKeys(fileToUpload)
13
14 // Wait for the upload to finish
15 await browser.wait(browser.ExpectedConditions.elementToBeClickable(this.getSecondStepSubmitButton()))
16 }
17
18 async validSecondUploadStep (videoName: string) {
19 const nameInput = element(by.css('input#name'))
20 await nameInput.clear()
21 await nameInput.sendKeys(videoName)
22
23 await this.getSecondStepSubmitButton().click()
24
25 return browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
26 }
27
28 private getSecondStepSubmitButton () {
29 return element(by.css('.submit-button:not(.disabled) input'))
30 }
31}
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}