Пример #1
0
def test_should_have_texts(session_browser):
    GivenPage(session_browser.driver).opened_with_body('''
        <ul>Hello:
           <li>Alex!</li>
           <li>Yakov!</li>
        </ul>
        ''')

    session_browser.all('li').should(have.texts('',
                                                ''))  # funny:) but as it is
    session_browser.all('li').should(have.texts('Alex', 'Yakov'))
    session_browser.all('li').should(have.texts('Alex!', 'Yakov!'))
Пример #2
0
def test_hold_on_explicit_true():
    browser.config.hold_browser_open = True
    browser.open('http://todomvc.com/examples/emberjs/')
    browser.element('#new-todo').type('a').press_enter()

    atexit._run_exitfuncs()
    browser.element('#new-todo').type('b').press_enter()

    browser.all('#todo-list>li').should(have.texts('a', 'b'))
def test_unicode_text_with_array(session_browser):
    GivenPage(session_browser.driver).opened_with_body(
        '''
        <ul>Привет:
           <li>Саше</li>
           <li>Яше</li>
        </ul>
        ''')

    session_browser.all('li').should(have.texts('Саше', 'Яше'))
Пример #4
0
def x_test_hold_on_explicit_true__when__set_after_open():
    """
    todo: probably it will not work right now... should we bother?
    """
    browser.open('http://todomvc.com/examples/emberjs/')
    browser.element('#new-todo').type('a').press_enter()

    browser.config.hold_browser_open = True
    atexit._run_exitfuncs()
    browser.element('#new-todo').type('b').press_enter()

    browser.all('#todo-list>li').should(have.texts('a', 'b'))
Пример #5
0
def test_should_have_texts_exception(session_browser):
    browser = session_browser.with_(timeout=0.1)
    GivenPage(browser.driver).opened_with_body('''
        <ul>Hello:
           <li>Alex</li>
           <li>Yakov</li>
        </ul>
        ''')

    with pytest.raises(TimeoutException) as error:
        browser.all('li').should(have.texts('Alex'))
    assert "has texts ('Alex',)" in error.value.msg
    assert "AssertionError: actual visible_texts: ['Alex', 'Yakov']" in error.value.msg
Пример #6
0
    def test_filter_tasks(self):
        browser.open(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))

        browser.element('#new-todo').should(
            be.enabled).set_value('a').press_enter()
        browser.element('#new-todo').should(
            be.enabled).set_value('b').press_enter()
        browser.element('#new-todo').should(
            be.enabled).set_value('c').press_enter()

        browser.all("#todo-list>li").should(have.texts('a', 'b', 'c'))

        browser.all("#todo-list>li").element_by(
            have.exact_text('b')).find(".toggle").click()

        browser.element(by.link_text("Active")).click()
        browser.all("#todo-list>li").filtered_by(be.visible).should(
            have.texts('a', 'c'))

        browser.element(by.link_text("Completed")).click()
        browser.all("#todo-list>li").filtered_by(be.visible).should(
            have.texts('b'))