32 lines
743 B
TypeScript
32 lines
743 B
TypeScript
// page-objects/LoginPage.ts
|
|
|
|
import { Page } from '@playwright/test';
|
|
|
|
export class LoginPage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/authorization'); // или '/auth', если маршрут другой
|
|
}
|
|
|
|
async fillLogin(login: string) {
|
|
await this.page.fill('input[name="login"]', login);
|
|
}
|
|
|
|
async fillPassword(password: string) {
|
|
await this.page.fill('input[name="password"]', password);
|
|
}
|
|
|
|
async submit() {
|
|
await this.page.click('button[type="submit"]');
|
|
}
|
|
|
|
async assertSuccessfulLogin() {
|
|
await this.page.waitForURL('**/account/profile'); // или '/', если перебрасывает на главную
|
|
}
|
|
}
|