Files
playwright-tests-ssas/allure-results/fbcffb41-682b-4a9e-bd19-1de068d13574-attachment.md

155 lines
6.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: Негативные сценарии регистрации >> Некорректный email формат
- Location: /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/registration/register.negative.spec.ts:28:7
# Error details
```
Error: page.goto: Target page, context or browser has been closed
Call log:
- navigating to "https://ssas.dev.rdcenter.ru/login/registration", waiting until "load"
at RegisterPage.goto (/Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/page-objects/RegisterPage.ts:81:21)
at /Users/vladsmykov/Desktop/Work/AUTOTESTS/CCPC_playwright/tests/ui/registration/register.negative.spec.ts:30:24
```
# Test source
```ts
1 | import { Page, Locator } from '@playwright/test';
2 |
3 | export class RegisterPage {
4 | readonly page: Page;
5 |
6 | // Поля ввода
7 | readonly nameInput: Locator;
8 | readonly surnameInput: Locator;
9 | readonly patronymicInput: Locator;
10 | readonly academicTitleInput: Locator;
11 | readonly degreeInput: Locator;
12 | readonly positionInput: Locator;
13 | readonly organizationInput: Locator;
14 | readonly emailInput: Locator;
15 | readonly phoneInput: Locator;
16 | readonly passwordInput: Locator;
17 | readonly confirmPasswordInput: Locator;
18 |
19 | // Глазики
20 | readonly passwordToggle: Locator;
21 | readonly confirmPasswordToggle: Locator;
22 |
23 | // Кнопка регистрации
24 | readonly submitButton: Locator;
25 |
26 | // Ссылка "Авторизируйтесь"
27 | readonly loginLink: Locator;
28 |
29 | // Ошибки валидации
30 | readonly requiredFieldErrors: Locator;
31 | readonly nameError: Locator;
32 | readonly surnameError: Locator;
33 | readonly positionError: Locator;
34 | readonly emailFormatError: Locator;
35 | readonly passwordLengthError: Locator;
36 | readonly confirmPasswordRequiredError: Locator;
37 |
38 | // Модалки
39 | readonly duplicateUserModal: Locator;
40 | readonly invalidOrgModal: Locator;
41 |
42 | constructor(page: Page) {
43 | this.page = page;
44 |
45 | // Инпуты
46 | this.nameInput = page.getByPlaceholder('Имя*');
47 | this.surnameInput = page.getByPlaceholder('Фамилия*');
48 | this.patronymicInput = page.getByPlaceholder('Отчество');
49 | this.academicTitleInput = page.getByPlaceholder('Учёное звание*');
50 | this.degreeInput = page.getByPlaceholder('Учёная степень*');
51 | this.positionInput = page.getByPlaceholder('Должность');
52 | this.organizationInput = page.getByPlaceholder('Организация*');
53 | this.emailInput = page.getByPlaceholder('Email (логин)*');
54 | this.phoneInput = page.getByPlaceholder('Номер телефона*');
55 | this.passwordInput = page.getByPlaceholder('Придумайте пароль*');
56 | this.confirmPasswordInput = page.getByPlaceholder('Повторите пароль*');
57 |
58 | // Глазики
59 | this.passwordToggle = page.locator('input[name="password"] + img');
60 | this.confirmPasswordToggle = page.locator('input[name="confirmPassword"] + img');
61 |
62 | // Кнопки
63 | this.submitButton = page.getByRole('button', { name: 'Зарегистрироваться' });
64 | this.loginLink = page.getByText('Авторизируйтесь');
65 |
66 | // Ошибки
67 | this.requiredFieldErrors = page.locator('div[name="error"]', { hasText: 'Поле обязательно для заполнения' });
68 | this.nameError = page.getByText('Некорректное имя');
69 | this.surnameError = page.getByText('Некорректная фамилия');
70 | this.positionError = page.getByText('Не более 200 символов!');
71 | this.emailFormatError = page.getByText('Некорректный Email');
72 | this.passwordLengthError = page.getByText('Не менее 8 символов');
73 | this.confirmPasswordRequiredError = page.getByText('Поле обязательно для заполнения');
74 |
75 | // Модальные окна
76 | this.duplicateUserModal = page.getByText('Пользователь с таким email или телефоном уже зарегистрирован!');
77 | this.invalidOrgModal = page.getByText('Некорректное название организации!');
78 | }
79 |
80 | async goto() {
> 81 | await this.page.goto('/login/registration');
| ^ Error: page.goto: Target page, context or browser has been closed
82 | }
83 |
84 | async register(data: {
85 | name: string,
86 | surname: string,
87 | patronymic?: string,
88 | academicTitle: string,
89 | degree: string,
90 | position?: string,
91 | organization: string,
92 | email: string,
93 | phone: string,
94 | password: string,
95 | confirmPassword: string
96 | }) {
97 | await this.nameInput.fill(data.name);
98 | await this.surnameInput.fill(data.surname);
99 | if (data.patronymic) await this.patronymicInput.fill(data.patronymic);
100 | await this.academicTitleInput.click();
101 | await this.page.locator('li', { hasText: data.academicTitle }).click();
102 | await this.degreeInput.click();
103 | await this.page.locator('li', { hasText: data.degree }).click();
104 | if (data.position) await this.positionInput.fill(data.position);
105 | await this.organizationInput.fill(data.organization);
106 | await this.emailInput.fill(data.email);
107 | await this.phoneInput.fill(data.phone);
108 | await this.passwordInput.fill(data.password);
109 | await this.confirmPasswordInput.fill(data.confirmPassword);
110 | await this.submitButton.click();
111 | }
112 |
113 | async fillName(name: string) {
114 | await this.nameInput.fill(name);
115 | }
116 |
117 | async fillSurname(surname: string) {
118 | await this.surnameInput.fill(surname);
119 | }
120 |
121 | async fillEmail(email: string) {
122 | await this.emailInput.fill(email);
123 | }
124 |
125 | async fillPosition(position: string) {
126 | await this.positionInput.fill(position);
127 | }
128 |
129 | async submit() {
130 | await this.submitButton.click();
131 | }
132 |
133 | }
134 |
```