diff --git a/common_fixtures.py b/common_fixtures.py index 8775150..1bd36df 100644 --- a/common_fixtures.py +++ b/common_fixtures.py @@ -40,3 +40,15 @@ def login(driver): time.sleep(2) driver.switch_to.default_content() yield driver + + +@pytest.mark.order(3) +@pytest.fixture() +def open_profile(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) + yield login \ No newline at end of file diff --git a/test_profile_module.py b/test_profile_module.py index 6de999c..108d8fd 100644 --- a/test_profile_module.py +++ b/test_profile_module.py @@ -1,4 +1,4 @@ -from common_fixtures import driver, login +from common_fixtures import driver, login, open_profile from selenium.webdriver.common.by import By import time @@ -20,13 +20,8 @@ def switcher(driver, ind): 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) +def test_navigation(open_profile): + login = open_profile 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()