diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-13 10:15:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-05-13 10:15:31 +0200 |
commit | 0845e480d25a644661cb4e0eed366719289ebc37 (patch) | |
tree | a7c0669a7c511a9c9000734d15ec9f6810be4869 | |
parent | 943fddfbbe5b3c04620b230d606bfd0f8a58f3ff (diff) | |
download | PeerTube-0845e480d25a644661cb4e0eed366719289ebc37.tar.gz PeerTube-0845e480d25a644661cb4e0eed366719289ebc37.tar.zst PeerTube-0845e480d25a644661cb4e0eed366719289ebc37.zip |
Cleanup E2E tests
-rw-r--r-- | client/e2e/protractor.conf.js | 68 | ||||
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 13 | ||||
-rw-r--r-- | client/e2e/src/videos.e2e-spec.ts | 6 |
3 files changed, 44 insertions, 43 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js index b087f70dc..3797961ff 100644 --- a/client/e2e/protractor.conf.js +++ b/client/e2e/protractor.conf.js | |||
@@ -21,40 +21,40 @@ exports.config = { | |||
21 | }, | 21 | }, |
22 | 22 | ||
23 | multiCapabilities: [ | 23 | multiCapabilities: [ |
24 | // { | 24 | { |
25 | // browserName: 'Safari', | 25 | browserName: 'Safari', |
26 | // version: '11.1', | 26 | version: '11.1', |
27 | // name: 'Safari Desktop', | 27 | name: 'Safari Desktop', |
28 | // resolution: '1280x1024' | 28 | resolution: '1280x1024' |
29 | // }, | 29 | }, |
30 | // { | 30 | { |
31 | // browserName: 'Chrome', | 31 | browserName: 'Chrome', |
32 | // name: 'Latest Chrome Desktop', | 32 | name: 'Latest Chrome Desktop', |
33 | // resolution: '1280x1024' | 33 | resolution: '1280x1024' |
34 | // }, | 34 | }, |
35 | // { | 35 | { |
36 | // browserName: 'Firefox', | 36 | browserName: 'Firefox', |
37 | // version: '60', // ESR, | 37 | version: '60', // ESR, |
38 | // name: 'Firefox ESR Desktop', | 38 | name: 'Firefox ESR Desktop', |
39 | // resolution: '1280x1024' | 39 | resolution: '1280x1024' |
40 | // }, | 40 | }, |
41 | // { | 41 | { |
42 | // browserName: 'Firefox', | 42 | browserName: 'Firefox', |
43 | // name: 'Latest Firefox Desktop', | 43 | name: 'Latest Firefox Desktop', |
44 | // resolution: '1280x1024' | 44 | resolution: '1280x1024' |
45 | // }, | 45 | }, |
46 | // { | 46 | { |
47 | // browserName: 'Edge', | 47 | browserName: 'Edge', |
48 | // name: 'Latest Edge Desktop', | 48 | name: 'Latest Edge Desktop', |
49 | // resolution: '1280x1024' | 49 | resolution: '1280x1024' |
50 | // }, | 50 | }, |
51 | // { | 51 | { |
52 | // browserName: 'Chrome', | 52 | browserName: 'Chrome', |
53 | // device: 'Google Nexus 6', | 53 | device: 'Google Nexus 6', |
54 | // realMobile: 'true', | 54 | realMobile: 'true', |
55 | // os_version: '5.0', | 55 | os_version: '5.0', |
56 | // name: 'Latest Chrome Android' | 56 | name: 'Latest Chrome Android' |
57 | // }, | 57 | }, |
58 | { | 58 | { |
59 | browserName: 'Safari', | 59 | browserName: 'Safari', |
60 | device: 'iPhone 8', | 60 | device: 'iPhone 8', |
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index bcfceefbc..35ec773af 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' | 1 | import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' |
2 | import { browserSleep } from '../utils' | 2 | import { browserSleep, isIOS, isMobileDevice } from '../utils' |
3 | 3 | ||
4 | export class VideoWatchPage { | 4 | export class VideoWatchPage { |
5 | async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { | 5 | async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { |
@@ -48,22 +48,23 @@ export class VideoWatchPage { | |||
48 | return this.getVideoNameElement().getText() | 48 | return this.getVideoNameElement().getText() |
49 | } | 49 | } |
50 | 50 | ||
51 | async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { | 51 | async playAndPauseVideo (isAutoplay: boolean) { |
52 | if (isAutoplay === false) { | 52 | // Autoplay is disabled on iOS |
53 | if (isAutoplay === false || await isIOS()) { | ||
53 | const playButton = element(by.css('.vjs-big-play-button')) | 54 | const playButton = element(by.css('.vjs-big-play-button')) |
54 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) | 55 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) |
55 | await playButton.click() | 56 | await playButton.click() |
56 | } | 57 | } |
57 | 58 | ||
58 | await browserSleep(1000) | 59 | await browserSleep(2000) |
59 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) | 60 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) |
60 | 61 | ||
61 | const videojsEl = element(by.css('div.video-js')) | 62 | const videojsEl = element(by.css('div.video-js')) |
62 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) | 63 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) |
63 | 64 | ||
64 | // On Android, we need to click twice on "play" (BrowserStack particularity) | 65 | // On Android, we need to click twice on "play" (BrowserStack particularity) |
65 | if (isMobileDevice) { | 66 | if (await isMobileDevice()) { |
66 | await browserSleep(3000) | 67 | await browserSleep(5000) |
67 | 68 | ||
68 | await videojsEl.click() | 69 | await videojsEl.click() |
69 | } | 70 | } |
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 0cba8331f..bbc5f7da3 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts | |||
@@ -99,7 +99,7 @@ describe('Videos workflow', () => { | |||
99 | it('Should play the video', async () => { | 99 | it('Should play the video', async () => { |
100 | videoWatchUrl = await browser.getCurrentUrl() | 100 | videoWatchUrl = await browser.getCurrentUrl() |
101 | 101 | ||
102 | await videoWatchPage.playAndPauseVideo(true, await isMobileDevice()) | 102 | await videoWatchPage.playAndPauseVideo(true) |
103 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 103 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
104 | }) | 104 | }) |
105 | 105 | ||
@@ -108,7 +108,7 @@ describe('Videos workflow', () => { | |||
108 | 108 | ||
109 | await videoWatchPage.goOnAssociatedEmbed() | 109 | await videoWatchPage.goOnAssociatedEmbed() |
110 | 110 | ||
111 | await videoWatchPage.playAndPauseVideo(false, await isMobileDevice()) | 111 | await videoWatchPage.playAndPauseVideo(false) |
112 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 112 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
113 | 113 | ||
114 | await browser.waitForAngularEnabled(true) | 114 | await browser.waitForAngularEnabled(true) |
@@ -119,7 +119,7 @@ describe('Videos workflow', () => { | |||
119 | 119 | ||
120 | await videoWatchPage.goOnP2PMediaLoaderEmbed() | 120 | await videoWatchPage.goOnP2PMediaLoaderEmbed() |
121 | 121 | ||
122 | await videoWatchPage.playAndPauseVideo(false, await isMobileDevice()) | 122 | await videoWatchPage.playAndPauseVideo(false) |
123 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 123 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
124 | 124 | ||
125 | await browser.waitForAngularEnabled(true) | 125 | await browser.waitForAngularEnabled(true) |