diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-21 11:24:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-21 14:04:44 +0100 |
commit | 84c7cde6e81426a42e7aa29187b473bc89f1c8f6 (patch) | |
tree | 5c85056f29bc563a6ea29ced4736d4d5cd9851fd /client/e2e/src | |
parent | 1e17071bacc8a78c9145ba602113b1b52dd8fe7b (diff) | |
download | PeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.tar.gz PeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.tar.zst PeerTube-84c7cde6e81426a42e7aa29187b473bc89f1c8f6.zip |
Update E2E tests
Diffstat (limited to 'client/e2e/src')
-rw-r--r-- | client/e2e/src/po/login.po.ts | 6 | ||||
-rw-r--r-- | client/e2e/src/po/video-upload.po.ts | 5 | ||||
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 6 | ||||
-rw-r--r-- | client/e2e/src/videos.e2e-spec.ts | 29 |
4 files changed, 38 insertions, 8 deletions
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts index 40f958d2b..90b65c7ea 100644 --- a/client/e2e/src/po/login.po.ts +++ b/client/e2e/src/po/login.po.ts | |||
@@ -11,6 +11,10 @@ export class LoginPage { | |||
11 | 11 | ||
12 | await element(by.css('form input[type=submit]')).click() | 12 | await element(by.css('form input[type=submit]')).click() |
13 | 13 | ||
14 | return browser.wait(browser.ExpectedConditions.urlContains('/videos/')) | 14 | expect(this.getLoggedInInfo().getText()).toContain('root') |
15 | } | ||
16 | |||
17 | private getLoggedInInfo () { | ||
18 | return element(by.css('.logged-in-display-name')) | ||
15 | } | 19 | } |
16 | } | 20 | } |
diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts index 1978707e3..f79927abc 100644 --- a/client/e2e/src/po/video-upload.po.ts +++ b/client/e2e/src/po/video-upload.po.ts | |||
@@ -14,13 +14,14 @@ export class VideoUploadPage { | |||
14 | 14 | ||
15 | const fileToUpload = join(__dirname, '../../fixtures/video.mp4') | 15 | const fileToUpload = join(__dirname, '../../fixtures/video.mp4') |
16 | const fileInputSelector = '.upload-video-container input[type=file]' | 16 | const fileInputSelector = '.upload-video-container input[type=file]' |
17 | const parentFileInput = '.upload-video .button-file' | 17 | const parentFileInput = '.upload-video-container .button-file' |
18 | 18 | ||
19 | // Avoid sending keys on non visible element | 19 | // Avoid sending keys on non visible element |
20 | await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`) | 20 | await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`) |
21 | // await browser.executeScript(`document.querySelector('${fileInputSelector}').style.opacity = 1`) | ||
22 | await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`) | 21 | await browser.executeScript(`document.querySelector('${parentFileInput}').style.overflow = 'initial'`) |
23 | 22 | ||
23 | await browser.sleep(1000) | ||
24 | |||
24 | const elem = element(by.css(fileInputSelector)) | 25 | const elem = element(by.css(fileInputSelector)) |
25 | await elem.sendKeys(fileToUpload) | 26 | await elem.sendKeys(fileToUpload) |
26 | 27 | ||
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index d1e2a73b8..8369e1486 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts | |||
@@ -44,7 +44,7 @@ export class VideoWatchPage { | |||
44 | .then(seconds => parseInt(seconds, 10)) | 44 | .then(seconds => parseInt(seconds, 10)) |
45 | } | 45 | } |
46 | 46 | ||
47 | async pauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { | 47 | async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { |
48 | if (isAutoplay === false) { | 48 | if (isAutoplay === false) { |
49 | const playButton = element(by.css('.vjs-big-play-button')) | 49 | const playButton = element(by.css('.vjs-big-play-button')) |
50 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) | 50 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) |
@@ -97,4 +97,8 @@ export class VideoWatchPage { | |||
97 | 97 | ||
98 | return browser.get(url) | 98 | return browser.get(url) |
99 | } | 99 | } |
100 | |||
101 | async goOnP2PMediaLoaderEmbed () { | ||
102 | return browser.get('https://peertube2.cpy.re/videos/embed/4b997fc0-e106-42d9-bff9-ae9d64902bbb?mode=p2p-media-loader') | ||
103 | } | ||
100 | } | 104 | } |
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 606b6ac5d..7f8ba71b1 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts | |||
@@ -12,8 +12,6 @@ describe('Videos workflow', () => { | |||
12 | let isSafari = false | 12 | let isSafari = false |
13 | 13 | ||
14 | beforeEach(async () => { | 14 | beforeEach(async () => { |
15 | await browser.waitForAngularEnabled(false) | ||
16 | |||
17 | videoWatchPage = new VideoWatchPage() | 15 | videoWatchPage = new VideoWatchPage() |
18 | pageUploadPage = new VideoUploadPage() | 16 | pageUploadPage = new VideoUploadPage() |
19 | loginPage = new LoginPage() | 17 | loginPage = new LoginPage() |
@@ -21,6 +19,14 @@ describe('Videos workflow', () => { | |||
21 | const caps = await browser.getCapabilities() | 19 | const caps = await browser.getCapabilities() |
22 | isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true | 20 | isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true |
23 | isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari' | 21 | isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari' |
22 | |||
23 | if (isMobileDevice) { | ||
24 | console.log('Mobile device detected.') | ||
25 | } | ||
26 | |||
27 | if (isSafari) { | ||
28 | console.log('Safari detected.') | ||
29 | } | ||
24 | }) | 30 | }) |
25 | 31 | ||
26 | it('Should log in', () => { | 32 | it('Should log in', () => { |
@@ -66,14 +72,29 @@ describe('Videos workflow', () => { | |||
66 | }) | 72 | }) |
67 | 73 | ||
68 | it('Should play the video', async () => { | 74 | it('Should play the video', async () => { |
69 | await videoWatchPage.pauseVideo(!isMobileDevice, isMobileDevice) | 75 | await videoWatchPage.playAndPauseVideo(true, isMobileDevice) |
70 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 76 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
71 | }) | 77 | }) |
72 | 78 | ||
73 | it('Should watch the associated embed video', async () => { | 79 | it('Should watch the associated embed video', async () => { |
80 | await browser.waitForAngularEnabled(false) | ||
81 | |||
74 | await videoWatchPage.goOnAssociatedEmbed() | 82 | await videoWatchPage.goOnAssociatedEmbed() |
75 | 83 | ||
76 | await videoWatchPage.pauseVideo(false, isMobileDevice) | 84 | await videoWatchPage.playAndPauseVideo(false, isMobileDevice) |
77 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 85 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
86 | |||
87 | await browser.waitForAngularEnabled(true) | ||
88 | }) | ||
89 | |||
90 | it('Should watch the p2p media loader embed video', async () => { | ||
91 | await browser.waitForAngularEnabled(false) | ||
92 | |||
93 | await videoWatchPage.goOnP2PMediaLoaderEmbed() | ||
94 | |||
95 | await videoWatchPage.playAndPauseVideo(false, isMobileDevice) | ||
96 | expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | ||
97 | |||
98 | await browser.waitForAngularEnabled(true) | ||
78 | }) | 99 | }) |
79 | }) | 100 | }) |