// TEMPLATE THAM CHIẾU — không phải file chạy thật. // Skill dùng style này để sinh tests/e2e/pages/Page.ts. // CÁC LOCATOR DƯỚI ĐÂY LÀ VÍ DỤ — khi sinh thật phải thay bằng locator // lấy từ Phase 3 (Playwright MCP browser_snapshot / browser_generate_locator). import { Page, Locator } from '@playwright/test'; import { BasePage } from './BasePage'; export class LoginPage extends BasePage { readonly emailInput: Locator; readonly passwordInput: Locator; readonly submitButton: Locator; readonly errorMessage: Locator; constructor(page: Page) { super(page); // ↓ Locator THẬT lấy từ DOM ở Phase 3, ưu tiên getByRole > getByLabel > ... this.emailInput = page.getByRole('textbox', { name: 'Email' }); this.passwordInput = page.getByLabel('Mật khẩu'); this.submitButton = page.getByRole('button', { name: 'Đăng nhập' }); this.errorMessage = page.getByText('Sai tên đăng nhập hoặc mật khẩu'); } async login(email: string, password: string): Promise { await this.emailInput.fill(email); await this.passwordInput.fill(password); await this.submitButton.click(); } }