def set_city(self, input_text, result, hint_list): self.event_city.scroll_to() self.event_city.set_value(input_text) #Вводим значение для поля tooltip_holder = s("div.token-input-dropdown-timepad ul") tooltip_holder.should(visible) tooltips_all = ss("div.token-input-dropdown-timepad ul li") assert len(tooltips_all) > 0, f"Для поля город отстутствуют подсказки" value_to_select = None for tooltip_el in tooltips_all: hint_text = tooltip_el.text if hint_text in hint_list: hint_list.remove(hint_text) if hint_text == result: value_to_select = tooltip_el assert value_to_select is not None, ( f"Необходимое значение {result} для поля город" f" отстутствует в списке подсказок") assert len( hint_list ) <= 0, f"В выпадающем списке подсказок отсутствует: {hint_list}" value_to_select.click() selected_value = s("li.token-input-token-timepad p") selected_value.should_have(text(result))
def test_create_task(): tasks = ss(".todo-list>li") active = css_class("active") completed = css_class("completed") visit("http://todomvc.com/examples/troopjs_require/#/", False) for task_text in ["1", "2", "3"]: s(".new-todo").set(task_text).press_enter() tasks.insist(texts("1", "2", "3")).insist_each(active) s(".todo-count").insist(text(3)) tasks[2].s(".toggle").click() tasks.filter(active).insist(texts("1", "2")) tasks.filter(active).insist(size(2)) tasks.filter(completed).insist(texts("3")) s(".filters a[href='#/active']").click() tasks[:2].insist(texts("1", "2")) tasks[2].insist(hidden)
def test_create_task(): tasks = ss("#todo-list>li") active = css_class("active") completed = css_class("completed") visit("http://todomvc.com/examples/troopjs_require/#/") for task_text in ["1", "2", "3"]: s("#new-todo").set(task_text).press_enter() tasks.insist(texts("1", "2", "3")).insist_each(active) s("#todo-count").insist(text(3)) tasks[2].s(".toggle").click() tasks.filter(active).insist(texts("1", "2")) tasks.filter(active).insist(size(2)) tasks.filter(completed).insist(texts("3")) s("#filters a[href='#/active']").click() tasks[:2].insist(texts("1", "2")) tasks[2].insist(hidden)
def text(partial_value): return conditions.text(partial_value)
def check_auth(self, user_name): self.user_settings_link.should(visible) self.user_settings_link.should_have(text(user_name))
wd = webdriver.Firefox() set_driver(wd) visit('https://accounts.google.com/SignUp') with bemo.Session(wd=wd) as session: handler = session.handle('InputValidator', body={ 'input01': { 'Valid': 'false', 'ErrorMessage': 'Error!', 'Errors': { 'GmailAddress': 'It work.', }, 'ErrorData': [], }, 'Locale': 'ru', }) session.inject() s('#GmailAddress').set('John Snow') s('#submitbutton').click() s('#errormsg_0_GmailAddress').should_have(text('It work.')) handler.assert_called_once_with({ 'method': 'POST', 'url': 'InputValidator?resource=SignUp', })
def test_find_selene_element_from_hidden_element(): s("#hidden_button").following_sibling.should_have(text("Inner Link"))