Files
playwright-tests-ssas/allure-results/8e550857-0ec2-4f96-8cf8-274432a5d92f-attachment.md

63 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Test info
- Name: Позитивные сценарии регистрации >> Успешная регистрация нового пользователя
- Location: /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/registration/register.spec.ts:6:7
# Error details
```
Error: locator.isVisible: Target page, context or browser has been closed
Call log:
- checking visibility of locator('p.ErrorModal_title__heTm5')
at /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/registration/register.spec.ts:32:26
```
# Test source
```ts
1 | import { test, expect } from '@playwright/test';
2 | import { RegisterPage } from '../../../page-objects/RegisterPage';
3 |
4 | test.describe('Позитивные сценарии регистрации', () => {
5 |
6 | test('Успешная регистрация нового пользователя', async ({ page }) => {
7 | const registerPage = new RegisterPage(page);
8 | await registerPage.goto();
9 |
10 | // Генерация уникального email и телефона
11 | const randomSuffix = Math.floor(Math.random() * 100000);
12 | const uniqueEmail = `autotest${randomSuffix}@example.com`;
13 | const uniquePhone = `+7987${randomSuffix.toString().padStart(6, '0')}`;
14 |
15 | // Заполнение формы
16 | await registerPage.register({
17 | name: 'Иван',
18 | surname: 'Тестов',
19 | patronymic: 'Александрович',
20 | academicTitle: 'Доцент',
21 | degree: 'Кандидат наук',
22 | position: 'Преподаватель',
23 | organization: 'ЮФУ',
24 | email: uniqueEmail,
25 | phone: uniquePhone,
26 | password: '!Test123456', // более надёжный
27 | confirmPassword: '!Test123456'
28 | });
29 |
30 | // --- ВСТАВКА ДЛЯ ОТЛАДКИ ---
31 | const errorModal = page.locator('p.ErrorModal_title__heTm5');
> 32 | if (await errorModal.isVisible()) {
| ^ Error: locator.isVisible: Target page, context or browser has been closed
33 | const msg = await errorModal.textContent();
34 | throw new Error(`Регистрация не удалась. Модалка: "${msg}"`);
35 | }
36 |
37 | // Ждём, что будет редирект
38 | await expect(page).toHaveURL(/\/login\/confirmLogin/);
39 | await expect(page.locator('text=Подтвердите адрес электронной почты')).toBeVisible();
40 | });
41 |
42 | });
43 |
```