aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/login.po.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-19 09:30:05 +0100
committerChocobozzz <chocobozzz@cpy.re>2023-01-19 13:53:40 +0100
commit5bdfa604f102a5e51b5152457cd1a16d79177e26 (patch)
tree878c04cbd3c452c7b45aa39e19abd38bfe691063 /client/e2e/src/po/login.po.ts
parent9589907c89d29a6c0acd52c8cb789af9f93ce9af (diff)
downloadPeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.tar.gz
PeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.tar.zst
PeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.zip
Add E2E client tests for signup approval
Diffstat (limited to 'client/e2e/src/po/login.po.ts')
-rw-r--r--client/e2e/src/po/login.po.ts36
1 files changed, 28 insertions, 8 deletions
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index bc1854dbc..f1d13a2b0 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -6,7 +6,14 @@ export class LoginPage {
6 6
7 } 7 }
8 8
9 async login (username: string, password: string, url = '/login') { 9 async login (options: {
10 username: string
11 password: string
12 displayName?: string
13 url?: string
14 }) {
15 const { username, password, url = '/login', displayName = username } = options
16
10 await go(url) 17 await go(url)
11 18
12 await browser.execute(`window.localStorage.setItem('no_account_setup_warning_modal', 'true')`) 19 await browser.execute(`window.localStorage.setItem('no_account_setup_warning_modal', 'true')`)
@@ -27,27 +34,40 @@ export class LoginPage {
27 34
28 await menuToggle.click() 35 await menuToggle.click()
29 36
30 await this.ensureIsLoggedInAs(username) 37 await this.ensureIsLoggedInAs(displayName)
31 38
32 await menuToggle.click() 39 await menuToggle.click()
33 } else { 40 } else {
34 await this.ensureIsLoggedInAs(username) 41 await this.ensureIsLoggedInAs(displayName)
35 } 42 }
36 } 43 }
37 44
45 async getLoginError (username: string, password: string) {
46 await go('/login')
47
48 await $('input#username').setValue(username)
49 await $('input#password').setValue(password)
50
51 await browser.pause(1000)
52
53 await $('form input[type=submit]').click()
54
55 return $('.alert-danger').getText()
56 }
57
38 async loginAsRootUser () { 58 async loginAsRootUser () {
39 return this.login('root', 'test' + this.getSuffix()) 59 return this.login({ username: 'root', password: 'test' + this.getSuffix() })
40 } 60 }
41 61
42 loginOnPeerTube2 () { 62 loginOnPeerTube2 () {
43 return this.login('e2e', process.env.PEERTUBE2_E2E_PASSWORD, 'https://peertube2.cpy.re/login') 63 return this.login({ username: 'e2e', password: process.env.PEERTUBE2_E2E_PASSWORD, url: 'https://peertube2.cpy.re/login' })
44 } 64 }
45 65
46 async logout () { 66 async logout () {
47 const loggedInMore = $('.logged-in-more') 67 const loggedInDropdown = $('.logged-in-more .logged-in-info')
48 68
49 await loggedInMore.waitForClickable() 69 await loggedInDropdown.waitForClickable()
50 await loggedInMore.click() 70 await loggedInDropdown.click()
51 71
52 const logout = $('.dropdown-item*=Log out') 72 const logout = $('.dropdown-item*=Log out')
53 73