Some checks failed
Deploy Web Apps / deploy (push) Has been cancelled
Queue Release Build / prepare (push) Successful in 21s
Queue Release Build / build-linux (push) Successful in 27m44s
Queue Release Build / build-windows (push) Successful in 32m16s
Queue Release Build / finalize (push) Successful in 1m54s
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { expect, type Page, type Locator } from '@playwright/test';
|
|
|
|
export class RegisterPage {
|
|
readonly usernameInput: Locator;
|
|
readonly displayNameInput: Locator;
|
|
readonly passwordInput: Locator;
|
|
readonly serverSelect: Locator;
|
|
readonly submitButton: Locator;
|
|
readonly errorText: Locator;
|
|
readonly loginLink: Locator;
|
|
|
|
constructor(private page: Page) {
|
|
this.usernameInput = page.locator('#register-username');
|
|
this.displayNameInput = page.locator('#register-display-name');
|
|
this.passwordInput = page.locator('#register-password');
|
|
this.serverSelect = page.locator('#register-server');
|
|
this.submitButton = page.getByRole('button', { name: 'Create Account' });
|
|
this.errorText = page.locator('.text-destructive');
|
|
this.loginLink = page.getByRole('button', { name: 'Login' });
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/register', { waitUntil: 'domcontentloaded' });
|
|
|
|
try {
|
|
await expect(this.usernameInput).toBeVisible({ timeout: 10_000 });
|
|
} catch {
|
|
// Angular router may redirect to /login on first load; click through.
|
|
const registerLink = this.page.getByRole('link', { name: 'Register' })
|
|
.or(this.page.getByText('Register'));
|
|
|
|
await registerLink.first().click();
|
|
await expect(this.usernameInput).toBeVisible({ timeout: 30_000 });
|
|
}
|
|
|
|
await expect(this.submitButton).toBeVisible({ timeout: 30_000 });
|
|
}
|
|
|
|
async register(username: string, displayName: string, password: string) {
|
|
await this.usernameInput.fill(username);
|
|
await this.displayNameInput.fill(displayName);
|
|
await this.passwordInput.fill(password);
|
|
await this.submitButton.click();
|
|
}
|
|
}
|