aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-12 16:38:55 +0200
committerChocobozzz <me@florianbigard.com>2020-05-12 16:49:35 +0200
commitee68bbc481c154111c60fe80d57565d35bfac46e (patch)
tree64de79b49228feb35af486e2cf755bc7839fe148 /client
parent853c3d533d287d762053e0fa6ecf6bfc3feb0051 (diff)
downloadPeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.tar.gz
PeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.tar.zst
PeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.zip
Unblock ios e2e tests
Diffstat (limited to 'client')
-rw-r--r--client/e2e/fixtures/video.mp4bin619477 -> 1170399 bytes
-rw-r--r--client/e2e/protractor.conf.js79
-rw-r--r--client/e2e/src/po/app.po.ts7
-rw-r--r--client/e2e/src/po/video-watch.po.ts21
-rw-r--r--client/e2e/src/utils.ts30
-rw-r--r--client/e2e/src/videos.e2e-spec.ts33
6 files changed, 97 insertions, 73 deletions
diff --git a/client/e2e/fixtures/video.mp4 b/client/e2e/fixtures/video.mp4
index 23000cfc1..8a634db8e 100644
--- a/client/e2e/fixtures/video.mp4
+++ b/client/e2e/fixtures/video.mp4
Binary files differ
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 5531707e6..b087f70dc 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -12,52 +12,55 @@ 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 'browserstack.console': 'info', 15 'browserstack.console': 'verbose',
16 'browserstack.networkLogs': true,
17 'browserstack.debug': true,
16 project: 'PeerTube', 18 project: 'PeerTube',
19 build: 'Main',
17 name: 'Bstack-[Protractor] Parallel Test' 20 name: 'Bstack-[Protractor] Parallel Test'
18 }, 21 },
19 22
20 multiCapabilities: [ 23 multiCapabilities: [
24 // {
25 // browserName: 'Safari',
26 // version: '11.1',
27 // name: 'Safari Desktop',
28 // resolution: '1280x1024'
29 // },
30 // {
31 // browserName: 'Chrome',
32 // name: 'Latest Chrome Desktop',
33 // resolution: '1280x1024'
34 // },
35 // {
36 // browserName: 'Firefox',
37 // version: '60', // ESR,
38 // name: 'Firefox ESR Desktop',
39 // resolution: '1280x1024'
40 // },
41 // {
42 // browserName: 'Firefox',
43 // name: 'Latest Firefox Desktop',
44 // resolution: '1280x1024'
45 // },
46 // {
47 // browserName: 'Edge',
48 // name: 'Latest Edge Desktop',
49 // resolution: '1280x1024'
50 // },
51 // {
52 // browserName: 'Chrome',
53 // device: 'Google Nexus 6',
54 // realMobile: 'true',
55 // os_version: '5.0',
56 // name: 'Latest Chrome Android'
57 // },
21 { 58 {
22 browserName: 'Safari', 59 browserName: 'Safari',
23 version: '11.1', 60 device: 'iPhone 8',
24 name: 'Safari Desktop',
25 resolution: '1280x1024'
26 },
27 {
28 browserName: 'Chrome',
29 name: 'Latest Chrome Desktop',
30 resolution: '1280x1024'
31 },
32 {
33 browserName: 'Firefox',
34 version: '60', // ESR,
35 name: 'Firefox ESR Desktop',
36 resolution: '1280x1024'
37 },
38 {
39 browserName: 'Firefox',
40 name: 'Latest Firefox Desktop',
41 resolution: '1280x1024'
42 },
43 {
44 browserName: 'Edge',
45 name: 'Latest Edge Desktop',
46 resolution: '1280x1024'
47 },
48 {
49 browserName: 'Chrome',
50 device: 'Google Nexus 6',
51 realMobile: 'true',
52 os_version: '5.0',
53 name: 'Latest Chrome Android'
54 },
55 {
56 browserName: 'Safari',
57 device: 'iPhone SE',
58 realMobile: 'true', 61 realMobile: 'true',
59 os_version: '11.2', 62 os_version: '12',
60 name: 'Latest Safari iPhone' 63 name: 'Safari iPhone'
61 } 64 }
62 ], 65 ],
63 66
diff --git a/client/e2e/src/po/app.po.ts b/client/e2e/src/po/app.po.ts
index a636e825f..4954880ef 100644
--- a/client/e2e/src/po/app.po.ts
+++ b/client/e2e/src/po/app.po.ts
@@ -10,12 +10,5 @@ export class AppPage {
10 await element(by.css('.configure-instance-button')).click() 10 await element(by.css('.configure-instance-button')).click()
11 11
12 await browser.switchTo().window(firstHandle) 12 await browser.switchTo().window(firstHandle)
13
14 await browser.refresh()
15
16 await element(by.css('.form-group-checkbox')).click()
17 await element(by.css('.action-button-cancel')).click()
18
19 await browser.switchTo().window(firstHandle)
20 } 13 }
21} 14}
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index c5e37e6de..bcfceefbc 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,4 +1,5 @@
1import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' 1import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor'
2import { browserSleep } from '../utils'
2 3
3export class VideoWatchPage { 4export class VideoWatchPage {
4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { 5 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
@@ -11,10 +12,10 @@ export class VideoWatchPage {
11 url = '/videos/recently-added' 12 url = '/videos/recently-added'
12 } 13 }
13 14
14 await browser.get(url) 15 await browser.get(url, 20000)
15 16
16 // Waiting the following element does not work on Safari... 17 // Waiting the following element does not work on Safari...
17 if (isSafari) return browser.sleep(3000) 18 if (isSafari) return browserSleep(3000)
18 19
19 const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first() 20 const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
20 return browser.wait(browser.ExpectedConditions.visibilityOf(elem)) 21 return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
@@ -27,13 +28,12 @@ export class VideoWatchPage {
27 } 28 }
28 29
29 waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) { 30 waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) {
31 if (isSafari) return browserSleep(5000)
32
30 // On mobile we display the first node, on desktop the second 33 // On mobile we display the first node, on desktop the second
31 const index = isMobileDevice ? 0 : 1 34 const index = isMobileDevice ? 0 : 1
32 35
33 const elem = element.all(by.css('.video-info .video-info-name')).get(index) 36 const elem = element.all(by.css('.video-info .video-info-name')).get(index)
34
35 if (isSafari) return browser.sleep(5000)
36
37 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) 37 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
38 } 38 }
39 39
@@ -55,7 +55,7 @@ export class VideoWatchPage {
55 await playButton.click() 55 await playButton.click()
56 } 56 }
57 57
58 await browser.sleep(1000) 58 await browserSleep(1000)
59 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 59 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
60 60
61 const videojsEl = element(by.css('div.video-js')) 61 const videojsEl = element(by.css('div.video-js'))
@@ -63,13 +63,16 @@ export class VideoWatchPage {
63 63
64 // On Android, we need to click twice on "play" (BrowserStack particularity) 64 // On Android, we need to click twice on "play" (BrowserStack particularity)
65 if (isMobileDevice) { 65 if (isMobileDevice) {
66 await browser.sleep(3000) 66 await browserSleep(3000)
67
67 await videojsEl.click() 68 await videojsEl.click()
68 } 69 }
69 70
70 await browser.sleep(7000) 71 browser.ignoreSynchronization = false
72 await browserSleep(7000)
73 browser.ignoreSynchronization = true
71 74
72 return videojsEl.click() 75 await videojsEl.click()
73 } 76 }
74 77
75 async clickOnVideo (videoName: string) { 78 async clickOnVideo (videoName: string) {
diff --git a/client/e2e/src/utils.ts b/client/e2e/src/utils.ts
new file mode 100644
index 000000000..e19da6402
--- /dev/null
+++ b/client/e2e/src/utils.ts
@@ -0,0 +1,30 @@
1import { browser } from 'protractor'
2
3async function browserSleep (amount: number) {
4 if (await isIOS()) browser.ignoreSynchronization = false
5
6 await browser.sleep(amount)
7
8 if (await isIOS()) browser.ignoreSynchronization = true
9}
10
11async function isMobileDevice () {
12 const caps = await browser.getCapabilities()
13 return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
14}
15
16async function isSafari () {
17 const caps = await browser.getCapabilities()
18 return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
19}
20
21async function isIOS () {
22 return await isMobileDevice() && await isSafari()
23}
24
25export {
26 isMobileDevice,
27 isSafari,
28 isIOS,
29 browserSleep
30}
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index b2c5ab4c6..0cba8331f 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -1,10 +1,11 @@
1import { VideoWatchPage } from './po/video-watch.po'
2import { VideoUploadPage } from './po/video-upload.po'
3import { LoginPage } from './po/login.po'
4import { browser } from 'protractor' 1import { browser } from 'protractor'
5import { VideoUpdatePage } from './po/video-update.po'
6import { MyAccountPage } from './po/my-account'
7import { AppPage } from './po/app.po' 2import { AppPage } from './po/app.po'
3import { LoginPage } from './po/login.po'
4import { MyAccountPage } from './po/my-account'
5import { VideoUpdatePage } from './po/video-update.po'
6import { VideoUploadPage } from './po/video-upload.po'
7import { VideoWatchPage } from './po/video-watch.po'
8import { isIOS, isMobileDevice, isSafari } from './utils'
8 9
9async function skipIfUploadNotSupported () { 10async function skipIfUploadNotSupported () {
10 if (await isMobileDevice() || await isSafari()) { 11 if (await isMobileDevice() || await isSafari()) {
@@ -15,16 +16,6 @@ async function skipIfUploadNotSupported () {
15 return false 16 return false
16} 17}
17 18
18async function isMobileDevice () {
19 const caps = await browser.getCapabilities()
20 return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
21}
22
23async function isSafari () {
24 const caps = await browser.getCapabilities()
25 return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
26}
27
28describe('Videos workflow', () => { 19describe('Videos workflow', () => {
29 let videoWatchPage: VideoWatchPage 20 let videoWatchPage: VideoWatchPage
30 let videoUploadPage: VideoUploadPage 21 let videoUploadPage: VideoUploadPage
@@ -46,11 +37,15 @@ describe('Videos workflow', () => {
46 loginPage = new LoginPage() 37 loginPage = new LoginPage()
47 appPage = new AppPage() 38 appPage = new AppPage()
48 39
49 if (await isMobileDevice()) { 40 if (await isIOS()) {
50 console.log('Mobile device detected.') 41 // iOS does not seem to work with protractor
51 } 42 // https://github.com/angular/protractor/issues/2840
43 browser.ignoreSynchronization = true
52 44
53 if (await isSafari()) { 45 console.log('iOS detected')
46 } else if (await isMobileDevice()) {
47 console.log('Android detected.')
48 } else if (await isSafari()) {
54 console.log('Safari detected.') 49 console.log('Safari detected.')
55 } 50 }
56 51