Добавлен позитивный тест для проверки заполнения информации профиля абитуриента

This commit is contained in:
Vlad Smykov
2026-02-09 15:28:43 +03:00
parent 96394f726b
commit bc0d50610c
11 changed files with 125 additions and 3 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
fixtures/.DS_Store vendored Normal file

Binary file not shown.

BIN
fixtures/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@@ -0,0 +1,65 @@
// page-objects/ProfileApplicantPage.ts
import { Page } from '@playwright/test';
export class ProfileApplicantPage {
readonly page: Page;
constructor(page: Page) {
this.page = page;
}
async goto() {
await this.page.goto('/account/profile');
}
async openBasicInfoEditor() {
await this.page.getByTestId('btn-pensil').nth(0).click();
}
async uploadAvatar(filePath: string) {
const [fileChooser] = await Promise.all([
this.page.waitForEvent('filechooser'),
this.page.getByTestId('ModalUserInfo').getByTestId('btn-pensil').first().click(),
]);
await fileChooser.setFiles(filePath);
}
async fillCity(city: string) {
await this.page.fill('input[name="city"]', city);
}
async saveBasicInfo() {
await this.page.getByTestId('btn-save').click();
}
async openRepresentativeEditor() {
await this.page.getByTestId('btn-pensil').nth(1).click();
}
async fillRepresentative(from: string, fullName: string, phone: string) {
await this.page.fill('input[name="parents.0.from"]', from);
await this.page.fill('input[name="parents.0.fio"]', fullName);
await this.page.fill('input[name="parents.0.phone"]', phone);
}
async saveRepresentative() {
await this.page.locator('button:has-text("Сохранить")').click();
}
async openDisabilityEditor() {
await this.page.getByTestId('btn-pensil').nth(2).click();
}
async selectDisability(disability: string) {
await this.page.getByText(disability).click();
}
async selectDisabilityGroup(group: string) {
await this.page.getByText(group).first().click();
}
async saveDisabilityInfo() {
await this.page.locator('button:has-text("Сохранить")').click();
}
}

View File

@@ -1 +1 @@
{"email":"testuser1770028019439@virgilian.com","password":"!Test123456","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzAwMjgwMjAsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwMDI4MDE5NDM5QHZpcmdpbGlhbi5jb20iLCJpZCI6IjY5ODA3YmY0NmFiNTlkMDJiMzBhMzNhOCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OTgwN2JmNDZhYjU5ZDAyYjMwYTMzYTgiXX19.xWXF4bN07584CE0AGiuUfH7XpNLNKFRp7DnLQbbf1jhzRHPgQuHaqh39_lShcFSl5GU1Hxqdk41s9yJMBFkuYw"} {"email":"testuser1770382880998@virgilian.com","password":"!Test123456","login":"user_9im58j","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzAzODI4ODEsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwMzgyODgwOTk4QHZpcmdpbGlhbi5jb20iLCJpZCI6IjY5ODVlNjIxNTMzYjdmZmY5YjBkZWZhOCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OTg1ZTYyMTUzM2I3ZmZmOWIwZGVmYTgiXX19.mO_8aGsS6FxHX53EzTXbnm063zSeKfaqR79Ls280VY54rE2Hhb32RtoD8ECYynRAeJZJekXzGZnD0ciBSFz3zA"}

BIN
tests/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -46,6 +46,7 @@ test('API: регистрация абитуриента + подтвержде
fs.writeFileSync('temp/user.json', JSON.stringify({ fs.writeFileSync('temp/user.json', JSON.stringify({
email, email,
password: '!Test123456', password: '!Test123456',
login,
mailToken mailToken
})); }));

View File

@@ -0,0 +1,13 @@
// tests/suites/all-api-tests.serial.spec.ts
import { test } from '@playwright/test';
test.describe.serial('API Suite', () => {
test.describe.configure({ mode: 'serial' });
require('../api/registration/register-applicant.api.spec');
require('../api/registration/register-graduate.api.spec');
require('../api/registration/register-organization.api.spec');
require('../api/auth/login-applicant.api.spec');
});

View File

BIN
tests/ui/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,43 @@
import { test, expect } from '@playwright/test';
import fs from 'fs';
import path from 'path';
import { LoginPage } from '../../../page-objects/LoginPage';
import { ProfileApplicantPage } from '../../../page-objects/UsersAccount/ProfileApplicantPage';
test('UI: Личный кабинет абитуриента — заполнение профиля', async ({ page }) => {
const user = JSON.parse(fs.readFileSync('temp/user.json', 'utf-8'));
const loginPage = new LoginPage(page);
const profilePage = new ProfileApplicantPage(page);
// Авторизация
await loginPage.goto();
await loginPage.fillLogin(user.login);
await loginPage.fillPassword(user.password);
await loginPage.submit();
await expect(page).toHaveURL(/.*\/account\/profile/);
// Открытие редактирования базовой информации
await profilePage.goto();
await profilePage.openBasicInfoEditor();
await profilePage.uploadAvatar(path.resolve('fixtures', 'avatar.png')); // добавь этот файл в проект
await profilePage.fillCity('Таганрог');
await profilePage.saveBasicInfo();
// Редактирование представителя
await profilePage.openRepresentativeEditor();
await profilePage.fillRepresentative(
'Мать',
'Иванова Мария Петровна',
'+7 (900) 123-45-67'
);
await profilePage.saveRepresentative();
// Редактирование инвалидности
await profilePage.openDisabilityEditor();
await profilePage.selectDisability('Нарушение слуха');
await profilePage.selectDisabilityGroup('I группа');
await profilePage.saveDisabilityInfo();
// Проверка, что остались на профиле
await expect(page).toHaveURL(/.*\/account\/profile/);
});