Exemple #1
0
def test_duckduckgo():
    """
    Straightforward/PageObjectLess style
    ===================================

    GO FOR:
    * KISS (Keep It Simple Stupid), straightforward style
      * easy for newbies in automation (no need to learn modules/OOP(classes))
      * easy for some DEVs if they will use these tests (and they should!)
        they know selectors and internals of app they develop
        hence, building more abstractions (modules/classes) on top of more
        low level straightforward code (like below) would add too much complexity
        to them, and harder in day-to-day usage

    TRADEOFFS:
    - given selectors are duplicated all over the project code base
      when you want to change it
      then you have to use global Find&Replace text,
           with sometimes pretty thorough manual checks line by line
           all places where the change will be applied.
           You CAN'T use some refactoring features of IDE like Refactor>Rename
    """

    browser.open('https://duckduckgo.com/')

    browser.element('[name=q]')\
        .should(be.blank)\
        .type('yashaka selene python').press_enter()
    browser.all('.result__body') \
        .should(have.size_greater_than(5)) \
        .first.should(have.text('User-oriented Web UI browser tests'))

    browser.all('.result__body').first.element('a').click()
    browser.should(have.title_containing('yashaka/selene'))
Exemple #2
0
def test_search(browser):
    browser.open('https://www.ecosia.org/')
    browser.element(by.name('q')).type('github yashaka selene').press_enter()

    browser.all('.result').first.element('.result-url').click()

    browser.should(have.title_containing('yashaka/selene'))
Exemple #3
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'))
Exemple #4
0
def x_test_search():
    browser.open('https://www.ecosia.org/')
    browser.element(by.name('q')).type('github yashaka selene').press_enter()

    browser.all('.result')\
        .first \
        .element('.result-url').click()
    #     .element_by_its('.result-title', have.text('yashaka/selene'))\
    #     .element('.result-url').click()

    browser.should(have.title_containing('yashaka/selene'))
def test_search():
    browser.open('https://google.com/ncr')

    browser.element(by.name('q')).should(be.blank)\
        .type('python selene').press_enter()

    results = browser.all('#search .g')
    results.should(have.size_greater_than_or_equal(6))
    results.first.should(have.text('Concise API for Selenium'))
    results.first.element('.r>a').click()

    browser.should(have.title_containing('yashaka/selene'))
Exemple #6
0
 def should_be_on_github(repo='yashaka/selene'):
     browser.should(have.title_containing(repo))
Exemple #7
0
 def step(repo='yashaka/selene'):
     browser.should(have.title_containing(repo))
Exemple #8
0
 def should_be_on(self, title_text):
     browser.should(have.title_containing(title_text))
def githib_page_shuold_be(partial_title):
    browser.should(have.title_containing(partial_title))