Наваливаю фиксы

This commit is contained in:
Oleja123 2025-03-03 18:36:39 +04:00
parent 2040b61349
commit 92ec7b712b
2 changed files with 48 additions and 3 deletions

View File

@ -2,6 +2,7 @@ from common_fixtures import driver, login
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
import time import time
def test_header_len(driver): def test_header_len(driver):
header = driver.find_elements(By.CLASS_NAME, 'menu__item') header = driver.find_elements(By.CLASS_NAME, 'menu__item')
assert len(header) > 0 assert len(header) > 0
@ -20,14 +21,17 @@ def test_header_navigation(driver):
def test_feedback(login): 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) login.execute_script("arguments[0].scrollIntoView(true);", feedback_button)
feedback_button.click() feedback_button.click()
time.sleep(2) time.sleep(2)
textarea = login.find_element(By.CLASS_NAME, 'textarea') textarea = login.find_element(By.CLASS_NAME, 'textarea')
textarea.send_keys('a') 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() send_button.click()
time.sleep(1) 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 assert success_img is not None

41
test_profile_module.py Normal file
View File

@ -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