94 lines
4.2 KiB
TypeScript
94 lines
4.2 KiB
TypeScript
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.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 profilePage.goto();
|
|
});
|
|
|
|
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 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();
|
|
})
|
|
|
|
})
|
|
|