aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e')
-rw-r--r--client/e2e/protractor.conf.js36
-rw-r--r--client/e2e/src/po/login.po.ts4
-rw-r--r--client/e2e/src/po/video-watch.po.ts12
-rw-r--r--client/e2e/src/videos.e2e-spec.ts6
4 files changed, 46 insertions, 12 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 82daa435e..7b5f8de43 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -10,14 +10,42 @@ exports.config = {
10 ], 10 ],
11 11
12 seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub', 12 seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',
13 capabilities: { 13 commonCapabilities: {
14 'browserstack.user': process.env.BROWSERSTACK_USER, 14 'browserstack.user': process.env.BROWSERSTACK_USER,
15 'browserstack.key': process.env.BROWSERSTACK_KEY, 15 'browserstack.key': process.env.BROWSERSTACK_KEY,
16 'browserName': 'chrome',
17 'browserstack.local': true, 16 'browserstack.local': true,
18 'project': 'PeerTube' 17 'project': 'PeerTube'
19 }, 18 },
20 19
20 multiCapabilities: [
21 {
22 browserName: 'Chrome',
23 version: '66'
24 },
25 {
26 browserName: 'Chrome',
27 version: '66',
28 os: 'android',
29
30 },
31 {
32 browserName: 'Safari',
33 version: '11.1'
34 },
35 {
36 browserName: 'Firefox',
37 version: '52' // ESR
38 },
39 {
40 browserName: 'Firefox',
41 version: '60'
42 },
43 {
44 browserName: 'Edge',
45 version: '17'
46 }
47 ],
48
21 maxSessions: 1, 49 maxSessions: 1,
22 baseUrl: 'http://localhost:4200/', 50 baseUrl: 'http://localhost:4200/',
23 framework: 'jasmine', 51 framework: 'jasmine',
@@ -34,3 +62,7 @@ exports.config = {
34 jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}})) 62 jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}))
35 } 63 }
36} 64}
65
66exports.config.multiCapabilities.forEach(function (caps) {
67 for (var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i]
68})
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index ada52cb24..5a36fd611 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -4,8 +4,8 @@ export class LoginPage {
4 async loginAsRootUser () { 4 async loginAsRootUser () {
5 await browser.get('/login') 5 await browser.get('/login')
6 6
7 element(by.css('input#username')).sendKeys('root') 7 await element(by.css('input#username')).sendKeys('root')
8 element(by.css('input#password')).sendKeys('test1') 8 await element(by.css('input#password')).sendKeys('test1')
9 9
10 await element(by.css('form input[type=submit]')).click() 10 await element(by.css('form input[type=submit]')).click()
11 11
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 266c9850c..b5df1cbc5 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -24,15 +24,19 @@ export class VideoWatchPage {
24 .then(seconds => parseInt(seconds, 10)) 24 .then(seconds => parseInt(seconds, 10))
25 } 25 }
26 26
27 async pauseVideo () { 27 async pauseVideo (pauseAfterMs: number) {
28 const el = element(by.css('video')) 28 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
29
30 const el = element(by.css('div.video-js'))
29 await browser.wait(browser.ExpectedConditions.elementToBeClickable(el)) 31 await browser.wait(browser.ExpectedConditions.elementToBeClickable(el))
30 32
33 await browser.sleep(pauseAfterMs)
34
31 return el.click() 35 return el.click()
32 } 36 }
33 37
34 async clickOnFirstVideoOfList () { 38 async clickOnVideo (videoName: string) {
35 const video = element(by.css('.videos .video-miniature:first-child .video-thumbnail')) 39 const video = element(by.css('.videos .video-miniature .video-thumbnail[title="' + videoName + '"]'))
36 40
37 await video.click() 41 await video.click()
38 42
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index 4205fd7a4..82cea72b1 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -34,15 +34,13 @@ describe('Videos workflow', () => {
34 }) 34 })
35 35
36 it('Should go on video watch page', async () => { 36 it('Should go on video watch page', async () => {
37 await videoWatchPage.clickOnFirstVideoOfList() 37 await videoWatchPage.clickOnVideo(videoName)
38 38
39 return videoWatchPage.waitWatchVideoName(videoName) 39 return videoWatchPage.waitWatchVideoName(videoName)
40 }) 40 })
41 41
42 it('Should play the video', async () => { 42 it('Should play the video', async () => {
43 await browser.sleep(4000) 43 await videoWatchPage.pauseVideo(2500)
44
45 await videoWatchPage.pauseVideo()
46 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) 44 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
47 }) 45 })
48}) 46})