Fix local e2e tests

This commit is contained in:
Chocobozzz 2023-10-27 16:53:41 +02:00
parent 880f8b924d
commit 507467b6a6
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
8 changed files with 34 additions and 11 deletions

View File

@ -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())
})
}

View File

@ -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 () => {

View File

@ -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()

View File

@ -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)

View File

@ -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')

View File

@ -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'))
})
})

View File

@ -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'))
})
})

View File

@ -93,5 +93,14 @@ function buildConfig (suiteFile: string = undefined) {
}
}
if (filename === 'video-password.e2e-spec.ts') {
return {
signup: {
enabled: true,
limit: -1
}
}
}
return {}
}