// pages/LoginPage.ts
import { Page, Locator, expect } from '@playwright/test';
export class LoginPage {
readonly email: Locator;
readonly password: Locator;
readonly submit: Locator;
constructor(private page: Page) {
this.email = page.getByTestId('login-email');
this.password = page.getByTestId('login-password');
this.submit = page.getByRole('button', { name: 'Войти' });
}
async login(email: string, password: string) {
await this.email.fill(email);
await this.password.fill(password);
await this.submit.click();
}
async expectLoggedIn() {
await expect(this.page.getByText('Личный кабинет')).toBeVisible();
}
}
// pages/LoginPage.ts
import { Page, Locator, expect } from '@playwright/test';
export class LoginPage {
readonly email: Locator;
readonly password: Locator;
readonly submit: Locator;
constructor(private page: Page) {
this.email = page.getByTestId('login-email');
this.password = page.getByTestId('login-password');
this.submit = page.getByRole('button', { name: 'Войти' });
}
async login(email: string, password: string) {
await this.email.fill(email);
await this.password.fill(password);
await this.submit.click();
}
async expectLoggedIn() {
await expect(this.page.getByText('Личный кабинет')).toBeVisible();
}
}