aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-28 11:19:54 +0200
committerChocobozzz <me@florianbigard.com>2022-10-28 15:22:40 +0200
commit814e9e07ba65446af8446dbbd2f0d70c85fd1b33 (patch)
tree9c1f130d4a773208c5bdf33ec942be060e3c3ad2 /client/e2e/src/po
parent672e185bf3004b46552c227483ffd2802ebf6844 (diff)
downloadPeerTube-814e9e07ba65446af8446dbbd2f0d70c85fd1b33.tar.gz
PeerTube-814e9e07ba65446af8446dbbd2f0d70c85fd1b33.tar.zst
PeerTube-814e9e07ba65446af8446dbbd2f0d70c85fd1b33.zip
Improve E2E tests
Add tests for private video static endpoints Fix tests for local firefox
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r--client/e2e/src/po/admin-config.po.ts14
-rw-r--r--client/e2e/src/po/login.po.ts50
-rw-r--r--client/e2e/src/po/my-account.po.ts4
-rw-r--r--client/e2e/src/po/signup.po.ts3
-rw-r--r--client/e2e/src/po/video-upload.po.ts10
-rw-r--r--client/e2e/src/po/video-watch.po.ts6
6 files changed, 70 insertions, 17 deletions
diff --git a/client/e2e/src/po/admin-config.po.ts b/client/e2e/src/po/admin-config.po.ts
index 6d48a0fd7..27957a71f 100644
--- a/client/e2e/src/po/admin-config.po.ts
+++ b/client/e2e/src/po/admin-config.po.ts
@@ -14,8 +14,14 @@ export class AdminConfigPage {
14 await $('.inner-form-title=' + waitTitles[tab]).waitForDisplayed() 14 await $('.inner-form-title=' + waitTitles[tab]).waitForDisplayed()
15 } 15 }
16 16
17 updateNSFWSetting (newValue: 'do_not_list' | 'blur' | 'display') { 17 async updateNSFWSetting (newValue: 'do_not_list' | 'blur' | 'display') {
18 return $('#instanceDefaultNSFWPolicy').selectByAttribute('value', newValue) 18 const elem = $('#instanceDefaultNSFWPolicy')
19
20 await elem.waitForDisplayed()
21 await elem.scrollIntoView(false) // Avoid issues with fixed header on firefox
22 await elem.waitForClickable()
23
24 return elem.selectByAttribute('value', newValue)
19 } 25 }
20 26
21 updateHomepage (newValue: string) { 27 updateHomepage (newValue: string) {
@@ -24,11 +30,15 @@ export class AdminConfigPage {
24 30
25 async toggleSignup () { 31 async toggleSignup () {
26 const checkbox = await getCheckbox('signupEnabled') 32 const checkbox = await getCheckbox('signupEnabled')
33
34 await checkbox.waitForClickable()
27 await checkbox.click() 35 await checkbox.click()
28 } 36 }
29 37
30 async save () { 38 async save () {
31 const button = $('input[type=submit]') 39 const button = $('input[type=submit]')
40
41 await button.waitForClickable()
32 await button.click() 42 await button.click()
33 } 43 }
34} 44}
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index 2c4561b7d..91bf46e30 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -2,31 +2,61 @@ import { go } from '../utils'
2 2
3export class LoginPage { 3export class LoginPage {
4 4
5 async loginAsRootUser () { 5 constructor (private isMobileDevice: boolean) {
6 await go('/login') 6
7 }
8
9 async login (username: string, password: string, url = '/login') {
10 await go(url)
7 11
12 await browser.execute(`window.localStorage.setItem('no_account_setup_warning_modal', 'true')`)
8 await browser.execute(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`) 13 await browser.execute(`window.localStorage.setItem('no_instance_config_warning_modal', 'true')`)
9 await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`) 14 await browser.execute(`window.localStorage.setItem('no_welcome_modal', 'true')`)
10 15
11 await $('input#username').setValue('root') 16 await $('input#username').setValue(username)
12 await $('input#password').setValue('test' + this.getSuffix()) 17 await $('input#password').setValue(password)
13 18
14 await browser.pause(1000) 19 await browser.pause(1000)
15 20
16 await $('form input[type=submit]').click() 21 await $('form input[type=submit]').click()
17 22
18 await this.ensureIsLoggedInAs('root') 23 const menuToggle = $('.top-left-block span[role=button]')
24
25 if (this.isMobileDevice) {
26 await browser.pause(1000)
27
28 await menuToggle.click()
29 }
30
31 await this.ensureIsLoggedInAs(username)
32
33 if (this.isMobileDevice) {
34 await menuToggle.click()
35 }
36 }
37
38 async loginAsRootUser () {
39 return this.login('root', 'test' + this.getSuffix())
40 }
41
42 loginOnPeerTube2 () {
43 return this.login('e2e', process.env.PEERTUBE2_E2E_PASSWORD, 'https://peertube2.cpy.re/login')
19 } 44 }
20 45
21 async logout () { 46 async logout () {
22 await $('.logged-in-more').click() 47 const loggedInMore = $('.logged-in-more')
48
49 await loggedInMore.waitForClickable()
50 await loggedInMore.click()
23 51
24 const logout = () => $('.dropdown-item*=Log out') 52 const logout = $('.dropdown-item*=Log out')
25 53
26 await logout().waitForDisplayed() 54 await logout.waitForClickable()
27 await logout().click() 55 await logout.click()
28 56
29 await $('.login-buttons-block').waitForDisplayed() 57 await browser.waitUntil(() => {
58 return $('.login-buttons-block, my-error-page a[href="/login"]').isDisplayed()
59 })
30 } 60 }
31 61
32 async ensureIsLoggedInAs (displayName: string) { 62 async ensureIsLoggedInAs (displayName: string) {
diff --git a/client/e2e/src/po/my-account.po.ts b/client/e2e/src/po/my-account.po.ts
index 8d5d878ce..222dbb569 100644
--- a/client/e2e/src/po/my-account.po.ts
+++ b/client/e2e/src/po/my-account.po.ts
@@ -25,6 +25,8 @@ export class MyAccountPage {
25 25
26 await nsfw.waitForDisplayed() 26 await nsfw.waitForDisplayed()
27 await nsfw.scrollIntoView(false) // Avoid issues with fixed header on firefox 27 await nsfw.scrollIntoView(false) // Avoid issues with fixed header on firefox
28 await nsfw.waitForClickable()
29
28 await nsfw.selectByAttribute('value', newValue) 30 await nsfw.selectByAttribute('value', newValue)
29 31
30 await this.submitVideoSettings() 32 await this.submitVideoSettings()
@@ -43,6 +45,8 @@ export class MyAccountPage {
43 45
44 private async submitVideoSettings () { 46 private async submitVideoSettings () {
45 const submit = $('my-user-video-settings input[type=submit]') 47 const submit = $('my-user-video-settings input[type=submit]')
48
49 await submit.waitForClickable()
46 await submit.scrollIntoView(false) 50 await submit.scrollIntoView(false)
47 await submit.click() 51 await submit.click()
48 } 52 }
diff --git a/client/e2e/src/po/signup.po.ts b/client/e2e/src/po/signup.po.ts
index ef36dbcc4..7a17198cc 100644
--- a/client/e2e/src/po/signup.po.ts
+++ b/client/e2e/src/po/signup.po.ts
@@ -9,7 +9,7 @@ export class SignupPage {
9 async clickOnRegisterInMenu () { 9 async clickOnRegisterInMenu () {
10 const button = this.getRegisterMenuButton() 10 const button = this.getRegisterMenuButton()
11 11
12 await button.waitForDisplayed() 12 await button.waitForClickable()
13 await button.click() 13 await button.click()
14 } 14 }
15 15
@@ -22,6 +22,7 @@ export class SignupPage {
22 22
23 async checkTerms () { 23 async checkTerms () {
24 const terms = await getCheckbox('terms') 24 const terms = await getCheckbox('terms')
25 await terms.waitForClickable()
25 26
26 return terms.click() 27 return terms.click()
27 } 28 }
diff --git a/client/e2e/src/po/video-upload.po.ts b/client/e2e/src/po/video-upload.po.ts
index 8605139c9..7e7989763 100644
--- a/client/e2e/src/po/video-upload.po.ts
+++ b/client/e2e/src/po/video-upload.po.ts
@@ -11,8 +11,8 @@ export class VideoUploadPage {
11 await $('.upload-video-container').waitForDisplayed() 11 await $('.upload-video-container').waitForDisplayed()
12 } 12 }
13 13
14 async uploadVideo () { 14 async uploadVideo (fixtureName: 'video.mp4' | 'video2.mp4' | 'video3.mp4') {
15 const fileToUpload = join(__dirname, '../../fixtures/video.mp4') 15 const fileToUpload = join(__dirname, '../../fixtures/' + fixtureName)
16 const fileInputSelector = '.upload-video-container input[type=file]' 16 const fileInputSelector = '.upload-video-container input[type=file]'
17 const parentFileInput = '.upload-video-container .button-file' 17 const parentFileInput = '.upload-video-container .button-file'
18 18
@@ -36,6 +36,7 @@ export class VideoUploadPage {
36 36
37 async setAsNSFW () { 37 async setAsNSFW () {
38 const checkbox = await getCheckbox('nsfw') 38 const checkbox = await getCheckbox('nsfw')
39 await checkbox.waitForClickable()
39 40
40 return checkbox.click() 41 return checkbox.click()
41 } 42 }
@@ -45,7 +46,10 @@ export class VideoUploadPage {
45 await nameInput.clearValue() 46 await nameInput.clearValue()
46 await nameInput.setValue(videoName) 47 await nameInput.setValue(videoName)
47 48
48 await this.getSecondStepSubmitButton().click() 49 const button = this.getSecondStepSubmitButton()
50 await button.waitForClickable()
51
52 await button.click()
49 53
50 return browser.waitUntil(async () => { 54 return browser.waitUntil(async () => {
51 return (await browser.getUrl()).includes('/w/') 55 return (await browser.getUrl()).includes('/w/')
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 65bf21837..982c90908 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -49,7 +49,11 @@ export class VideoWatchPage {
49 url = url.replace(':3333', ':9001') 49 url = url.replace(':3333', ':9001')
50 50
51 await go(url) 51 await go(url)
52 await $('.vjs-big-play-button').waitForDisplayed() 52 await this.waitEmbedForDisplayed()
53 }
54
55 waitEmbedForDisplayed () {
56 return $('.vjs-big-play-button').waitForDisplayed()
53 } 57 }
54 58
55 isEmbedWarningDisplayed () { 59 isEmbedWarningDisplayed () {