diff --git a/Data/data.py b/Data/data.py index fbe7fe59..5764ede1 100644 --- a/Data/data.py +++ b/Data/data.py @@ -11,6 +11,12 @@ invalid_login = "q-" invalid_password = "p===" +EMAIL_TUTOR_KM = "tutor_testing@bk.ru" +PASSWORD_TUTOR_KM = "I165TVAzghk8" + +EMAIL_STUDENT_KM = "student-test-misliplav@mail.ru" +PASSWORD_STUDENT_KM = "JXvNebAMsWb7" + def generate_valid_password(): # Определим минимальную длину пароля diff --git a/components/announcement.py b/components/announcement.py index 56840cfd..d95fd8a0 100644 --- a/components/announcement.py +++ b/components/announcement.py @@ -265,29 +265,60 @@ def create_announcement_with_only_required_fields(self): self.fill_out_convenient_time() self.click_save_announcement_btn() - @allure.step("Проверяем, что все обязательные поля отмечены '*'/ 'Обязательное поле'") + @allure.step( + "Проверяем, что все обязательные поля отмечены '*'/ 'Обязательное поле'" + ) def mandatory_fields_are_marked_check(self): fields_to_check = [ - ("//label[@for='id_first_name']//span[@class='asteriskField']", "id_first_name"), - ("//label[@for='id_last_name']//span[@class='asteriskField']", "id_last_name"), - ("//label[@for='id_telegram']//span[@class='asteriskField']", "id_telegram"), + ( + "//label[@for='id_first_name']//span[@class='asteriskField']", + "id_first_name", + ), + ( + "//label[@for='id_last_name']//span[@class='asteriskField']", + "id_last_name", + ), + ( + "//label[@for='id_telegram']//span[@class='asteriskField']", + "id_telegram", + ), ("//label[@for='id_phone']//span[@class='asteriskField']", "id_phone"), - ("//label[@for='id_description']//span[@class='asteriskField']", "id_description"), - ("//legend[@class='form-label requiredField']//span[@class='asteriskField']", "student_category"), - ("//label[@for='id_can_help']//span[@class='asteriskField']", "id_can_help"), - ("//label[@for='id_category']//span[@class='asteriskField']", "id_category"), - ("//label[@for='id_years_of_experience']//span[@class='asteriskField']", "id_years_of_experience"), + ( + "//label[@for='id_description']//span[@class='asteriskField']", + "id_description", + ), + ( + "//legend[@class='form-label requiredField']//span[@class='asteriskField']", + "student_category", + ), + ( + "//label[@for='id_can_help']//span[@class='asteriskField']", + "id_can_help", + ), + ( + "//label[@for='id_category']//span[@class='asteriskField']", + "id_category", + ), + ( + "//label[@for='id_years_of_experience']//span[@class='asteriskField']", + "id_years_of_experience", + ), ("//label[@for='id_price']//span[@class='asteriskField']", "id_price"), - ("//label[@for='id_class_duration']//span[@class='asteriskField']", "id_class_duration"), + ( + "//label[@for='id_class_duration']//span[@class='asteriskField']", + "id_class_duration", + ), ] for locator, field_name in fields_to_check: field_mark = self.page.locator(locator) - assert field_mark.is_visible(), f"Отметка поля с локатором {field_name} не найдена" - - download_photo_title_text = self.page.get_by_text("Рекомендуемое разрешение:").inner_text() - assert "Обязательное поле." in download_photo_title_text, ( - f"Текст 'Обязательное поле.' не найден в {download_photo_title_text}" - ) - + assert ( + field_mark.is_visible() + ), f"Отметка поля с локатором {field_name} не найдена" + download_photo_title_text = self.page.get_by_text( + "Рекомендуемое разрешение:" + ).inner_text() + assert ( + "Обязательное поле." in download_photo_title_text + ), f"Текст 'Обязательное поле.' не найден в {download_photo_title_text}" diff --git a/components/header.py b/components/header.py index 6f323035..67367d38 100644 --- a/components/header.py +++ b/components/header.py @@ -42,7 +42,7 @@ def support_button_should_be_visible(self): @allure.step("Кликаем на кнопку 'Поддержка'") def click_support_button(self): - button = self.page.locator('//*[@id="navbarNav"]/ul/li[3]/a') + button = self.page.locator("//a[text()='Поддержка']") button.click() expect(self.page).to_have_url("https://t.me/misleplav_support_bot") diff --git a/tests/test_announcement.py b/tests/test_announcement.py index 534f65a8..6e7704e6 100644 --- a/tests/test_announcement.py +++ b/tests/test_announcement.py @@ -138,4 +138,4 @@ def test_mandatory_fields_marked(header, login, announcement): login.full_login("teacher-test@yopmail.com", "5uR94zLhF80r") announcement.click_my_announcement_button() announcement.click_edit_announcement_button() - announcement.mandatory_fields_are_marked_check() \ No newline at end of file + announcement.mandatory_fields_are_marked_check() diff --git a/tests/test_header.py b/tests/test_header.py index 7b3dbe81..f77c300b 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -1,15 +1,19 @@ +import allure import pytest from core.settings import pages_urls_for_guest from core.settings import site_pages_urls from playwright.sync_api import Page +from Data import data +@allure.label("test_case_id", "TC_02.001.001.004") def test_login_button_opens_login_page(header, login): header.visit() header.click_login_button() login.check_url_login_page("/login") +@allure.label("test_case_id", "TC_02.002.001.001") def test_verify_registration_options_on_registration_page(header, register): header.visit() header.click_registration_button() @@ -28,24 +32,17 @@ def test_verify_registration_options_on_find_tutor_page(header, find_tutor): find_tutor.check_title_of_registration() +@allure.label("test_case_id", "TC_11.003.001.001") def test_support_visibility_as_teacher(login, header): header.visit() login.full_login("teacher-test@gmail.com", "Auah7bD2hS5Si7H") header.support_button_should_be_visible() -@pytest.mark.parametrize( - "user_registration_cleanup", [("teacher", True, False)], indirect=True -) -@pytest.mark.skip(reason="Тест временно отключен после обновления 09.01.2025") -def test_support_clickability_as_teacher( - login, header, user_registration_cleanup, api_request -): - email, password = user_registration_cleanup +@allure.label("test_case_id", "TC_11.003.001.002") +def test_support_clickability_as_teacher(header, login): header.visit() - header.click_login_button() - login.full_login(email, password) - print(email, password) + login.full_login(data.EMAIL_TUTOR_KM, data.PASSWORD_TUTOR_KM) header.click_support_button()