Skip to content

Commit

Permalink
feat: ref 13.01.20_Tranfer_the_locator_to_the_test (#338)
Browse files Browse the repository at this point in the history
* feat: ref 13.01.20
update test_main_page.py, main_page.py

* feat: delete extra lines
update test_main_page.py
  • Loading branch information
alena-krauchuk authored Oct 7, 2023
1 parent f34c1d0 commit f49b29e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions pages/main_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'"""
Expand Down Expand Up @@ -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'"""
Expand Down
5 changes: 3 additions & 2 deletions tests/test_main_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'"
Expand Down

0 comments on commit f49b29e

Please sign in to comment.