def test_login_uncorrect_user(self): with allure.step('Переход на страницу авторизации'): Header().open_login_page().title_name.should( have.exact_text('Вход')) with allure.step('Ввод номера и пароля'): LoginPage().login(uncorrect_user) with allure.step('Проверка появления ошибки о неверном логине пароле'): LoginPage().back_error_text.should(be.visible) LoginPage().back_error_text.should( have.exact_text('Неверный номер телефона или пароль.')) with allure.step('Проверка неавторизованности пользователя'): Header().user_name_button.should_not(be.enabled) browser.driver().refresh() Header().user_name_button.should_not(be.enabled)
def test_user_can_login(conf): user = User(conf['amo_credentials']['login'], conf['amo_credentials']['password']) main_page = LoginPage().open().login(user=user) widget_settings = main_page.open_settings_section().open_widget_settings() settings_section = widget_settings.install_widget( conf['sp_keys']['id'], conf['sp_keys']['secret'], ).open_widget_settings().check_widget_status() cont_list_section = main_page.open_contact_list_section() cont_list_section.open_contact_detail( CONTACT_EMAIL).open_entity_settings().delete_custom_fields()
def test_login_uncorrect(self): with allure.step('Переход на страницу авторизации'): Header().open_login_page().title_name.should( have.exact_text('Вход')) with allure.step('Ввод номера и пароля'): LoginPage().login(user_without_login) with allure.step('Проверка валидации поля Телефон'): LoginPage().input_error_blocks_login.should(be.visible) LoginPage().input_error_blocks[0].element( LoginPage().error_text).should( have.exact_text('Обязательное поле')) with allure.step('Проверка неавторизованности пользователя'): Header().user_name_button.should_not(be.enabled) browser.driver().refresh() Header().user_name_button.should_not(be.enabled)
def test_can_add_new_user(): admin = User("admin", "admin") user = User("donald", "123456", "*****@*****.**") (LoginPage().open().login_as(admin).go_to_user_tab().add_new_user( user).table.user_names().should(have.text("donald")))
def login_page(request): def teardown(): browser.driver().delete_all_cookies() request.addfinalizer(teardown) return LoginPage().open()
def test_admin_can_login(): admin = User(USERNAME, PASSWORD) (LoginPage() .open() .login_as(admin) .icon_waffle.should_be(be.visible, 20))
def test_register_open(self): with allure.step('Переход на страницу авторизации'): Header().open_login_page().title_name.should( have.exact_text('Вход')) with allure.step('Нажатие на ссылку Регистрация'): LoginPage().register_link.click() with allure.step('Проверка перехода на страницу регистрации'): RegisterPage().title_text.should(have.exact_text("Регистрация"))
def test_login_correct(self): with allure.step('Переход на страницу авторизации'): Header().open_login_page().title_name.should( have.exact_text('Вход')) with allure.step('Ввод номера и пароля'): LoginPage().login(tru_user) with allure.step('Проверка авторизации пользователя'): Header().user_name_button.should(have.exact_text(tru_user.fio)) Header().user_name_button.click() LkMainPage().banner_link.should_be(be.visible)
def open_app(request, login=simple_accounts[0][0], password=simple_accounts[0][1]): LoginPage().open().login(login=login, pwd=password)\ .nav.open_tab(MainPage().nav.all_notes) def teardown(): app = MainPage() app.nav.open_tab(app.nav.all_notes).delete_all_notes() request.addfinalizer(teardown)
def __init__(self, *args, **kwargs): self.data = {} Frame.__init__(self, *args, **kwargs) self.frames = {} self.frames['MenuPage'] = MenuPage(self) self.frames['SchedulePage'] = SchedulePage(self) self.frames['TalksPage'] = TalksPage(self) self.frames['MapPage'] = MapPage(self) self.frames['SponsorsPage'] = SponsorsPage(self) self.frames['LoginPage'] = LoginPage(self) self.frames['AdminPage'] = AdminPage(self) self.frames['AddTalkPage'] = AddTalkPage(self) self.frames['DeleteTalkPage'] = DeleteTalkPage(self) container = Frame(self) container.pack(side="top", fill="both", expand=True) for frame in self.frames: self.frames[frame].place(in_=container, x=0, y=0, relwidth=1, relheight=1) self.frames['MenuPage'].show()
def go_to_login_by_phone(self): els = page_data[self.platform] self.find(**els["手机登录"]).click() return LoginPage()
def test_admin_can_login(): admin = User("tomsmith", "SuperSecretPassword!") LoginPage() \ .open() \ .login_as(admin) \ .logo.should_have(text("Secure Area"))
def setup(self): tru_user.create_user_api() browser.open_url('/') Header().open_login_page() LoginPage().login(tru_user)
def test_open_login_page(self): LoginPage().open().should_have_login_form()
def open_login_page(self): self.login_button.click() return LoginPage()
def test_admin_can_logout(): admin = User("tomsmith", "SuperSecretPassword!") LoginPage() \ .open() \ .login_as(admin) \ .logout()