diff --git a/test_information_module.py b/test_information_module.py index 9c44530..3a4a578 100644 --- a/test_information_module.py +++ b/test_information_module.py @@ -2,6 +2,7 @@ from common_fixtures import driver, login from selenium.webdriver.common.by import By import time + def test_header_len(driver): header = driver.find_elements(By.CLASS_NAME, 'menu__item') assert len(header) > 0 @@ -20,14 +21,17 @@ def test_header_navigation(driver): def test_feedback(login): - feedback_button = login.find_element(By.XPATH, "//*[@id='root']/div/div/nav/div/div[2]/button") + feedback_button = login.find_element( + By.XPATH, "//*[@id='root']/div/div/nav/div/div[2]/button") login.execute_script("arguments[0].scrollIntoView(true);", feedback_button) feedback_button.click() time.sleep(2) textarea = login.find_element(By.CLASS_NAME, 'textarea') textarea.send_keys('a') - send_button = login.find_element(By.XPATH, '/html/body/div[3]/div/div[2]/div/div/div/div[3]/button') + send_button = login.find_element( + By.XPATH, '/html/body/div[3]/div/div[2]/div/div/div/div[3]/button') send_button.click() time.sleep(1) - success_img = login.find_element(By.XPATH, '/html/body/div[3]/div/div[2]/div/div/div/div[2]/div/img') + success_img = login.find_element( + By.XPATH, '/html/body/div[3]/div/div[2]/div/div/div/div[2]/div/img') assert success_img is not None diff --git a/test_profile_module.py b/test_profile_module.py new file mode 100644 index 0000000..640819f --- /dev/null +++ b/test_profile_module.py @@ -0,0 +1,41 @@ +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