From 507467b6a6a89edaab0205f08f04cc744f6aafc7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Oct 2023 16:53:41 +0200 Subject: [PATCH] Fix local e2e tests --- client/e2e/src/po/login.po.ts | 2 +- client/e2e/src/po/my-account.po.ts | 3 ++- client/e2e/src/po/video-search.po.ts | 2 +- client/e2e/src/po/video-upload.po.ts | 1 + client/e2e/src/po/video-watch.po.ts | 15 +++++++++------ .../custom-server-defaults.e2e-spec.ts | 6 +++++- .../src/suites-local/video-password.e2e-spec.ts | 7 ++++++- client/e2e/src/utils/hooks.ts | 9 +++++++++ 8 files changed, 34 insertions(+), 11 deletions(-) diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts index 67cd8e5e5fb..d989dd86119 100644 --- a/client/e2e/src/po/login.po.ts +++ b/client/e2e/src/po/login.po.ts @@ -87,7 +87,7 @@ export class LoginPage { await logout.click() await browser.waitUntil(() => { - return $('.login-buttons-block, my-error-page a[href="/login"]').isDisplayed() + return $$('.login-buttons-block, my-error-page a[href="/login"]').some(e => e.isDisplayed()) }) } diff --git a/client/e2e/src/po/my-account.po.ts b/client/e2e/src/po/my-account.po.ts index 73eb6162c91..743e3094f5c 100644 --- a/client/e2e/src/po/my-account.po.ts +++ b/client/e2e/src/po/my-account.po.ts @@ -128,7 +128,8 @@ export class MyAccountPage { await selectCustomSelect('privacy', privacy) const submit = await $('form input[type=submit]') - submit.waitForClickable() + await submit.waitForClickable() + await submit.scrollIntoView() await submit.click() return browser.waitUntil(async () => { diff --git a/client/e2e/src/po/video-search.po.ts b/client/e2e/src/po/video-search.po.ts index 5446718d1cb..5bad2fa6c05 100644 --- a/client/e2e/src/po/video-search.po.ts +++ b/client/e2e/src/po/video-search.po.ts @@ -2,7 +2,7 @@ export class VideoSearchPage { async search (search: string) { await $('#search-video').setValue(search) - await $('my-header .icon-search').click() + await $('.search-button').click() await browser.waitUntil(() => { return $('my-video-miniature').isDisplayed() diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts index ff3841a0286..2ea692ec990 100644 --- a/client/e2e/src/po/video-upload.po.ts +++ b/client/e2e/src/po/video-upload.po.ts @@ -68,6 +68,7 @@ export class VideoUploadPage { selectCustomSelect('privacy', 'Password protected') const videoPasswordInput = $('input#videoPassword') + await videoPasswordInput.waitForClickable() await videoPasswordInput.clearValue() return videoPasswordInput.setValue(videoPassword) diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index 76ac58e4825..67081fe4a1e 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts @@ -151,13 +151,13 @@ export class VideoWatchPage { } async fillVideoPassword (videoPassword: string) { - const videoPasswordInput = $('input#confirmInput') - const confirmButton = await $('input[value="Confirm"]') - + const videoPasswordInput = await $('input#confirmInput') + await videoPasswordInput.waitForClickable() await videoPasswordInput.clearValue() await videoPasswordInput.setValue(videoPassword) - await confirmButton.waitForClickable() + const confirmButton = await $('input[value="Confirm"]') + await confirmButton.waitForClickable() return confirmButton.click() } @@ -188,6 +188,7 @@ export class VideoWatchPage { async createThread (comment: string) { const textarea = await $('my-video-comment-add textarea') + await textarea.waitForClickable() await textarea.setValue(comment) @@ -202,10 +203,12 @@ export class VideoWatchPage { async createReply (comment: string) { const replyButton = await $('button.comment-action-reply') - + await replyButton.waitForClickable() + await replyButton.scrollIntoView() await replyButton.click() - const textarea = await $('my-video-comment my-video-comment-add textarea') + const textarea = await $('my-video-comment my-video-comment-add textarea') + await textarea.waitForClickable() await textarea.setValue(comment) const confirmButton = await $('my-video-comment .comment-buttons .orange-button') diff --git a/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts b/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts index 71840d7073b..4d5f4400165 100644 --- a/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts +++ b/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts @@ -1,7 +1,7 @@ import { LoginPage } from '../po/login.po' import { VideoUploadPage } from '../po/video-upload.po' import { VideoWatchPage } from '../po/video-watch.po' -import { go, isMobileDevice, isSafari, waitServerUp } from '../utils' +import { getScreenshotPath, go, isMobileDevice, isSafari, waitServerUp } from '../utils' describe('Custom server defaults', () => { let videoUploadPage: VideoUploadPage @@ -83,4 +83,8 @@ describe('Custom server defaults', () => { await checkP2P(false) }) }) + + after(async () => { + await browser.saveScreenshot(getScreenshotPath('after-test.png')) + }) }) diff --git a/client/e2e/src/suites-local/video-password.e2e-spec.ts b/client/e2e/src/suites-local/video-password.e2e-spec.ts index cd1b1d48efe..3683b387a00 100644 --- a/client/e2e/src/suites-local/video-password.e2e-spec.ts +++ b/client/e2e/src/suites-local/video-password.e2e-spec.ts @@ -3,7 +3,7 @@ import { SignupPage } from '../po/signup.po' import { PlayerPage } from '../po/player.po' import { VideoUploadPage } from '../po/video-upload.po' import { VideoWatchPage } from '../po/video-watch.po' -import { go, isMobileDevice, isSafari, waitServerUp } from '../utils' +import { getScreenshotPath, go, isMobileDevice, isSafari, waitServerUp } from '../utils' import { MyAccountPage } from '../po/my-account.po' describe('Password protected videos', () => { @@ -153,6 +153,7 @@ describe('Password protected videos', () => { }) describe('Regular users', function () { + before(async () => { await signupPage.fullSignup({ accountInfo: { @@ -221,4 +222,8 @@ describe('Password protected videos', () => { await videoWatchPage.waitUntilVideoName(publicVideoName2, 40 * 1000) }) }) + + after(async () => { + await browser.saveScreenshot(getScreenshotPath('after-test.png')) + }) }) diff --git a/client/e2e/src/utils/hooks.ts b/client/e2e/src/utils/hooks.ts index 1daff5fcceb..05a32916caf 100644 --- a/client/e2e/src/utils/hooks.ts +++ b/client/e2e/src/utils/hooks.ts @@ -93,5 +93,14 @@ function buildConfig (suiteFile: string = undefined) { } } + if (filename === 'video-password.e2e-spec.ts') { + return { + signup: { + enabled: true, + limit: -1 + } + } + } + return {} }