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

112 lines
3.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from selenium.webdriver.common.by import By
from my_constants import EMAIL, PASSWORD
import time
def password_step(home_page):
home_page.change_password_click()
time.sleep(1)
def password_back_step(home_page):
home_page.click_back()
time.sleep(1)
def old_new_password(home_page):
old_password, password, repeat_password = home_page.get_password_fields()
old_password.send_keys(PASSWORD)
time.sleep(1)
password.send_keys(2 * PASSWORD + 'а')
time.sleep(1)
repeat_password.send_keys(2 * PASSWORD + 'а')
time.sleep(1)
assert not home_page.check_old_new_password_error()
time.sleep(1)
def wrong_repeat_password(home_page):
old_password, password, repeat_password = home_page.get_password_fields()
old_password.send_keys(2 * PASSWORD)
time.sleep(1)
password.send_keys(2 * PASSWORD)
time.sleep(1)
repeat_password.send_keys(2 * PASSWORD + 'а')
time.sleep(1)
assert not home_page.check_wrong_repeat_password_error()
time.sleep(1)
def wrong_old_password(home_page):
old_password, password, repeat_password = home_page.get_password_fields()
old_password.send_keys(2 * PASSWORD)
time.sleep(1)
password.send_keys(2 * PASSWORD + 'a')
time.sleep(1)
repeat_password.send_keys(2 * PASSWORD + 'a')
time.sleep(1)
home_page.click_change_password()
assert not home_page.check_wrong_old_password_error()
time.sleep(1)
def check_warnings(home_page):
old_password, password, repeat_password = home_page.get_password_fields()
old_password.send_keys(PASSWORD)
time.sleep(1)
password.send_keys(2 * PASSWORD + 'а')
time.sleep(1)
repeat_password.send_keys(2 * PASSWORD + 'а')
time.sleep(1)
assert not home_page.check_warnings_error()
time.sleep(1)
def test_navigation(login):
home_page = login
len_menu = home_page.get_profile_items_len()
for ind in range(len_menu):
home_page.click_profile()
element = home_page.get_profile_item(ind + 1)
to_check1 = element.text
element.click()
time.sleep(2)
to_check2 = home_page.get_current_profile_page()
assert to_check1 == to_check2
home_page.click_back()
time.sleep(2)
home_page.set_default()
def test_profile_changes(login):
home_page = login
home_page.open_box_office()
home_page.click_profile()
home_page.get_profile_item(2).click()
time.sleep(2)
fields = home_page.get_profile_fields()
for i in range(len(fields)):
fields[i].clear()
fields[i].send_keys('a')
time.sleep(1)
assert home_page.check_profile_error(i) == False
home_page.click_change_email()
time.sleep(1)
home_page.send_wrong_email()
assert not home_page.check_email_error()
home_page.click_back()
time.sleep(1)
password_step(home_page)
old_new_password(home_page)
password_back_step(home_page)
password_step(home_page)
wrong_repeat_password(home_page)
password_back_step(home_page)
password_step(home_page)
wrong_old_password(home_page)
password_back_step(home_page)
password_step(home_page)
check_warnings(home_page)
password_back_step(home_page)
time.sleep(2)