platform/qms-tests/sanity/tests/model/signup-page.ts
Alexey Zinoviev 9d8cc845d6
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / uitest-workspaces (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
UBERF-9458: OTP sign up (#8043)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
2025-02-18 22:58:30 +07:00

40 lines
1.5 KiB
TypeScript

import { type Locator, type Page } from '@playwright/test'
import { UserSignUp } from './types'
export class SignupPage {
readonly page: Page
readonly inputFirstName: Locator
readonly inputLastName: Locator
readonly inputEmail: Locator
readonly inputNewPassword: Locator
readonly inputRepeatNewPassword: Locator
readonly buttonSignUp: Locator
readonly textError: Locator
readonly signUpPasswordBtn: Locator
constructor (page: Page) {
this.page = page
this.inputFirstName = page.locator('input[name="given-name"]')
this.inputLastName = page.locator('input[name="family-name"]')
this.inputEmail = page.locator('input[name="email"]')
this.inputNewPassword = page.locator('input[name="new-password"]').nth(0)
this.inputRepeatNewPassword = page.locator('input[name="new-password"]').nth(1)
this.buttonSignUp = page.locator('div.send button')
this.textError = page.locator('div.ERROR > span')
this.signUpPasswordBtn = page.locator('a', { hasText: 'Sign up with password' })
}
async signupPwd (userData: UserSignUp): Promise<void> {
const isOtp = await this.signUpPasswordBtn.isVisible()
if (isOtp) {
await this.signUpPasswordBtn.click()
}
await this.inputFirstName.fill(userData.firstName)
await this.inputLastName.fill(userData.lastName)
await this.inputEmail.fill(userData.email)
await this.inputNewPassword.fill(userData.password)
await this.inputRepeatNewPassword.fill(userData.password)
}
}