def test_search_is_postponed_until_actual_action_like_questioning_count(): GIVEN_PAGE.opened_empty() elements = driver.all('li').filtered_by(css_class('will-appear')) WHEN.load_body(''' <ul>Hello to: <li>Anonymous</li> <li class='will-appear'>Bob</li> <li class='will-appear'>Kate</li> </ul>''') assert len(elements) == 2
def test_search_is_updated_on_next_actual_action_like_questioning_displayed(): GIVEN_PAGE.opened_empty() element = driver.all('.will-appear').element_by(css_class('special')) WHEN.load_body(''' <ul>Hello to: <li class="will-appear">Bob</li> <li class="will-appear special">Kate</li> </ul>''') assert element.is_displayed() is True WHEN.load_body(''' <ul>Hello to: <li class="will-appear">Bob</li> <li class="will-appear special" style="display:none">Kate</li> </ul>''') assert element.is_displayed() is False
def test_waits_nothing(): GIVEN_PAGE.opened_empty() elements = driver.all('li').filtered_by(css_class('will-appear')) WHEN.load_body(''' <ul>Hello to: <li>Anonymous</li> <li class='will-appear'>Bob</li> <li class='will-appear' style='display:none'>Kate</li> </ul>''') assert len(elements) == 2 WHEN.load_body_with_timeout(''' <ul>Hello to: <li>Anonymous</li> <li class='will-appear'>Bob</li> <li class='will-appear' style='display:none'>Kate</li> <li class='will-appear'>Joe</li> </ul>''', 500) assert len(elements) == 2
def test_search_is_lazy_and_does_not_start_on_creation(): GIVEN_PAGE.opened_empty() non_existent_collection = driver.all('.not-existing').filtered_by( css_class('special')) assert str(non_existent_collection)