157 lines
4.9 KiB
TypeScript
157 lines
4.9 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: 'Далее' }).first().click();
|
||
}
|
||
|
||
async clickNextButtonOrg() {
|
||
await this.page.locator('button[type="submit"]', { hasText: 'Далее' }).last().click();
|
||
}
|
||
|
||
async submitGeneral() {
|
||
await this.page.locator('button[type="submit"]', { hasText: 'Зарегистрироваться' }).click();
|
||
}
|
||
|
||
async submit() {
|
||
await this.page.locator('button[data-testid="btn-save"]').click();
|
||
}
|
||
|
||
async selectRole(roleName: 'Абитуриент' | 'Выпускник' | 'Организация') {
|
||
await this.page.getByRole('button', { name: roleName }).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();
|
||
}
|
||
|
||
//Для организации
|
||
|
||
async fillShortName(shortName: string) {
|
||
await this.page.fill('input[name="shortName"]', shortName);
|
||
}
|
||
|
||
async fillFullName(fullName: string){
|
||
await this.page.fill('input[name="fullName"]', fullName);
|
||
}
|
||
|
||
async fillAddress(address: string) {
|
||
await this.page.fill('input[name="address"]', address);
|
||
}
|
||
|
||
async fillKPP(kpp: string) {
|
||
await this.page.fill('input[name="kpp"]', kpp);
|
||
}
|
||
|
||
async fillINN(inn: string) {
|
||
await this.page.fill('input[name="inn"]', inn);
|
||
}
|
||
|
||
async fillSite(site: string) {
|
||
await this.page.fill('input[name="site"]', site);
|
||
}
|
||
|
||
async fillDescription(description: string) {
|
||
await this.page.fill('textarea[name="description"]', description);
|
||
}
|
||
|
||
// Step 3
|
||
async fillDirectorFIO(fio: string) {
|
||
await this.page.fill('input[name="directorFIO"]', fio);
|
||
}
|
||
|
||
async fillPosition(position: string) {
|
||
await this.page.fill('input[name="position"]', position);
|
||
}
|
||
|
||
async fillBasis(basis: string) {
|
||
await this.page.fill('input[name="basis"]', basis);
|
||
}
|
||
|
||
async fillTelegram(tg: string) {
|
||
await this.page.fill('input[name="tg"]', tg);
|
||
}
|
||
|
||
async fillVK(vk: string) {
|
||
await this.page.fill('input[name="vk"]', vk);
|
||
}
|
||
|
||
async expectSuccessModal() {
|
||
await this.page.getByRole('heading', { name: 'Ваши данные отправлены на проверку!' }).waitFor();
|
||
await this.page.getByRole('button', { name: 'На главную' }).click();
|
||
}
|
||
|
||
}
|