def test_filter_tasks(): config.browser_name = 'chrome' browser.open_url('https://todomvc4tasj.herokuapp.com') clear_completed_js_loaded = "return $._data($('#clear-completed').get(0), 'events').hasOwnProperty('click')" browser.wait_to(have.js_returned_true(clear_completed_js_loaded), timeout=config.timeout * 3) s('#new-todo').set_value('a').press_enter() s('#new-todo').set_value('b').press_enter() s('#new-todo').set_value('c').press_enter() ss('#todo-list li').should(have.exact_texts('a', 'b', 'c')) ss('#todo-list li').element_by( have.exact_text('b')).element('.toggle').click() s(by.link_text('Active')).click() ss('#todo-list li').filtered_by(be.visible).should( have.exact_texts('a', 'c')) s(by.link_text('Completed')).click() ss('#todo-list li').filtered_by(be.visible).should(have.exact_texts('b')) s(by.link_text('All')).click() ss('#todo-list li').filtered_by(be.visible).should( have.exact_texts('a', 'b', 'c'))
def test_filter_tasks(self): browser.open_url(APP_URL) clear_completed_js_loaded = "return $._data($('#clear-completed').get(0), 'events').hasOwnProperty('click')" browser.wait_to(have.js_returned_true(clear_completed_js_loaded)) s('#new-todo').should(be.enabled).set_value('a').press_enter() s('#new-todo').should(be.enabled).set_value('b').press_enter() s('#new-todo').should(be.enabled).set_value('c').press_enter() ss("#todo-list>li").should(have.texts('a', 'b', 'c')) ss("#todo-list>li").element_by(exact_text('b')).find(".toggle").click() s(by_link_text("Active")).click() ss("#todo-list>li").filtered_by(be.visible).should(have.texts('a', 'c')) s(by_link_text("Completed")).click() ss("#todo-list>li").filtered_by(be.visible).should(have.texts('b'))
def test_filter_tasks(self): browser.open_url('https://todomvc4tasj.herokuapp.com/') clear_completed_js_loaded = "return $._data($('#clear-completed').get(0), 'events').hasOwnProperty('click')" browser.wait_to(have.js_returned_true(clear_completed_js_loaded), timeout=config.timeout*3) browser.wait_to(have.title(u'TroopJS • TodoMVC')) s('#new-todo').should(be.enabled).set_value('a').press_enter() s('#new-todo').should(be.enabled).set_value('b').press_enter() s('#new-todo').should(be.enabled).set_value('c').press_enter() ss("#todo-list>li").should(have.texts('a', 'b', 'c')) ss("#todo-list>li").element_by(exact_text('b')).find(".toggle").click() s(by_link_text("Active")).click() ss("#todo-list>li").filtered_by(be.visible).should(have.texts('a', 'c')) s(by_link_text("Completed")).click() ss("#todo-list>li").filtered_by(be.visible).should(have.texts('b'))
def test_should_wait_and_fail_for_incorrect_url(): config.timeout = 0.1 with pytest.raises(TimeoutException): open_url(start_page) wait_to(url("xttp:/"))
def test_can_wait_for_part_of_url(): open_url(start_page) wait_to(url_containing("start_page.html"))
def test_can_wait_for_exact_url(): open_url(start_page) wait_to(url(driver().current_url))
def visit(): browser.visit('file://' + os.path.abspath(os.path.dirname(__file__)) + '/../../../../resources/todomvcapp/home.html') clear_completed_js_loaded = "return $._data($('#clear-completed').get(0), 'events').hasOwnProperty('click')" browser.wait_to(have.js_returned_true(clear_completed_js_loaded))
def open_page(context): config.browser_name = 'chrome' browser.open_url('http://duckduckgo.com') browser.wait_to(have.title('DuckDuckGo — Privacy, simplified.'))