From cd4d7a2ca868209fb1e2dbd790c1e5d6cca77e86 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 18 May 2018 11:02:40 +0200 Subject: Fix peertube with google bot --- client/e2e/src/po/login.po.ts | 4 ++-- client/e2e/src/po/video-watch.po.ts | 12 ++++++++---- client/e2e/src/videos.e2e-spec.ts | 6 ++---- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'client/e2e/src') diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts index ada52cb24..5a36fd611 100644 --- a/client/e2e/src/po/login.po.ts +++ b/client/e2e/src/po/login.po.ts @@ -4,8 +4,8 @@ export class LoginPage { async loginAsRootUser () { await browser.get('/login') - element(by.css('input#username')).sendKeys('root') - element(by.css('input#password')).sendKeys('test1') + await element(by.css('input#username')).sendKeys('root') + await element(by.css('input#password')).sendKeys('test1') await element(by.css('form input[type=submit]')).click() diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index 266c9850c..b5df1cbc5 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts @@ -24,15 +24,19 @@ export class VideoWatchPage { .then(seconds => parseInt(seconds, 10)) } - async pauseVideo () { - const el = element(by.css('video')) + async pauseVideo (pauseAfterMs: number) { + await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) + + const el = element(by.css('div.video-js')) await browser.wait(browser.ExpectedConditions.elementToBeClickable(el)) + await browser.sleep(pauseAfterMs) + return el.click() } - async clickOnFirstVideoOfList () { - const video = element(by.css('.videos .video-miniature:first-child .video-thumbnail')) + async clickOnVideo (videoName: string) { + const video = element(by.css('.videos .video-miniature .video-thumbnail[title="' + videoName + '"]')) await video.click() diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index 4205fd7a4..82cea72b1 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts @@ -34,15 +34,13 @@ describe('Videos workflow', () => { }) it('Should go on video watch page', async () => { - await videoWatchPage.clickOnFirstVideoOfList() + await videoWatchPage.clickOnVideo(videoName) return videoWatchPage.waitWatchVideoName(videoName) }) it('Should play the video', async () => { - await browser.sleep(4000) - - await videoWatchPage.pauseVideo() + await videoWatchPage.pauseVideo(2500) expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) }) }) -- cgit v1.2.3