Files
at-digitaltwin/page-objects/RegisterPage.ts

97 lines
3.4 KiB
TypeScript

// page-objects/RegisterPage.ts
import { Page } from '@playwright/test';
export class RegisterPage {
readonly page: Page;
constructor(page: Page) {
this.page = page;
}
// --- Этап 1: Общие поля ---
async goto() {
await this.page.goto('/registration');
}
async fillLastName(lastName: string) {
await this.page.fill('input[name="surname"]', lastName);
}
async fillFirstName(firstName: string) {
await this.page.fill('input[name="name"]', firstName);
}
async fillMiddleName(middleName: string) {
await this.page.fill('input[name="patronymic"]', middleName);
}
async fillEmail(email: string) {
await this.page.fill('input[name="email"]', email);
}
async fillLogin(login: string) {
await this.page.fill('input[name="login"]', login);
}
async fillPhone(phone: string) {
await this.page.fill('input[name="phone"]', phone);
}
async fillPassword(password: string) {
await this.page.fill('input[name="password"]', password);
}
async fillPasswordRepeat(password: string) {
await this.page.fill('input[name="passwordRepeat"]', password);
}
async checkConsentCheckbox() {
await this.page.locator('span.Checkmark_checkmark__58fWm').click();
}
async clickNextButton() {
await this.page.locator('button[type="submit"]', { hasText: 'Далее' }).click();
}
async submitGraduate() {
await this.page.locator('button[type="submit"]', { hasText: 'Зарегистрироваться' }).click();
}
async submit() {
await this.page.locator('button[data-testid="btn-save"]').click();
}
// --- Этап 2: Образование выпускника ---
async selectGraduateRole() {
await this.page.locator('button.Registration_button_menu__AfPox', { hasText: 'Выпускник' }).click();
}
async selectDepartment() {
await this.page.locator('input[name="department"]').click();
await this.page.getByText('Институт компьютерных технологий и информационной безопасности', { exact: true }).scrollIntoViewIfNeeded();
await this.page.getByText('Институт компьютерных технологий и информационной безопасности', { exact: true }).click();
}
async selectEducationLevel() {
await this.page.locator('input[name="educationLevel"]').click();
await this.page.getByText('Специалитет', { exact: true }).click();
}
async selectSpeciality() {
await this.page.locator('input[name="speciality"]').click();
await this.page.getByText('Применение и эксплуатация автоматизированных систем специального назначения', { exact: true }).scrollIntoViewIfNeeded();
await this.page.getByText('Применение и эксплуатация автоматизированных систем специального назначения', { exact: true }).click();
}
async selectProgram() {
await this.page.locator('input[name="program"]').click();
await this.page.getByText('Автоматизированные системы обработки информации и управления', { exact: true }).first().click();
}
async selectEducationForm() {
await this.page.locator('input[name="educationForm"]').click();
await this.page.getByText('Очная', { exact: true }).click();
}
}