import { type Page, type Locator } from '@playwright/test'; export class LoginPage { readonly usernameInput: Locator; readonly passwordInput: Locator; readonly serverSelect: Locator; readonly submitButton: Locator; readonly errorText: Locator; readonly registerLink: Locator; constructor(private page: Page) { this.usernameInput = page.locator('#login-username'); this.passwordInput = page.locator('#login-password'); this.serverSelect = page.locator('#login-server'); this.submitButton = page.getByRole('button', { name: 'Login' }); this.errorText = page.locator('.text-destructive'); this.registerLink = page.getByRole('button', { name: 'Register' }); } async goto() { await this.page.goto('/login'); } async login(username: string, password: string) { await this.usernameInput.fill(username); await this.passwordInput.fill(password); await this.submitButton.click(); } }