def setup(self, browser): link = 'http://selenium1py.pythonanywhere.com/en-gb/accounts/login/' page = LoginPage(browser, link) page.open() page.go_to_login_page() page.register_new_user("sun", "Ololoshkin2020") page.should_be_authorized_user()
def _register_new_user(): email = str(time.time()) + "@test.org" password = "******" page = LoginPage(browser) page.open() page.register_new_user(email, password) return User(email, password)
def setup(self, browser): login_page = LoginPage(browser, LoginPage.LINK) login_page.open() email = str(time.time()) + "@fakemail.org" password = "******" login_page.register_new_user(email, password) login_page.should_be_authorized_user()
def test_user_login(self, browser): # Data email = "*****@*****.**" password = "******" # Act page = LoginPage(browser, link) page.open() # Assert page.should_be_login_form() page.should_be_authorized_user()
def test_old_user_can_be_authorized(self, browser): # Arrange user_login = "******" user_passwoord = "passtest_987" page = LoginPage(browser, self.login_page_link) # Act page.open() page.authorized_old_user(user_login, user_passwoord) # Assert page.should_be_message_authorized_old_user()
def test_negative_register_new_user(self, browser): # Data email = str(time.time()) + "@tut.by" password = "******" repeat_user_password = "******" # Act page = LoginPage(browser, link) page.open() # Assert page.should_be_register_form()
def test_register_new_user(self, browser): # Data email = str(time.time()) + "@tut.by" password = "******" # Act page = LoginPage(browser, link) page.open() # Assert page.should_be_register_form() page.register_new_user(email, password) page.should_be_authorized_user()
def test_quest_can_register(self, browser): # Arrange email = str(time.time()) + "@fakeemail.org" password = "******" page = LoginPage(browser, self.login_page_link) # Act page.open() page.register_new_user(email, password) # Assert page.should_be_authorized_user() page.should_be_message_authorized_new_user()
def test_quest_can_go_to_reset_password(self, browser): # Arrange page = LoginPage(browser, link) page.open() # Act page.go_to_login_page() page.go_to_reset_password_page() # Assert page.should_be_forgotten_password_form()
def test_auth_by_exists_user(self, browser, exists_user): # Arrange login_page = LoginPage(browser) login_page.open() # Act login_page.login(exists_user.email, exists_user.password) # Assert main_page = MainPage(browser) main_page.should_be_login_user_message()
def setup(self, browser): email = str(time.time()) + "@tut.by" password = "******" page = LoginPage(browser, link) page.open() page.go_to_login_page() page.register_new_user(email, password) page.should_be_authorized_user()
def test_user_logout(self, browser): # Arrange page = LoginPage(browser) page.open() page.login_user(User.user_email, User.user_password) # Act page.logout_user() # Assert page.check_login_button()
def test_registration_new_user(self, browser, register_new_user): # Arrange login_page = LoginPage(browser) login_page.open() # Act register_new_user() # Assert main_page = MainPage(browser) main_page.should_be_registered_user_message()
def test_auth_with_incorrect_password(self, browser, exists_user): # Arrange exists_user.password += "_incorrect" login_page = LoginPage(browser) login_page.open() # Act login_page.login(exists_user.email, exists_user.password) # Assert login_page.should_be_login_error_message()
def test_register_new_user(self, browser): # Data user_email = generate_random_string(8) + "@fakemail.org" user_password = generate_random_string(16) # Act login_page = LoginPage(browser) login_page.open() # Assert login_page.should_be_register_form() login_page.register_new_user(user_email, user_password) login_page.should_be_authorized_user() login_page.user_should_see_message_register()
def test_user_login(self, browser): # Data test_user_email = "*****@*****.**" test_user_password = "******" # Act login_page = LoginPage(browser) login_page.open() # Assert login_page.should_be_login_form() login_page.user_login(test_user_email, test_user_password) login_page.should_be_authorized_user() login_page.user_should_see_message_login()
def test_correct_user_login(self, browser): # Arrange page = LoginPage(browser, link) page.open() page.should_be_login_page() # Act page.login_user(existing_username, existing_username_password) # Assert page.should_be_success_login_message() page.should_be_authorized_user()
def test_user_register(self, browser): # Arrange page = LoginPage(browser) page.open() # Act page.register_new_user(NewUser.registration_email, User.user_password) # Assert page.check_welcome_message() page.check_account_button() page.check_logout_button()
def test_user_fail_login(self, browser): # Arrange page = LoginPage(browser) page.open() # Act page.login_user(User.user_fail_email, User.user_password) # Assert page.check_welcome_message() page.check_account_button() page.check_logout_button()
def test_registration_of_new_user(self, browser): # Arrange page = LoginPage(browser, link) page.open() page.should_be_login_page() email, password = page.new_user() # Act page.register_new_user(email, password) # Assert page.should_be_authorized_user() page.should_be_success_login_message()
def test_guest_can_log_in_with_correct_data(self, browser): # Arrange email = "*****@*****.**" password = "******" page = LoginPage(browser, link) page.open() # Act page.go_to_login_page() page.login_with_correct_data(email, password) # Assert page.should_be_login_in()
def test_negative_register_new_user(self, browser): # Data user_email = generate_random_string(8) + "@fakemail.org" user_password = generate_random_string(16) repeat_user_password = generate_random_string(16) # Act login_page = LoginPage(browser) login_page.open() # Assert login_page.should_be_register_form() login_page.negative_register_new_user(user_email, user_password, repeat_user_password) login_page.should_see_alert_danger() login_page.should_see_error_text()
def test_registration_of_existing_user(self, browser): # Arrange page = LoginPage(browser, link) page.open() page.should_be_login_page() # Act page.register_new_user(existing_username, existing_username_password) # Assert page.should_be_email_warning_message() page.should_be_warning_message() page.should_be_filled_field(*LoginPageLocators.REGISTRATION_EMAIL, existing_username) page.should_be_empty_field(*LoginPageLocators.REGISTRATION_PASSWORD) page.should_be_empty_field(*LoginPageLocators.REGISTRATION_PASSWORD_CONFIRM)
def setup(self, browser): # Data test_user_email = "*****@*****.**" test_user_password = "******" # Arrange login_page = LoginPage(browser) login_page.open() login_page.user_login(test_user_email, test_user_password) basket_page = BasketPage(browser) basket_page.open() basket_page.user_clear_basket() product_page = ProductPage(browser, self.test_product_link) product_page.open() product_page.click_button_add_to_basket() product_page.click_button_view_basket()
def open_profile_page_of_existing_user(self, browser, exists_user): login_page = LoginPage(browser) login_page.open() login_page.login(exists_user.email, exists_user.password) login_page.go_to_profile_page()