Skip to content

Commit

Permalink
Fix local e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Oct 27, 2023
1 parent 880f8b9 commit 507467b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/e2e/src/po/login.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
}

Expand Down
3 changes: 2 additions & 1 deletion client/e2e/src/po/my-account.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion client/e2e/src/po/video-search.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions client/e2e/src/po/video-upload.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions client/e2e/src/po/video-watch.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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)

Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -83,4 +83,8 @@ describe('Custom server defaults', () => {
await checkP2P(false)
})
})

after(async () => {
await browser.saveScreenshot(getScreenshotPath('after-test.png'))
})
})
7 changes: 6 additions & 1 deletion client/e2e/src/suites-local/video-password.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -153,6 +153,7 @@ describe('Password protected videos', () => {
})

describe('Regular users', function () {

before(async () => {
await signupPage.fullSignup({
accountInfo: {
Expand Down Expand Up @@ -221,4 +222,8 @@ describe('Password protected videos', () => {
await videoWatchPage.waitUntilVideoName(publicVideoName2, 40 * 1000)
})
})

after(async () => {
await browser.saveScreenshot(getScreenshotPath('after-test.png'))
})
})
9 changes: 9 additions & 0 deletions client/e2e/src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,14 @@ function buildConfig (suiteFile: string = undefined) {
}
}

if (filename === 'video-password.e2e-spec.ts') {
return {
signup: {
enabled: true,
limit: -1
}
}
}

return {}
}

0 comments on commit 507467b

Please sign in to comment.