Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/autorized_user_home_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import allure
from locators.authotised_user_home_page_locators import AuthorizedUserHomePageLocators
from locators.authorised_user_home_page_locators import AuthorizedUserHomePageLocators
from pages.base_page import BasePage


Expand Down
11 changes: 10 additions & 1 deletion pages/base_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,18 @@ def check_expected_link(self, url):

def wait_changed_url(self, url):
with allure.step(f'Wait until url: {url} will be changed.'):
Wait(self.driver, self.timeout).until(
Wait(self.driver, timeout=20).until(
EC.url_changes(url), message=f"Url: {url} has not been changed!!!")

def check_has_not_changed_url(self, url):
with allure.step(f"Wait until url: {url} hasn't changed."):
try:
Wait(self.driver, self.timeout).until(EC.url_changes(url), message=f"Url: {url} hasn't changed!!!")
return False
except TimeoutException:
return True


def wait_url_to_be(self, url):
with allure.step(f'Wait until url to be: {url}.'):
Wait(self.driver, self.timeout).until(
Expand Down
2 changes: 1 addition & 1 deletion pages/profile_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dotenv import load_dotenv
from selenium.common import TimeoutException
from locators.login_page_locators import LoginPageLocators
from locators.authotised_user_home_page_locators import AuthorizedUserHomePageLocators
from locators.authorised_user_home_page_locators import AuthorizedUserHomePageLocators
from locators.start_unauthorized_page_locators import StartUnauthorizedPageLocators
from locators.profile_page_locators import ProfilePageLocators
from pages.base_page import BasePage
Expand Down
4 changes: 4 additions & 0 deletions pages/registration_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ def check_change_url(self):
@allure.step("Check REGISTRATION button is not clickable")
def check_registration_button_is_not_clickable(self):
self.element_is_not_clickable(self.locators.SUBMIT_BUTTON).click()

@allure.step("Wait not changing url")
def check_not_change_url(self):
return self.check_has_not_changed_url(self.links.URL_REGISTRATION_PAGE)
1 change: 1 addition & 0 deletions test_data/registration_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Messages:
EMPTY_EMAIL = ['Please enter your login and password', 'Пожалуйста, введите логин и пароль.']
EMPTY_PASSWORD = ['Passwords should match', 'Пароли должны совпадать']
ONLY_FIRST_NAME = ['Empty LastName', 'Фамилия не Указана']
WITHOUT_AGREEMENT = ['You must agree to the terms before registering', 'Вы должны согласиться с условиями перед регистрацией']


class Registration:
Expand Down
14 changes: 9 additions & 5 deletions tests/registration_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ def test_registration_negative(self, driver, main_page_open, title, first_name,
page.fill_repeat_password(confirm_password)
page.choose_agreement()
page.click_registration_button()
text = page.check_error_message()
assert text in error_message, f'The user has registered with {title}'
try:
text = page.check_error_message()
assert text in error_message, f'The user has registered with {title}'
except TimeoutException:
assert page.check_not_change_url()


@allure.title('Check registration without choosing gender')
def test_registration_without_choosing_gender(self, main_page_open, driver):
Expand Down Expand Up @@ -90,7 +94,7 @@ def test_registration_without_choosing_agreement(self, main_page_open, driver):
page.fill_repeat_password(os.environ["CHANGE_PASSWORD"])
page.click_registration_button()
try:
page.check_change_url()
text = page.check_error_message()
assert text in self.msg.WITHOUT_AGREEMENT, 'The user has registered without agreement'
except TimeoutException:
pass
assert TimeoutException, 'The user has registered without choosing agreement'
assert page.check_not_change_url()
Loading