diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-21 09:09:46 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-21 10:49:54 +0200 |
commit | 1db86422eb516acd23550f30536de4ebd8f0daea (patch) | |
tree | 909c01cf3f5903ba5d44f182d4988586ad8650c1 /client/e2e/src/po | |
parent | 2b621ac0ebe83693bba6354b3482a03ba58143e7 (diff) | |
download | PeerTube-1db86422eb516acd23550f30536de4ebd8f0daea.tar.gz PeerTube-1db86422eb516acd23550f30536de4ebd8f0daea.tar.zst PeerTube-1db86422eb516acd23550f30536de4ebd8f0daea.zip |
Add E2E tests for signup
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r-- | client/e2e/src/po/admin-config.po.ts | 11 | ||||
-rw-r--r-- | client/e2e/src/po/admin-plugin.po.ts | 2 | ||||
-rw-r--r-- | client/e2e/src/po/login.po.ts | 10 | ||||
-rw-r--r-- | client/e2e/src/po/signup.po.ts | 64 |
4 files changed, 80 insertions, 7 deletions
diff --git a/client/e2e/src/po/admin-config.po.ts b/client/e2e/src/po/admin-config.po.ts index a15184781..6d48a0fd7 100644 --- a/client/e2e/src/po/admin-config.po.ts +++ b/client/e2e/src/po/admin-config.po.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { browserSleep, go } from '../utils' | 1 | import { getCheckbox, go } from '../utils' |
2 | 2 | ||
3 | export class AdminConfigPage { | 3 | export class AdminConfigPage { |
4 | 4 | ||
@@ -22,8 +22,13 @@ export class AdminConfigPage { | |||
22 | return $('#instanceCustomHomepageContent').setValue(newValue) | 22 | return $('#instanceCustomHomepageContent').setValue(newValue) |
23 | } | 23 | } |
24 | 24 | ||
25 | async toggleSignup () { | ||
26 | const checkbox = await getCheckbox('signupEnabled') | ||
27 | await checkbox.click() | ||
28 | } | ||
29 | |||
25 | async save () { | 30 | async save () { |
26 | await $('input[type=submit]').click() | 31 | const button = $('input[type=submit]') |
27 | await browserSleep(200) | 32 | await button.click() |
28 | } | 33 | } |
29 | } | 34 | } |
diff --git a/client/e2e/src/po/admin-plugin.po.ts b/client/e2e/src/po/admin-plugin.po.ts index 6a3f3cf28..0259f34d6 100644 --- a/client/e2e/src/po/admin-plugin.po.ts +++ b/client/e2e/src/po/admin-plugin.po.ts | |||
@@ -2,7 +2,7 @@ import { browserSleep, go } from '../utils' | |||
2 | 2 | ||
3 | export class AdminPluginPage { | 3 | export class AdminPluginPage { |
4 | 4 | ||
5 | async navigateToSearch () { | 5 | async navigateToPluginSearch () { |
6 | await go('/admin/plugins/search') | 6 | await go('/admin/plugins/search') |
7 | 7 | ||
8 | await $('my-plugin-search').waitForDisplayed() | 8 | await $('my-plugin-search').waitForDisplayed() |
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts index 486b9a6d8..2c4561b7d 100644 --- a/client/e2e/src/po/login.po.ts +++ b/client/e2e/src/po/login.po.ts | |||
@@ -15,9 +15,7 @@ export class LoginPage { | |||
15 | 15 | ||
16 | await $('form input[type=submit]').click() | 16 | await $('form input[type=submit]').click() |
17 | 17 | ||
18 | await this.getLoggedInInfoElem().waitForExist() | 18 | await this.ensureIsLoggedInAs('root') |
19 | |||
20 | await expect(this.getLoggedInInfoElem()).toHaveText('root') | ||
21 | } | 19 | } |
22 | 20 | ||
23 | async logout () { | 21 | async logout () { |
@@ -31,6 +29,12 @@ export class LoginPage { | |||
31 | await $('.login-buttons-block').waitForDisplayed() | 29 | await $('.login-buttons-block').waitForDisplayed() |
32 | } | 30 | } |
33 | 31 | ||
32 | async ensureIsLoggedInAs (displayName: string) { | ||
33 | await this.getLoggedInInfoElem().waitForExist() | ||
34 | |||
35 | await expect(this.getLoggedInInfoElem()).toHaveText(displayName) | ||
36 | } | ||
37 | |||
34 | private getLoggedInInfoElem () { | 38 | private getLoggedInInfoElem () { |
35 | return $('.logged-in-display-name') | 39 | return $('.logged-in-display-name') |
36 | } | 40 | } |
diff --git a/client/e2e/src/po/signup.po.ts b/client/e2e/src/po/signup.po.ts new file mode 100644 index 000000000..ef36dbcc4 --- /dev/null +++ b/client/e2e/src/po/signup.po.ts | |||
@@ -0,0 +1,64 @@ | |||
1 | import { getCheckbox } from '../utils' | ||
2 | |||
3 | export class SignupPage { | ||
4 | |||
5 | getRegisterMenuButton () { | ||
6 | return $('.create-account-button') | ||
7 | } | ||
8 | |||
9 | async clickOnRegisterInMenu () { | ||
10 | const button = this.getRegisterMenuButton() | ||
11 | |||
12 | await button.waitForDisplayed() | ||
13 | await button.click() | ||
14 | } | ||
15 | |||
16 | async validateStep () { | ||
17 | const next = $('button[type=submit]') | ||
18 | |||
19 | await next.waitForClickable() | ||
20 | await next.click() | ||
21 | } | ||
22 | |||
23 | async checkTerms () { | ||
24 | const terms = await getCheckbox('terms') | ||
25 | |||
26 | return terms.click() | ||
27 | } | ||
28 | |||
29 | async fillAccountStep (options: { | ||
30 | displayName: string | ||
31 | username: string | ||
32 | email: string | ||
33 | password: string | ||
34 | }) { | ||
35 | if (options.displayName) { | ||
36 | await $('#displayName').setValue(options.displayName) | ||
37 | } | ||
38 | |||
39 | if (options.username) { | ||
40 | await $('#username').setValue(options.username) | ||
41 | } | ||
42 | |||
43 | if (options.email) { | ||
44 | await $('#email').setValue(options.email) | ||
45 | } | ||
46 | |||
47 | if (options.password) { | ||
48 | await $('#password').setValue(options.password) | ||
49 | } | ||
50 | } | ||
51 | |||
52 | async fillChannelStep (options: { | ||
53 | displayName: string | ||
54 | name: string | ||
55 | }) { | ||
56 | if (options.displayName) { | ||
57 | await $('#displayName').setValue(options.displayName) | ||
58 | } | ||
59 | |||
60 | if (options.name) { | ||
61 | await $('#name').setValue(options.name) | ||
62 | } | ||
63 | } | ||
64 | } | ||