From 1db86422eb516acd23550f30536de4ebd8f0daea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Jun 2022 09:09:46 +0200 Subject: Add E2E tests for signup --- client/e2e/src/po/admin-config.po.ts | 11 +++++-- client/e2e/src/po/admin-plugin.po.ts | 2 +- client/e2e/src/po/login.po.ts | 10 ++++-- client/e2e/src/po/signup.po.ts | 64 ++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 client/e2e/src/po/signup.po.ts (limited to 'client/e2e/src/po') 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 @@ -import { browserSleep, go } from '../utils' +import { getCheckbox, go } from '../utils' export class AdminConfigPage { @@ -22,8 +22,13 @@ export class AdminConfigPage { return $('#instanceCustomHomepageContent').setValue(newValue) } + async toggleSignup () { + const checkbox = await getCheckbox('signupEnabled') + await checkbox.click() + } + async save () { - await $('input[type=submit]').click() - await browserSleep(200) + const button = $('input[type=submit]') + await button.click() } } 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' export class AdminPluginPage { - async navigateToSearch () { + async navigateToPluginSearch () { await go('/admin/plugins/search') 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 { await $('form input[type=submit]').click() - await this.getLoggedInInfoElem().waitForExist() - - await expect(this.getLoggedInInfoElem()).toHaveText('root') + await this.ensureIsLoggedInAs('root') } async logout () { @@ -31,6 +29,12 @@ export class LoginPage { await $('.login-buttons-block').waitForDisplayed() } + async ensureIsLoggedInAs (displayName: string) { + await this.getLoggedInInfoElem().waitForExist() + + await expect(this.getLoggedInInfoElem()).toHaveText(displayName) + } + private getLoggedInInfoElem () { return $('.logged-in-display-name') } 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 @@ +import { getCheckbox } from '../utils' + +export class SignupPage { + + getRegisterMenuButton () { + return $('.create-account-button') + } + + async clickOnRegisterInMenu () { + const button = this.getRegisterMenuButton() + + await button.waitForDisplayed() + await button.click() + } + + async validateStep () { + const next = $('button[type=submit]') + + await next.waitForClickable() + await next.click() + } + + async checkTerms () { + const terms = await getCheckbox('terms') + + return terms.click() + } + + async fillAccountStep (options: { + displayName: string + username: string + email: string + password: string + }) { + if (options.displayName) { + await $('#displayName').setValue(options.displayName) + } + + if (options.username) { + await $('#username').setValue(options.username) + } + + if (options.email) { + await $('#email').setValue(options.email) + } + + if (options.password) { + await $('#password').setValue(options.password) + } + } + + async fillChannelStep (options: { + displayName: string + name: string + }) { + if (options.displayName) { + await $('#displayName').setValue(options.displayName) + } + + if (options.name) { + await $('#name').setValue(options.name) + } + } +} -- cgit v1.2.3