From f49b29eb3fdce122e50cf9183b9bd2e94b548a27 Mon Sep 17 00:00:00 2001 From: Alena Krauch <94075420+alena-krauchuk@users.noreply.github.com> Date: Sun, 8 Oct 2023 00:25:41 +0300 Subject: [PATCH] feat: ref 13.01.20_Tranfer_the_locator_to_the_test (#338) * feat: ref 13.01.20 update test_main_page.py, main_page.py * feat: delete extra lines update test_main_page.py --- pages/main_page.py | 10 ++++------ tests/test_main_page.py | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pages/main_page.py b/pages/main_page.py index 91749cb343..17322d2962 100644 --- a/pages/main_page.py +++ b/pages/main_page.py @@ -249,6 +249,10 @@ def check_element_image_is_visible(self, element): def check_image_src(self, element): return element.get_attribute("src") + @allure.step("Get the element text") + def get_element_text(self, element): + return element.text + @allure.step("Check the image in section 2 block 5 'home-eco' is correct in the Promo Block") def check_image_in_section2_block5(self): """Checks the image in block 5 'home-eco'""" @@ -316,12 +320,6 @@ def check_info_block_text_in_section2_block5(self): info_block_text = self.find_element(self.locators.SECTION_2_BLOCK_5_INFO_BLOCK_TEXT).text return info_block_text - @allure.step("Check the sign of info block in section 2 block 1 'home-pants' in the Promo Block is correct") - def check_info_block_sign_in_section2_block1(self): - """Checks the sign in info-block in block 1 'home-pants'""" - info_block_sign = self.find_element(self.locators.SECTION_2_BLOCK_1_INFO_BLOCK_SIGN).text - return info_block_sign - @allure.step("Check the sign of info block in section 2 block 2 'home-t-shirts' in the Promo Block is correct") def check_info_block_sign_in_section2_block2(self): """Checks the sign in info-block in block 2 'home-t-shirts'""" diff --git a/tests/test_main_page.py b/tests/test_main_page.py index 8de0c5cf97..de6f3f0256 100644 --- a/tests/test_main_page.py +++ b/tests/test_main_page.py @@ -287,10 +287,11 @@ def test_tc_13_01_19_check_info_block_text_in_section2_block1(self, driver): @allure.title("TC 13.01.20 - Check the display of the sign in block 1 'home-pants' in the Promo Block") def test_tc_13_01_20_check_info_block_sign_in_section2_block1(self, driver): """This test checks if the sign in info block in section 2 block 1 'home-pants' is correct - in the Promo Block under header on the main page""" + in the Promo Block under header on the Main Page""" page = PromoBlock(driver, MAIN_PAGE_URL) page.open() - actual_text = page.check_info_block_sign_in_section2_block1() + section2_block1_sign = page.find_element(self.locators.SECTION_2_BLOCK_1_INFO_BLOCK_SIGN) + actual_text = page.get_element_text(section2_block1_sign) expected_text = PromoBlockElementsText.SECTION_2_BLOCK_1_INFO_BLOCK_SIGN assert actual_text == expected_text, f"Actual sign '{actual_text}' in info block in section 2 block 1 " \ f"'home-pants' of Promo Block doesn't match expected '{expected_text}'"