diff --git a/components/find_tutor.py b/components/find_tutor.py index 3727cd02..2059c9a2 100644 --- a/components/find_tutor.py +++ b/components/find_tutor.py @@ -176,7 +176,7 @@ def check_btn_more_is_visible(self): btn_more = self.page.locator('(//a[text()="Подробнее"])[1]') assert btn_more.is_visible() - @allure.step('Проверяем кнопку "Подробнее" на клиабильность') + @allure.step('Проверяем кнопку "Подробнее" на кликабильность') def check_btn_more_is_clickable(self): btn_more = self.page.locator('(//a[text()="Подробнее"])[1]') btn_more.click() @@ -209,3 +209,46 @@ def enter_min_experience(self, min_experience: int): experience_field.is_enabled() ), "The 'Minimum Teaching Experience' field is not enabled." experience_field.fill(str(min_experience)) + + @allure.step('Проверяем страница Профайл репетитора содержит требующие детали') + def check_tutor_profile_has_require_details(self): + # Verify Tutor name + tutor_name = self.page.locator('//h2[@class="fw-bold"]') + assert tutor_name.is_visible(), "Element Tutor name is not visible" + name_text = tutor_name.inner_text().strip() + assert name_text != "", "Text Tutor name has empty text" + # Verify Tutor category + tutor_category = self.page.locator('//p[@class="mb-3 text-muted"]') + assert tutor_category.is_visible(), "Element Tutor category is not visible" + category_text = tutor_category.inner_text().strip() + assert category_text != "", "Text Tutor category has empty text" + # Verify Lesson details + lesson_details = self.page.locator('//div/p[@class="mb-0"]') + count_ld_items = lesson_details.count() + for i in range(count_ld_items): + elem = lesson_details.nth(i) + assert elem.is_visible(), f"Element Lesson details at index {i} is not visible" + elem_text = elem.inner_text().strip() + assert elem_text != "", f"Text Lesson details at index {i} is empty" + # Verify Tutor details + tutor_details = self.page.locator('//article/p[@class="text-dark"]') + count_td_items = tutor_details.count() + for i in range(count_td_items): + elem = tutor_details.nth(i) + assert elem.is_visible(), "Element Tutor details is not visible" + elem_text = elem.inner_text().strip() + assert elem_text != "", "Text Tutor details is empty" + + @allure.step('Проверяем страница Профайл репетитора содержит кнопку "Хочу заниматься!"') + def check_tutor_profile_has_btn_request_lesson(self): + request_btn = self.page.locator('//a[@class="btn-primary btn btn-lg"]') + assert request_btn.is_visible() + + @allure.step('Проверяем кнопку "Хочу заниматься!" на кликабильность') + def check_tutor_profile_btn_request_lesson_clickable_redirect(self): + request_btn = self.page.locator('//a[@class="btn-primary btn btn-lg"]') + request_btn.click() + assert self.page.url == ( + "http://tester:dslfjsdfblkhew%40122b1klbfw@testing.misleplav.ru/listings/lesson_request/1/" + ) + diff --git a/tests/test_find_tutor.py b/tests/test_find_tutor.py index c7894db5..0421dc25 100644 --- a/tests/test_find_tutor.py +++ b/tests/test_find_tutor.py @@ -72,3 +72,30 @@ def test_btn_more_find_tutor_has_each_profile(login, header, find_tutor): header.visit() login.full_login("acc.python.test@gmail.com", "jUvJ5ZSxzdIr") find_tutor.check_btn_more_has_each_profile() + +@allure.title("TC_37.001.001.001") +@allure.link("https://github.com/RedRoverSchool/BookClubQA_Python_2024_fall/issues/416") +# TC_37.001.001.001 [Student ] Find a teacher > More > Verify tutor profile contains full details +def test_tutor_profile_has_require_details(login, header, find_tutor): + header.visit() + login.full_login("acc.python.test@gmail.com", "jUvJ5ZSxzdIr") + find_tutor.check_btn_more_is_clickable() + find_tutor.check_tutor_profile_has_require_details() + +@allure.title("TC_37.001.001.002") +@allure.link("https://github.com/RedRoverSchool/BookClubQA_Python_2024_fall/issues/416") +# TC_37.001.001.002 [Student ] Find a teacher > More > Verify the tutor profile has the button "Хочу заниматься!" +def test_tutor_profile_has_btn_request_lesson(login, header, find_tutor): + header.visit() + login.full_login("acc.python.test@gmail.com", "jUvJ5ZSxzdIr") + find_tutor.check_btn_more_is_clickable() + find_tutor.check_tutor_profile_has_btn_request_lesson() + +@allure.title("TC_37.001.001.003") +@allure.link("https://github.com/RedRoverSchool/BookClubQA_Python_2024_fall/issues/416") +# TC_37.001.001.003 [Student ] Find a teacher > More > Verify the button "Хочу заниматься!" is clickable and redirectable +def test_tutor_profile_btn_request_lesson_clickable_redirect(login, header, find_tutor): + header.visit() + login.full_login("acc.python.test@gmail.com", "jUvJ5ZSxzdIr") + find_tutor.check_btn_more_is_clickable() + find_tutor.check_tutor_profile_btn_request_lesson_clickable_redirect()