aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e')
-rw-r--r--client/e2e/protractor.conf.js5
-rw-r--r--client/e2e/src/po/video-watch.po.ts36
-rw-r--r--client/e2e/src/videos.e2e-spec.ts24
3 files changed, 34 insertions, 31 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 5dcd77284..60b0ad904 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -12,7 +12,7 @@ exports.config = {
12 'browserstack.user': process.env.BROWSERSTACK_USER, 12 'browserstack.user': process.env.BROWSERSTACK_USER,
13 'browserstack.key': process.env.BROWSERSTACK_KEY, 13 'browserstack.key': process.env.BROWSERSTACK_KEY,
14 'browserstack.local': true, 14 'browserstack.local': true,
15 projec: 'PeerTube' 15 project: 'PeerTube'
16 }, 16 },
17 17
18 multiCapabilities: [ 18 multiCapabilities: [
@@ -22,8 +22,7 @@ exports.config = {
22 }, 22 },
23 { 23 {
24 browserName: 'Safari', 24 browserName: 'Safari',
25 version: '11.1', 25 version: '11.1'
26 resolution: '1920x1080'
27 }, 26 },
28 { 27 {
29 browserName: 'Firefox', 28 browserName: 'Firefox',
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 19d02ff51..ec3d16c3b 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,11 +1,11 @@
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, isSafari: boolean) { 4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
5 let url: string 5 let url: string
6 6
7 if (isIphoneDevice === true) { 7 // We did not upload a file on a mobile device
8 // Local testing is buggy :/ 8 if (isMobileDevice === true || isSafari === true) {
9 url = 'https://peertube2.cpy.re/videos/local' 9 url = 'https://peertube2.cpy.re/videos/local'
10 } else { 10 } else {
11 url = '/videos/recently-added' 11 url = '/videos/recently-added'
@@ -26,8 +26,11 @@ export class VideoWatchPage {
26 .then((texts: any) => texts.map(t => t.trim())) 26 .then((texts: any) => texts.map(t => t.trim()))
27 } 27 }
28 28
29 waitWatchVideoName (videoName: string) { 29 waitWatchVideoName (videoName: string, isSafari: boolean) {
30 const elem = element(by.css('.video-info .video-info-name')) 30 const elem = element(by.css('.video-info .video-info-name'))
31
32 if (isSafari) return browser.sleep(5000)
33
31 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) 34 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
32 } 35 }
33 36
@@ -38,27 +41,27 @@ export class VideoWatchPage {
38 .then(seconds => parseInt(seconds, 10)) 41 .then(seconds => parseInt(seconds, 10))
39 } 42 }
40 43
41 async pauseVideo (pauseAfterMs: number, isAutoplay: boolean, isSafari: boolean) { 44 async pauseVideo (isAutoplay: boolean, isDesktopSafari: boolean) {
42 if (isAutoplay === false) { 45 if (isAutoplay === false) {
43 const playButton = element(by.css('.vjs-big-play-button')) 46 const playButton = element(by.css('.vjs-big-play-button'))
44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 47 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
45 await playButton.click() 48 await playButton.click()
46 } 49 }
47 50
48 if (isSafari === true) { 51 // if (isDesktopSafari === true) {
49 await browser.sleep(1000) 52 // await browser.sleep(1000)
50 await element(by.css('.vjs-play-control')).click() 53 // await element(by.css('.vjs-play-control')).click()
51 } 54 // }
52 55
53 await browser.sleep(1000) 56 await browser.sleep(1000)
54 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 57 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
55 58
56 const el = element(by.css('div.video-js')) 59 const videojsEl = element(by.css('div.video-js'))
57 await browser.wait(browser.ExpectedConditions.elementToBeClickable(el)) 60 await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
58 61
59 await browser.sleep(pauseAfterMs) 62 await browser.sleep(7000)
60 63
61 return el.click() 64 return videojsEl.click()
62 } 65 }
63 66
64 async clickOnVideo (videoName: string) { 67 async clickOnVideo (videoName: string) {
@@ -70,10 +73,13 @@ export class VideoWatchPage {
70 } 73 }
71 74
72 async clickOnFirstVideo () { 75 async clickOnFirstVideo () {
73 const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first() 76 const video = element.all(by.css('.videos .video-miniature .video-thumbnail')).first()
77 const videoName = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
78
79 // Don't know why but the expectation fails on Safari
74 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video)) 80 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
75 const textToReturn = video.getText()
76 81
82 const textToReturn = videoName.getText()
77 await video.click() 83 await video.click()
78 84
79 await browser.wait(browser.ExpectedConditions.urlContains('/watch/')) 85 await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index f216f8dd1..16fe6b70d 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -9,7 +9,6 @@ describe('Videos workflow', () => {
9 let loginPage: LoginPage 9 let loginPage: LoginPage
10 const videoName = new Date().getTime() + ' video' 10 const videoName = new Date().getTime() + ' video'
11 let isMobileDevice = false 11 let isMobileDevice = false
12 let isIphoneDevice = false
13 let isSafari = false 12 let isSafari = false
14 13
15 beforeEach(async () => { 14 beforeEach(async () => {
@@ -21,13 +20,12 @@ describe('Videos workflow', () => {
21 20
22 const caps = await browser.getCapabilities() 21 const caps = await browser.getCapabilities()
23 isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true 22 isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true
24 isIphoneDevice = caps.get('device') === 'iphone'
25 isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari' 23 isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
26 }) 24 })
27 25
28 it('Should log in', () => { 26 it('Should log in', () => {
29 if (isMobileDevice) { 27 if (isMobileDevice || isSafari) {
30 console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') 28 console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
31 return 29 return
32 } 30 }
33 31
@@ -35,8 +33,8 @@ describe('Videos workflow', () => {
35 }) 33 })
36 34
37 it('Should upload a video', async () => { 35 it('Should upload a video', async () => {
38 if (isMobileDevice) { 36 if (isMobileDevice || isSafari) {
39 console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') 37 console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
40 return 38 return
41 } 39 }
42 40
@@ -47,10 +45,10 @@ describe('Videos workflow', () => {
47 }) 45 })
48 46
49 it('Should list the video', async () => { 47 it('Should list the video', async () => {
50 await videoWatchPage.goOnVideosList(isIphoneDevice, isSafari) 48 await videoWatchPage.goOnVideosList(isMobileDevice, isSafari)
51 49
52 if (isMobileDevice) { 50 if (isMobileDevice || isSafari) {
53 console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') 51 console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
54 return 52 return
55 } 53 }
56 54
@@ -61,21 +59,21 @@ describe('Videos workflow', () => {
61 it('Should go on video watch page', async () => { 59 it('Should go on video watch page', async () => {
62 let videoNameToExcept = videoName 60 let videoNameToExcept = videoName
63 61
64 if (isMobileDevice) videoNameToExcept = await videoWatchPage.clickOnFirstVideo() 62 if (isMobileDevice || isSafari) videoNameToExcept = await videoWatchPage.clickOnFirstVideo()
65 else await videoWatchPage.clickOnVideo(videoName) 63 else await videoWatchPage.clickOnVideo(videoName)
66 64
67 return videoWatchPage.waitWatchVideoName(videoNameToExcept) 65 return videoWatchPage.waitWatchVideoName(videoNameToExcept, isSafari)
68 }) 66 })
69 67
70 it('Should play the video', async () => { 68 it('Should play the video', async () => {
71 await videoWatchPage.pauseVideo(7000, !isMobileDevice, isSafari) 69 await videoWatchPage.pauseVideo(!isMobileDevice, isSafari && isMobileDevice === false)
72 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) 70 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
73 }) 71 })
74 72
75 it('Should watch the associated embed video', async () => { 73 it('Should watch the associated embed video', async () => {
76 await videoWatchPage.goOnAssociatedEmbed() 74 await videoWatchPage.goOnAssociatedEmbed()
77 75
78 await videoWatchPage.pauseVideo(7000, false, isSafari) 76 await videoWatchPage.pauseVideo(false, isSafari && isMobileDevice === false)
79 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) 77 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
80 }) 78 })
81}) 79})