Добавлены позитивные сценарии добавления информации в подразделе Портфолио. Роль – Абитуриент

This commit is contained in:
Vlad Smykov
2026-02-13 16:46:38 +03:00
parent bc0d50610c
commit bd487e09e4
9 changed files with 192 additions and 35 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
fixtures/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -10,7 +10,7 @@ export class LoginPage {
}
async goto() {
await this.page.goto('/authorization'); // или '/auth', если маршрут другой
await this.page.goto('/authorization');
}
async fillLogin(login: string) {

View File

@@ -13,6 +13,7 @@ export class ProfileApplicantPage {
await this.page.goto('/account/profile');
}
// Профиль
async openBasicInfoEditor() {
await this.page.getByTestId('btn-pensil').nth(0).click();
}
@@ -62,4 +63,110 @@ export class ProfileApplicantPage {
async saveDisabilityInfo() {
await this.page.locator('button:has-text("Сохранить")').click();
}
}
//Тесты
async openTestsPage() {
await this.page.getByRole('main').getByText('Тесты').click()
await this.page.getByText('Тест для позитивного сценария Playwright', { exact: true }).scrollIntoViewIfNeeded();
await this.page.getByRole('button', { name: 'Пройти тест' }).first().click();
await this.page.getByRole('button', { name: 'Начать тест' }).click();
await this.page.locator('.Checkmark_checkmark__58fWm').first().click();
await this.page.getByRole('button', { name: 'next' }).click();
await this.page.locator('.swiper-slide.swiper-slide-active > .Questions_slide__-Yhoj > #questionItem >' +
'.Question_answers__xra74 > #answer > #checkmark > .Checkmark_checkmark__58fWm').click();
await this.page.getByRole('button', { name: 'Завершить тест' }).click();
await this.page.getByRole('button', { name: 'К тестам' }).click();
}
//Портфолио
async openPortfolioPage() {
await this.page.getByRole('main').getByRole('listitem').filter({ hasText: 'Портфолио' }).click();
}
//Достижения
async clickAchievementButton() {
await this.page.locator('button').filter({ hasText: /^\+ Добавить$/ }).click();
}
async fillAchievementInfo() {
await this.page.getByRole('textbox', { name: 'Полное название' }).fill('Тестовое достижение');
await this.page.getByRole('textbox', { name: 'Не выбран' }).click();
await this.page.locator('#modal-main').getByText('2026', { exact: true }).first().click();
}
async uploadAchievement(filePath: string) {
const [fileChooser] = await Promise.all([
this.page.waitForEvent('filechooser'),
await this.page.getByText('Загрузите сертификат').click()
]);
await fileChooser.setFiles(filePath);
}
async clickAchievementSaveButton() {
await this.page.getByTestId('btn-save').click();
}
//Образование
async clickEducationButton() {
await this.page.locator('section').filter({ hasText: 'Образование' }).getByRole('button').click();
}
async fillEducationInfo() {
await this.page.getByRole('textbox', { name: 'Учебное заведение' }).fill('Тестовое заведение');
await this.page.getByRole('textbox', { name: 'Название специальности' }).fill('Тестовая специальность');
await this.page.locator('#yearStart').click();
await this.page.getByText('2020').click();
await this.page.locator('.Checkmark_checkmark__58fWm').click();
await this.page.locator('#yearEnd').click();
await this.page.locator('#scroll').getByText('2026').click();
await this.page.getByRole('textbox', { name: 'Очное' }).click();
await this.page.getByText('Очная', { exact: true }).click();
await this.page.getByRole('textbox', { name: 'Бюджет' }).click();
await this.page.getByText('Бюджет', { exact: true }).click();
await this.page.locator('#educationLevel').click();
await this.page.getByText('Бакалавриат').click();
}
async uploadEducation(filePath: string) {
const [fileChooser] = await Promise.all([
this.page.waitForEvent('filechooser'),
await this.page.getByText('Загрузите документ об образовании').click()
]);
await fileChooser.setFiles(filePath);
}
async clickEducationSaveButton() {
await this.page.getByRole('button', { name: 'Сохранить' }).click();
}
//Опыт работы
async clickWorkExpButton() {
await this.page.locator('section').filter({ hasText: 'Опыт работы + Добавить' }).getByRole('button').click();
}
async fillWorkExpInfo() {
await this.page.getByRole('textbox', { name: 'Полное название' }).fill('Тестовое название компании');
await this.page.getByRole('textbox', { name: 'Название должности' }).fill('Тестовая должность');
await this.page.getByRole('textbox', { name: 'Не выбрано' }).click();
await this.page.getByRole('textbox', { name: 'Не выбрано' }).fill('программист');
await this.page.getByRole('heading', { name: 'Связь, информационные и коммуникационные технологии' }).click();
await this.page.getByText('Программист', { exact: true }).click();
await this.page.getByRole('textbox', { name: 'Описание' }).fill('Тестовое описание опыта работы');
await this.page.getByRole('textbox', { name: '01.01.1999' }).fill('01.01.2020');
}
async uploadWorkExp(filePath: string) {
const [fileChooser] = await Promise.all([
this.page.waitForEvent('filechooser'),
await this.page.getByText('Загрузить подтверждающий документ').click()
]);
await fileChooser.setFiles(filePath);
}
async clickWorkExpSaveButton() {
await this.page.getByRole('button', { name: 'Сохранить' }).click();
}
//Дополнительные ссылки
async clickAdditionalLinksButton() {
await this.page.getByTestId('btn-pensil').click();
await this.page.getByRole('button', { name: 'plusIcon Добавить' }).click();
}
async fillAdditionalLinksInfo() {
await this.page.getByRole('textbox', { name: 'Название' }).fill('Тестовая платформа');
await this.page.getByRole('textbox', { name: 'Вставьте ссылку' }).fill('https://github.com/vsmykov');
}
async clickAdditionalLinksSaveButton() {
await this.page.getByRole('button', { name: 'Сохранить' }).click();
}
}

View File

@@ -1 +1 @@
{"email":"testuser1770382880998@virgilian.com","password":"!Test123456","login":"user_9im58j","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzAzODI4ODEsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwMzgyODgwOTk4QHZpcmdpbGlhbi5jb20iLCJpZCI6IjY5ODVlNjIxNTMzYjdmZmY5YjBkZWZhOCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OTg1ZTYyMTUzM2I3ZmZmOWIwZGVmYTgiXX19.mO_8aGsS6FxHX53EzTXbnm063zSeKfaqR79Ls280VY54rE2Hhb32RtoD8ECYynRAeJZJekXzGZnD0ciBSFz3zA"}
{"email":"testuser1770898568523@dollicons.com","password":"!Test123456","login":"user_vwqo3m","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzA4OTg1NjksInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwODk4NTY4NTIzQGRvbGxpY29ucy5jb20iLCJpZCI6IjY5OGRjNDg5MDNlZTQ5OWNkYjBhZDY3NCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OThkYzQ4OTAzZWU0OTljZGIwYWQ2NzQiXX19._iJUK5fg6n4nuG16K1yKqheaNd7ItjXctNAyu7F-kLHIaluoFU73dItBWgszKoZgrbD5gc1GBG3YK5V-5ds-qQ"}

View File

@@ -4,40 +4,90 @@ 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);
test.describe('UI: Личный кабинет абитуриента', () => {
test.beforeEach(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 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.goto();
});
// Редактирование представителя
await profilePage.openRepresentativeEditor();
await profilePage.fillRepresentative(
'Мать',
'Иванова Мария Петровна',
'+7 (900) 123-45-67'
);
await profilePage.saveRepresentative();
test('UI: Личный кабинет абитуриента — заполнение профиля', async ({ page }) => {
const loginPage = new LoginPage(page);
const profilePage = new ProfileApplicantPage(page);
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 profilePage.openDisabilityEditor();
await profilePage.selectDisability('Нарушение слуха');
await profilePage.selectDisabilityGroup('I группа');
await profilePage.saveDisabilityInfo();
await expect(page).toHaveURL(/.*\/account\/profile/);
});
test('UI: Личный кабинет абитуриента — прохождение теста', async ({ page }) => {
const loginPage = new LoginPage(page);
const profilePage = new ProfileApplicantPage(page);
await profilePage.openTestsPage();
await expect(page.getByRole('button', { name: 'Посмотреть результаты' })).toBeVisible();
});
test('UI: Личный кабинет абитуриента — заполнение портфолио', async ({ page }) => {
const loginPage = new LoginPage(page);
const profilePage = new ProfileApplicantPage(page);
//Достижения
await profilePage.openPortfolioPage();
await profilePage.clickAchievementButton();
await profilePage.fillAchievementInfo();
await profilePage.uploadAchievement(path.resolve('fixtures', 'achievement_information.pdf'));
await profilePage.clickAchievementSaveButton();
await expect(page.getByRole('heading', { name: 'Тестовое достижение' })).toBeVisible();
await expect(page.getByText('2026', { exact: true })).toBeVisible();
await expect(page.getByRole('link', { name: 'achievement_information.pdf' })).toBeVisible();
//Образование
await profilePage.clickEducationButton();
await profilePage.fillEducationInfo();
await profilePage.uploadEducation(path.resolve('fixtures', 'education_information.pdf'));
await profilePage.clickEducationSaveButton();
await expect(page.getByRole('heading', { name: 'Тестовое заведение' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Тестовая специальность' })).toBeVisible();
await expect(page.getByText('- 2026')).toBeVisible();
await expect(page.getByText('Форма обучения: Очная')).toBeVisible();
await expect(page.getByText('Основа обучения: Бюджет')).toBeVisible();
await expect(page.getByText('Уровень образования: Бакалавриат')).toBeVisible();
//Опыт работы
await profilePage.clickWorkExpButton();
await profilePage.fillWorkExpInfo();
await profilePage.uploadWorkExp(path.resolve('fixtures', 'workExp_information.pdf'));
await profilePage.clickWorkExpSaveButton();
//Дополнительные ссылки
await profilePage.clickAdditionalLinksButton();
await profilePage.fillAdditionalLinksInfo();
await profilePage.clickAdditionalLinksSaveButton();
})
})
// Проверка, что остались на профиле
await expect(page).toHaveURL(/.*\/account\/profile/);
});