Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
# Определим минимальную длину пароля
Expand Down
65 changes: 48 additions & 17 deletions components/announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 1 addition & 1 deletion components/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_announcement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
announcement.mandatory_fields_are_marked_check()
19 changes: 8 additions & 11 deletions tests/test_header.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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()


Expand Down
Loading