This update changes the number of retries in the Playwright configuration. Additionally, solid improvements have been made in the account settings, including better data semantics for testing, changes to email confirmation, and adding a new E2E test suite for accounts. The sign-up flow was updated and problems with multi-language support logic were fixed.
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
import { Page } from '@playwright/test';
|
|
import { Mailbox } from '../utils/mailbox';
|
|
|
|
export class AuthPageObject {
|
|
private readonly page: Page;
|
|
private readonly mailbox: Mailbox;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
this.mailbox = new Mailbox(page);
|
|
}
|
|
|
|
goToSignIn() {
|
|
return this.page.goto('/auth/sign-in');
|
|
}
|
|
|
|
goToSignUp() {
|
|
return this.page.goto('/auth/sign-up');
|
|
}
|
|
|
|
async signIn(params: {
|
|
email: string,
|
|
password: string
|
|
}) {
|
|
await this.page.locator('input[name="email"]').clear();
|
|
|
|
await this.page.fill('input[name="email"]', params.email);
|
|
await this.page.fill('input[name="password"]', params.password);
|
|
await this.page.click('button[type="submit"]');
|
|
}
|
|
|
|
async signUp(params: {
|
|
email: string,
|
|
password: string,
|
|
repeatPassword: string
|
|
}) {
|
|
await this.page.fill('input[name="email"]', params.email);
|
|
await this.page.fill('input[name="password"]', params.password);
|
|
await this.page.fill('input[name="repeatPassword"]', params.repeatPassword);
|
|
await this.page.click('button[type="submit"]');
|
|
}
|
|
|
|
async visitConfirmEmailLink(email: string) {
|
|
await this.page.waitForTimeout(300);
|
|
|
|
await this.mailbox.visitMailbox(email);
|
|
}
|
|
|
|
createRandomEmail() {
|
|
const value = Math.random() * 1000;
|
|
|
|
return `${value.toFixed(0)}@makerkit.dev`;
|
|
}
|
|
|
|
async signUpFlow(path: string) {
|
|
const email = this.createRandomEmail();
|
|
|
|
await this.page.goto(`/auth/sign-up?next=${path}`, {
|
|
waitUntil: 'networkidle',
|
|
});
|
|
|
|
await this.signUp({
|
|
email,
|
|
password: 'password',
|
|
repeatPassword: 'password',
|
|
});
|
|
|
|
await this.visitConfirmEmailLink(email);
|
|
}
|
|
} |