Добавил LoginPage,а также позитивные UI, API тесты для авторизации пользователя
This commit is contained in:
31
page-objects/LoginPage.ts
Normal file
31
page-objects/LoginPage.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// 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'); // или '/', если перебрасывает на главную
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user