Skip to content

Commit 2521b3b

Browse files
Merge pull request #592 from Brain-up/issue_478
Issue_478_EXERCISES_SIMILAR_PHRASES_RU_PAGE_links
2 parents 4e13609 + 645553a commit 2521b3b

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

locators/exercises_ru_similar_phrases_page_locators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ class ExercisesRuSimilarPhrasesPageLocators:
1717
PAGE_LIST1_3 = (By.XPATH, '(//ul[@aria-label="Breadcrumbs"]//a)[3]')
1818
PAGE_LIST2 = (By.XPATH, "//aside//button")
1919
PAGE_LIST3 = (By.XPATH, '//div[contains(@class, "series-page")]//a')
20+
PAGE_LIST3_1 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[1]')
21+
PAGE_LIST3_2 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[2]')
22+
PAGE_LIST3_3 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[3]')
23+
PAGE_LIST3_4 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[4]')
24+
PAGE_LIST3_5 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[5]')
25+
PAGE_LIST3_6 = (By.XPATH, '(//div[contains(@class, "series-page")]//a)[6]')
2026
CARD_IMAGES_LIST4 = (By.XPATH, '//div[contains(@style, "svg")]')

pages/exercises_ru_similar_phrases_page.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,22 @@ def click_on_group_links(self):
193193
Wait(self.driver, self.timeout).until(EC.url_changes(self.get_current_tab_url()))
194194
opened_pages.append(self.get_current_tab_url())
195195

196+
return opened_pages
197+
198+
@allure.step("""Click on subgroup links and thereby open corresponding web pages in the same tab""")
199+
def click_on_subgroup_links(self):
200+
subgroup_locators = [self.locators.PAGE_LIST3_1, self.locators.PAGE_LIST3_2,
201+
self.locators.PAGE_LIST3_3, self.locators.PAGE_LIST3_4,
202+
self.locators.PAGE_LIST3_5, self.locators.PAGE_LIST3_6]
203+
group_page_url = self.get_current_tab_url()
204+
opened_pages = []
205+
206+
for link_locator in subgroup_locators:
207+
self.element_is_clickable(link_locator).click()
208+
Wait(self.driver, self.timeout).until(EC.url_changes(group_page_url))
209+
opened_pages.append(self.get_current_tab_url())
210+
self.driver.back()
211+
Wait(self.driver, self.timeout).until(EC.url_to_be(group_page_url))
212+
196213
print(*opened_pages, sep='\n')
197214
return opened_pages

tests/exercises_ru_similar_phrases_page_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,11 @@ def test_ersp_03_05_verify_group_links_navigation(self, driver, exercises_ru_sim
151151
opened_pages = page.click_on_group_links()
152152
assert opened_pages, "Transitions to pages have not performed"
153153
assert all(element in erspPD.group_link_urls for element in opened_pages), "Links lead to incorrect pages"
154+
155+
@allure.title("Verify if subgroup links lead to correct pages after clicking")
156+
def test_ersp_03_06_verify_subgroup_links_navigation(self, driver, exercises_ru_similar_phrases_page_open):
157+
page = erspPage(driver)
158+
opened_pages = page.click_on_subgroup_links()
159+
assert opened_pages, "Transitions to pages have not performed"
160+
assert all(element in erspPD.subgroup_link_urls for element in opened_pages), \
161+
"Links lead to incorrect pages"

0 commit comments

Comments
 (0)