Esempio n. 1
0
def test_pypi():
    """
    LocatorModules/PageObjectLess
    LocatorModules == page locators/selectors are simply vars in python modules
    Might be also called as PageModules
    ===========================================================================

    Here the page model is implemented in the simplest modular way
    with simplification to "just vars, no functions for steps" in python modules.

    GO FOR:
    * a bit higher abstraction (no more technical selectors in tests code)
      * extra readability in test code
    * reusable vars with locators
    * easier refactoring (Refactor>Rename, etc. can be applied)
    * yet KISS modeling (Keep It Simple Stupid)

    TRADEOFFS:
    - common ones for "programming without functions" style ;)
      some code might be too bulky,
      business steps might be hardly visible in a long e2e test
   """
    browser.open(pypi.url)

    pypi.search.type('selene').press_enter()
    pypi.results\
        .should(have.size_greater_than_or_equal(9)) \
        .first.should(have.text('Concise API for selenium in Python'))

    pypi.results.first.click()
    browser.should(have.url(pypi.url + 'project/selene/'))
    browser.should(have.title_containing('selene · PyPI'))
def test_fails_on_timeout_during_waiting_for_exact_url(session_browser):
    browser = session_browser.with_(timeout=0.1)

    browser.open(start_page)

    with pytest.raises(TimeoutException):
        browser.should(have.url('xttp:/'))
Esempio n. 3
0
def test_fails_on_timeout_during_waiting_for_exact_url(session_browser):
    browser = session_browser.with_(timeout=0.1)

    GivenPage(browser.driver).opened_empty()

    with pytest.raises(TimeoutException) as error:
        browser.should(have.url('xttp:/'))
    assert "has url 'xttp:/'" in error.value.msg
    assert 'AssertionError: actual url:' in error.value.msg
Esempio n. 4
0
def should_be_opened():
    browser.should(have.url(_url))
Esempio n. 5
0
def test_have_url(session_browser):
    GivenPage(session_browser.driver).opened_empty()
    session_browser.should(have.url(session_browser.driver.current_url))
    session_browser.should(have.no.url(
        session_browser.driver.current_url[:-1]))
def test_have_url(session_browser):
    session_browser.open(start_page)
    session_browser.should(have.url(session_browser.driver.current_url))
    session_browser.should(have.no.url(
        session_browser.driver.current_url[:-1]))