diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-19 13:58:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-22 09:17:21 +0200 |
commit | 0b33c5206023de0946b247e767087a518e0dec9a (patch) | |
tree | 69bebf7db9271c54938ce9457b43eff15222e243 /client/e2e/src/videos.e2e-spec.ts | |
parent | cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86 (diff) | |
download | PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.gz PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.tar.zst PeerTube-0b33c5206023de0946b247e767087a518e0dec9a.zip |
Improve e2e tests
Diffstat (limited to 'client/e2e/src/videos.e2e-spec.ts')
-rw-r--r-- | client/e2e/src/videos.e2e-spec.ts | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 82cea72b1..c21bc163e 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts | |||
@@ -8,18 +8,36 @@ describe('Videos workflow', () => { | |||
8 | let pageUploadPage: VideoUploadPage | 8 | let pageUploadPage: VideoUploadPage |
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 | ||
12 | let isIphoneDevice = false | ||
13 | |||
14 | beforeEach(async () => { | ||
15 | browser.waitForAngularEnabled(false) | ||
11 | 16 | ||
12 | beforeEach(() => { | ||
13 | videoWatchPage = new VideoWatchPage() | 17 | videoWatchPage = new VideoWatchPage() |
14 | pageUploadPage = new VideoUploadPage() | 18 | pageUploadPage = new VideoUploadPage() |
15 | loginPage = new LoginPage() | 19 | loginPage = new LoginPage() |
20 | |||
21 | const caps = await browser.getCapabilities() | ||
22 | isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true | ||
23 | isIphoneDevice = caps.get('device') === 'iphone' | ||
16 | }) | 24 | }) |
17 | 25 | ||
18 | it('Should log in', () => { | 26 | it('Should log in', () => { |
27 | if (isMobileDevice) { | ||
28 | console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') | ||
29 | return | ||
30 | } | ||
31 | |||
19 | return loginPage.loginAsRootUser() | 32 | return loginPage.loginAsRootUser() |
20 | }) | 33 | }) |
21 | 34 | ||
22 | it('Should upload a video', async () => { | 35 | it('Should upload a video', async () => { |
36 | if (isMobileDevice) { | ||
37 | console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') | ||
38 | return | ||
39 | } | ||
40 | |||
23 | pageUploadPage.navigateTo() | 41 | pageUploadPage.navigateTo() |
24 | 42 | ||
25 | await pageUploadPage.uploadVideo() | 43 | await pageUploadPage.uploadVideo() |
@@ -27,20 +45,30 @@ describe('Videos workflow', () => { | |||
27 | }) | 45 | }) |
28 | 46 | ||
29 | it('Should list the video', async () => { | 47 | it('Should list the video', async () => { |
30 | await videoWatchPage.goOnRecentlyAdded() | 48 | await videoWatchPage.goOnVideosList(isIphoneDevice) |
49 | |||
50 | if (isMobileDevice) { | ||
51 | console.log('Skipping because we are on a real device and BrowserStack does not support file upload.') | ||
52 | return | ||
53 | } | ||
31 | 54 | ||
32 | const videoNames = videoWatchPage.getVideosListName() | 55 | const videoNames = videoWatchPage.getVideosListName() |
33 | expect(videoNames).toContain(videoName) | 56 | expect(videoNames).toContain(videoName) |
34 | }) | 57 | }) |
35 | 58 | ||
36 | it('Should go on video watch page', async () => { | 59 | it('Should go on video watch page', async () => { |
37 | await videoWatchPage.clickOnVideo(videoName) | 60 | let videoNameToExcept = videoName |
61 | |||
62 | if (isMobileDevice && isIphoneDevice) videoNameToExcept = 'PeerTube_Mobile.v.1' | ||
63 | |||
64 | if (isMobileDevice && isIphoneDevice === false) videoNameToExcept = await videoWatchPage.clickOnFirstVideo() | ||
65 | else await videoWatchPage.clickOnVideo(videoName) | ||
38 | 66 | ||
39 | return videoWatchPage.waitWatchVideoName(videoName) | 67 | return videoWatchPage.waitWatchVideoName(videoNameToExcept) |
40 | }) | 68 | }) |
41 | 69 | ||
42 | it('Should play the video', async () => { | 70 | it('Should play the video', async () => { |
43 | await videoWatchPage.pauseVideo(2500) | 71 | await videoWatchPage.pauseVideo(7000, isMobileDevice, isIphoneDevice) |
44 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 72 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
45 | }) | 73 | }) |
46 | }) | 74 | }) |