42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
|
from common_fixtures import driver, login
|
||
|
from selenium.webdriver.common.by import By
|
||
|
import time
|
||
|
|
||
|
|
||
|
def switcher(driver, ind):
|
||
|
driver.find_element(
|
||
|
By.XPATH, "//*[@id='root']/div/div[1]/div[1]/div[1]/button[1]/img").click()
|
||
|
element = driver.find_element(
|
||
|
By.XPATH, f"/html/body/div[2]/nav/a[{ind}]")
|
||
|
to_check1 = element.text
|
||
|
element.click()
|
||
|
to_check2 = driver.find_element(
|
||
|
By.CLASS_NAME, 'overlay-header__info-text').get_attribute("textContent")
|
||
|
res = (to_check1 == to_check2)
|
||
|
time.sleep(1)
|
||
|
return res
|
||
|
|
||
|
|
||
|
def test_navigation(login):
|
||
|
profile_icon_main = login.find_element(
|
||
|
By.XPATH, "//*[@id='root']/div/div/nav/div/div[1]/div")
|
||
|
login.execute_script(
|
||
|
"arguments[0].scrollIntoView(true);", profile_icon_main)
|
||
|
profile_icon_main.click()
|
||
|
time.sleep(2)
|
||
|
the_iframe_window = login.find_element(By.ID, "kw-iframe")
|
||
|
login.switch_to.frame(the_iframe_window)
|
||
|
login.find_element(By.CLASS_NAME, 'button-back').click()
|
||
|
profile_icon_window = login.find_element(
|
||
|
By.XPATH, "//*[@id='root']/div/div[1]/div[1]/div[1]/button[1]/img")
|
||
|
profile_icon_window.click()
|
||
|
menu_len = len(login.find_elements(By.CLASS_NAME, 'account-menu__item'))
|
||
|
profile_icon_window.click()
|
||
|
|
||
|
res = True
|
||
|
for ind in range(menu_len):
|
||
|
res = res and switcher(
|
||
|
login, ind + 1)
|
||
|
login.switch_to.default_content()
|
||
|
assert res == True
|