From 6b88559babc1e0490119a6b52411b10910d9da9d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 30 Nov 2020 09:11:12 +0100 Subject: [PATCH] Fix local e2e tests --- client/e2e/src/po/my-account.ts | 11 +++++++++-- client/e2e/src/po/player.po.ts | 6 ++++++ client/e2e/src/po/video-upload.po.ts | 2 +- client/e2e/src/videos.e2e-spec.ts | 2 ++ client/src/app/app.component.ts | 2 +- scripts/e2e/local.sh | 1 + 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts index a39e5cc58..0255cee16 100644 --- a/client/e2e/src/po/my-account.ts +++ b/client/e2e/src/po/my-account.ts @@ -16,8 +16,15 @@ export class MyAccountPage { // My account Videos - removeVideo (name: string) { - return this.getVideoElement(name).element(by.css('my-delete-button')).click() + async removeVideo (name: string) { + const container = this.getVideoElement(name) + + await container.element(by.css('.dropdown-toggle')).click() + + const dropdownMenu = container.element(by.css('.dropdown-menu .dropdown-item:nth-child(2)')) + await browser.wait(browser.ExpectedConditions.presenceOf(dropdownMenu)) + + return dropdownMenu.click() } validRemove () { diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts index d18d81f16..1bba11171 100644 --- a/client/e2e/src/po/player.po.ts +++ b/client/e2e/src/po/player.po.ts @@ -16,6 +16,12 @@ export class PlayerPage { return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, text)) } + waitUntilPlayerWrapper () { + const elem = element(by.css('#video-wrapper')) + + return browser.wait(browser.ExpectedConditions.presenceOf(elem)) + } + async playAndPauseVideo (isAutoplay: boolean) { const videojsEl = element(by.css('div.video-js')) await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts index 9eb1e31c1..7de715a95 100644 --- a/client/e2e/src/po/video-upload.po.ts +++ b/client/e2e/src/po/video-upload.po.ts @@ -4,7 +4,7 @@ import { join } from 'path' export class VideoUploadPage { async navigateTo () { - await element(by.css('.header .upload-button')).click() + await element(by.css('.header .publish-button')).click() return browser.wait(browser.ExpectedConditions.visibilityOf(element(by.css('.upload-video-container')))) } diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index d9d2cb9b9..a73b9f318 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts @@ -206,6 +206,8 @@ describe('Videos workflow', () => { await myAccountPage.goOnAssociatedPlaylistEmbed() + await playerPage.waitUntilPlayerWrapper() + await browser.executeScript(`window.localStorage.setItem('access_token', '${accessToken}');`) await browser.executeScript(`window.localStorage.setItem('refresh_token', '${refreshToken}');`) await browser.executeScript(`window.localStorage.setItem('token_type', 'Bearer');`) diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index c5cb54ddd..75f4bdfe6 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,6 +1,6 @@ import { Hotkey, HotkeysService } from 'angular2-hotkeys' import { concat } from 'rxjs' -import { filter, first, map, pairwise, tap } from 'rxjs/operators' +import { filter, first, map, pairwise } from 'rxjs/operators' import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' import { DomSanitizer, SafeHtml } from '@angular/platform-browser' diff --git a/scripts/e2e/local.sh b/scripts/e2e/local.sh index 40efa3525..0e74707d8 100755 --- a/scripts/e2e/local.sh +++ b/scripts/e2e/local.sh @@ -6,6 +6,7 @@ npm run clean:server:test ( cd client + npm run webdriver-manager -- update npm run webpack -- --config webpack/webpack.video-embed.js --mode development ) -- 2.41.0