diff --git a/.DS_Store b/.DS_Store index 2b9639e..11a20f3 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/fixtures/.DS_Store b/fixtures/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/fixtures/.DS_Store differ diff --git a/fixtures/avatar.png b/fixtures/avatar.png new file mode 100644 index 0000000..ee2c72e Binary files /dev/null and b/fixtures/avatar.png differ diff --git a/page-objects/UsersAccount/ProfileApplicantPage.ts b/page-objects/UsersAccount/ProfileApplicantPage.ts new file mode 100644 index 0000000..89ce0c5 --- /dev/null +++ b/page-objects/UsersAccount/ProfileApplicantPage.ts @@ -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(); + } +} diff --git a/temp/user.json b/temp/user.json index 0d849e0..473c7aa 100644 --- a/temp/user.json +++ b/temp/user.json @@ -1 +1 @@ -{"email":"testuser1770028019439@virgilian.com","password":"!Test123456","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzAwMjgwMjAsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwMDI4MDE5NDM5QHZpcmdpbGlhbi5jb20iLCJpZCI6IjY5ODA3YmY0NmFiNTlkMDJiMzBhMzNhOCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OTgwN2JmNDZhYjU5ZDAyYjMwYTMzYTgiXX19.xWXF4bN07584CE0AGiuUfH7XpNLNKFRp7DnLQbbf1jhzRHPgQuHaqh39_lShcFSl5GU1Hxqdk41s9yJMBFkuYw"} \ No newline at end of file +{"email":"testuser1770382880998@virgilian.com","password":"!Test123456","login":"user_9im58j","mailToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE3NzAzODI4ODEsInJvbGVzIjpbIlJPTEVfVVNFUiJdLCJhZGRyZXNzIjoidGVzdHVzZXIxNzcwMzgyODgwOTk4QHZpcmdpbGlhbi5jb20iLCJpZCI6IjY5ODVlNjIxNTMzYjdmZmY5YjBkZWZhOCIsIm1lcmN1cmUiOnsic3Vic2NyaWJlIjpbIi9hY2NvdW50cy82OTg1ZTYyMTUzM2I3ZmZmOWIwZGVmYTgiXX19.mO_8aGsS6FxHX53EzTXbnm063zSeKfaqR79Ls280VY54rE2Hhb32RtoD8ECYynRAeJZJekXzGZnD0ciBSFz3zA"} \ No newline at end of file diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000..8dd642b Binary files /dev/null and b/tests/.DS_Store differ diff --git a/tests/api/registration/register-applicant.api.spec.ts b/tests/api/registration/register-applicant.api.spec.ts index 9adfd1a..5f1d0f3 100644 --- a/tests/api/registration/register-applicant.api.spec.ts +++ b/tests/api/registration/register-applicant.api.spec.ts @@ -45,8 +45,9 @@ test('API: регистрация абитуриента + подтвержде fs.writeFileSync('temp/user.json', JSON.stringify({ email, - password: '!Test123456', - mailToken + password: '!Test123456', + login, + mailToken })); diff --git a/tests/suites/all-api-tests.serial.spec.ts b/tests/suites/all-api-tests.serial.spec.ts new file mode 100644 index 0000000..7ebbda5 --- /dev/null +++ b/tests/suites/all-api-tests.serial.spec.ts @@ -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'); + +}); diff --git a/tests/suites/all-ui-tests.serial.spec.ts b/tests/suites/all-ui-tests.serial.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/tests/ui/.DS_Store b/tests/ui/.DS_Store new file mode 100644 index 0000000..ed309ef Binary files /dev/null and b/tests/ui/.DS_Store differ diff --git a/tests/ui/account/profile-applicant.spec.ts b/tests/ui/account/profile-applicant.spec.ts new file mode 100644 index 0000000..5990726 --- /dev/null +++ b/tests/ui/account/profile-applicant.spec.ts @@ -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/); +});