software-testing-Salin-PIbd-33/test_profile_module.py

59 lines
2.0 KiB
Python
Raw Normal View History

from common_fixtures import driver, login, open_profile
2025-03-03 18:36:39 +04:00
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()
2025-03-03 20:48:09 +04:00
time.sleep(2)
2025-03-03 18:36:39 +04:00
to_check2 = driver.find_element(
By.CLASS_NAME, 'overlay-header__info-text').get_attribute("textContent")
res = (to_check1 == to_check2)
2025-03-03 19:14:40 +04:00
driver.find_element(
By.CSS_SELECTOR, '#root > div > div.app-page > div.auth-popup > div > div.overlay-order.overlay-sidebar-enter-done > div.overlay-header > button.popup-close-icon > svg > path').click()
time.sleep(2)
2025-03-03 18:36:39 +04:00
return res
def test_navigation(open_profile):
login = open_profile
2025-03-03 18:36:39 +04:00
profile_icon_window = login.find_element(
By.XPATH, "//*[@id='root']/div/div[1]/div[1]/div[1]/button[1]/img")
2025-03-03 21:39:06 +04:00
login = open_profile
2025-03-03 18:36:39 +04:00
menu_len = len(login.find_elements(By.CLASS_NAME, 'account-menu__item'))
profile_icon_window.click()
2025-03-03 20:48:09 +04:00
time.sleep(2)
2025-03-03 19:14:40 +04:00
2025-03-03 18:36:39 +04:00
res = True
2025-03-03 19:14:40 +04:00
for ind in range(menu_len - 1):
2025-03-03 18:36:39 +04:00
res = res and switcher(
login, ind + 1)
2025-03-03 19:14:40 +04:00
time.sleep(2)
2025-03-03 18:36:39 +04:00
login.switch_to.default_content()
assert res == True
2025-03-03 21:39:06 +04:00
def test_profile_changes(open_profile):
driver = open_profile
profile_icon_window = driver.find_element(
By.XPATH, "//*[@id='root']/div/div[1]/div[1]/div[1]/button[1]/img")
time.sleep(2)
driver.find_element(By.XPATH, "/html/body/div[2]/nav/a[2]").click()
time.sleep(1)
name_field = driver.find_element(By.NAME, "first_name")
surname_field = driver.find_element(By.NAME, "last_name")
father_name = driver.find_element(By.NAME, "middle_name")
name_field.clear()
surname_field.clear()
father_name.clear()
name_field.send_keys('a')
surname_field.send_keys('a')
father_name.send_keys('a')
time.sleep(2)