def test_step3_correct_registration(self): with allure.step('Переход на страницу регистрации'): Header().open_register_page().title_text.should( have.exact_text('Регистрация')) with allure.step('Корректно заполненям все поля'): RegisterPage().register_step3(test_user, browser.driver()) with allure.step('Проверка перехода на страницу успешной регистрации'): RegisterPage().title_text.should( have.exact_text('Добро пожаловать!')) with allure.step("Нажатие на кнопку Добро пожаловать"): RegisterPage().welcome_button.click() with allure.step('Переход на страницу настройки ЛК'): LkMenu().open_settings() with allure.step( 'Проверка совпадения введенных данных на странице настроек'): LkSettingsPage().user_name_input.should(have.value(test_user.fio)) #LkSettingsPage().user_birthday_text.should(have.exact_text(test_user.get_settings_data())) LkSettingsPage().user_sex_text.should( have.exact_text(test_user.get_settings_sex())) LkSettingsPage().user_email_input.should( have.value(test_user.email)) LkSettingsPage().user_phone_text.should( have.exact_text(test_user.get_settings_phone())) with allure.step("Деактивация пользователя"): LkSettingsPage().deactivate_user(test_user)
def test_change_email(self): LkMenu().open_settings() random_email = "autotestemail" + ''.join(random.choice(string.ascii_uppercase) for _ in range(10)) + "@mail.ru" LkSettingsPage().user_email_input.set_value(random_email) LkSettingsPage().save_button.click() LkSettingsPage().sucsess_msg.should(be.visible) browser.driver().refresh() assert LkSettingsPage().user_email_input.get_attribute('value') == random_email
def test_change_number(self): LkMenu().open_settings() LkSettingsPage().change_phone_button.click() phone = User().phone_generate() phone_text = '+7 (' + str(phone)[0:3] + ') ' + str(phone)[3:6] + '-' + str(phone)[6:8]+'-' + str(phone)[8:10] ChangePhonePage().change_phone(user=tru_user, phone=phone).user_phone_text.should(have.text(phone_text)) LkSettingsPage().change_phone_button.click() ChangePhonePage().change_phone(user=tru_user, phone=tru_user.phone)
def test_change_name(self): LkMenu().open_settings() test_name = "autotestname" + ''.join(random.choice(string.ascii_uppercase) for _ in range(10)) LkSettingsPage().user_name_input.set_value(test_name) LkSettingsPage().save_button.click() LkSettingsPage().sucsess_msg.should(be.visible) browser.driver().refresh() assert LkSettingsPage().user_name_input.get_attribute('value') == test_name
def test_change_avatar(self): LkMenu().open_settings() locator = '[type="file"]' LkSettingsPage().avatar_input.should(be.enabled) browser.execute_script(script="document.querySelector('"+locator+"').style.width = '1px';") browser.execute_script(script="document.querySelector('"+locator+"').style.height = '1px';") browser.execute_script(script="document.querySelector('"+locator+"').style.display = 'block';") LkSettingsPage().avatar_input.send_keys(os.getcwd() + '\MilfordSound.jpg') LkSettingsPage().avatar_popub_buttons[1].click() LkSettingsPage().master_errors_popup.should(have.exact_text('Данные успешно обновлены')) LkSettingsPage().save_button.click()
def change_phone(self, user, phone): self.number_input.set_value(phone) self.password_input.set_value(user.password) self.next_button.click() self.sms_input.set_value('1111') self.next_button.click() LkMenu().open_settings() return LkSettingsPage()
def test_confirm_email(self): LkMenu().open_settings() LkSettingsPage().confirm_email_button.click() LkSettingsPage().confirm_email_popup_title.should(be.visible) LkSettingsPage().confirm_email_popup_title.should(have.text('Проверьте ваш e-mail'))