one more cummit

This commit is contained in:
Oleja123 2025-03-04 11:15:11 +04:00
parent 2d22268020
commit a5e2fc49a1
3 changed files with 41 additions and 16 deletions

View File

@ -1,11 +1,8 @@
import pytest
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
EMAIL = 'jediforce82@gmail.com'
PASSWORD = 'aboba123'
from my_constants import EMAIL, PASSWORD
@pytest.mark.order(1)
@ -58,5 +55,4 @@ def open_profile(login):
By.XPATH, "//*[@id='root']/div/div[1]/div[1]/div[1]/button[1]/img")
profile_icon_window.click()
time.sleep(2)
yield login

2
my_constants.py Normal file
View File

@ -0,0 +1,2 @@
EMAIL = 'jediforce82@gmail.com'
PASSWORD = 'aboba123'

View File

@ -1,5 +1,6 @@
from common_fixtures import driver, login, open_profile
from selenium.webdriver.common.by import By
from my_constants import EMAIL, PASSWORD
import time
@ -20,6 +21,21 @@ def switcher(driver, ind):
return res
def get_password_fields():
return [driver.find_element(By.NAME, 'old_password'),
driver.find_element(By.NAME, 'password'),
driver.find_element(By.NAME, 'repeat_password')]
def old_new_password(driver):
old_password, password, repeat_password = get_password_fields()
old_password.send_keys(PASSWORD)
password.send_keys(2 * PASSWORD + 'а')
repeat_password.send_keys(2 * PASSWORD + 'а')
assert not driver.find_element(By.XPATH, "//*[@id='root']/div/div[1]/div[2]/div/div[2]/div[2]/div/form/div[3]/div[2]/div[2]").is_displayed()
time.sleep(1)
def test_navigation(open_profile):
login = open_profile
profile_icon_window = login.find_element(
@ -45,14 +61,25 @@ def test_profile_changes(open_profile):
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')
fields = []
fields.append(driver.find_element(By.NAME, "first_name"))
fields.append(driver.find_element(By.NAME, "last_name"))
fields.append(driver.find_element(By.NAME, "middle_name"))
fields.append(driver.find_element(By.NAME, 'birthdate'))
fields.append(driver.find_element(By.NAME, 'phone'))
time.sleep(1)
for i in range(len(fields)):
fields[i].clear()
fields[i].send_keys('a')
assert driver.find_element(
By.XPATH, f"//*[@id='root']/div/div[1]/div[2]/div/div[2]/div[2]/div/div/form/div[{i + 1}]/div[3]").is_displayed()
driver.find_element(
By.XPATH, "//*[@id='root']/div/div[1]/div[2]/div/div[2]/div[2]/div/div/form/a[1]").click()
driver.find_element(
By.XPATH, "//*[@id='root']/div/div[1]/div[2]/div/div[2]/div[2]/div/form/div[3]/div[2]/input").send_keys('a')
assert driver.find_element(By.CLASS_NAME, 'disabled').is_enabled()
change_password = driver.find_element(
By.XPATH, "//*[@id='root']/div/div[1]/div[2]/div/div[2]/div[2]/div/div/form/a[2]")
driver.execute_script("arguments[0].scrollIntoView(true);", change_password)
change_password.click()
time.sleep(2)