Exemplo n.º 1
0
    def test_login_with_empty_fields(self):
        page = login_methods.LoginPage(driver)
        page.user_login_with_empty_data()

        actual_email_error_text = s(LoginPageLocators.ERROR_EMPTY_EMAIL_FIELD)
        actual_password_error_text = s(
            LoginPageLocators.ERROR_EMPTY_PASSWORD_FIELD)

        actual_email_error_text.should(
            have.exact_text("The field is required."))
        actual_password_error_text.should(
            have.exact_text("The field is required."))
def test_complete_task():
    browser.open('http://todomvc.com/examples/emberjs/')

    browser.element('#new-todo').type('a').press_enter()
    browser.element('#new-todo').type('b').press_enter()
    browser.element('#new-todo').type('c').press_enter()
    browser.all('#todo-list>li').should(have.exact_texts('a', 'b', 'c'))

    browser.element('#todo-list>li:nth-child(2)').should(have.exact_text('b'))
    browser.element('#todo-list>li:nth-child(2) .toggle').click()
    browser.all('#todo-list>li.completed').should(have.exact_text('b'))
    browser.all('#todo-list>li:not(.completed)').should(
        have.exact_texts('a', 'c'))
Exemplo n.º 3
0
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'))
Exemplo n.º 4
0
def test_selement_search_fails_with_message_when_explicitly_waits_for_condition():
    GIVEN_PAGE.opened_with_body('''
    <label id='element'>Hello world!</label>
    ''')
    config.timeout = 0.1

    with pytest.raises(TimeoutException) as ex:
        s('#element').should(have.exact_text('Hello wor'))

    assert exception_message(ex) == \
           ['failed while waiting 0.1 seconds',
            'to assert ExactText',
            "for first_by('css selector', '#element')",
            '',
            'reason: ConditionMismatchException: condition did not match',
            "expected: Hello wor",
            "actual: Hello world!",
            'screenshot: //.selene/screenshots/*/screen_*.png']
Exemplo n.º 5
0
def test_filter_tasks():
    visit('https://todomvc4tasj.herokuapp.com')

    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'))
Exemplo n.º 6
0
 def test_forgot_password_with_in_valid_email(self):
     page = forgot_password_methods.ForgotPasswordPage(driver)
     page.send_forgot_password_request("*****@*****.**")
     s(ForgotPassPageLocators.ERROR_MESSAGE).should(have.exact_text("User not found"))
 def should_have(self, product: Product):
     self.name.should(have.text(
         product.name.split()[0]))  # In case of shortened name in menu
     self.price.should(have.exact_text(product.price))
     return self
Exemplo n.º 8
0
 def should_have(self, product: Product):
     self.name.should(have.exact_text(f"{product.name}"))
     self.price.should(have.exact_text(f"{product.price}"))
     return self
Exemplo n.º 9
0
 def delete(self, *names: str):
     for name in names:
         self.todos.element_by(have.exact_text(name)).hover() \
             .element('.destroy').click()
     return self
Exemplo n.º 10
0
 def _start_editing(self, name: str, edited_text):
     self.todos.element_by(have.exact_text(name)).double_click()
     return self.todos.element_by(have.css_class('editing')) \
         .element('.edit').with_(set_value_by_js=True).set_value(edited_text)
Exemplo n.º 11
0
 def check_filter(self, name: str):
     browser.element('.selected') \
         .should(have.exact_text(name))
     return self
def test_user_can_not_login_with_invalid_credentials(setup):
    (LoginPage().open().login_as("admin", "").than().password_err_label.should(
        have.exact_text("Field is required. Minimum 6 symbols length")))
def test_user_can_login_and_logout(setup):
    login = LoginPage()
    main_page = login.login_as("admin", "admin").than_at_main_page()
    main_page.loggedUser.should(have.exact_text("admin"))
    main_page.logout()
    login.username_input.should(be.visible)
Exemplo n.º 14
0
 def test_login_with_in_valid_data(self):
     page = login_methods.LoginPage(driver)
     page.user_login_with_in_valid_user()
     actual_error_message = s(LoginPageLocators.ERROR_MESSAGE)
     actual_error_message.should(
         have.exact_text('Invalid email or password, please try again'))
Exemplo n.º 15
0
 def test_forgot_password_with_empty_fields(self):
     page = forgot_password_methods.ForgotPasswordPage(driver)
     page.send_forgot_password_request("")
     s(ForgotPassPageLocators.ERROR_EMPTY_EMAIL).should(have.exact_text("The field is required."))
Exemplo n.º 16
0
def test_ru_text_in_selector():
    s("#селен").should(have.exact_text(u"Сайт селена"))
Exemplo n.º 17
0
 def activate(self, *names: str):
     for name in names:
         self.todos.element_by(have.exact_text(name)) \
             .should(self.be_completed)
         self._toggle(name)
     return self
Exemplo n.º 18
0
def toggle(task_text):
    _elements.element_by(have.exact_text(task_text)).find(".toggle").click()
Exemplo n.º 19
0
 def assert_items_left(self, counter: int):
     browser.element('#todo-count>strong') \
         .should(have.exact_text(str(counter)))
     return self
Exemplo n.º 20
0
def test_pl_header():
    MainPage()._header.should(have.exact_text('Witamy w'))
Exemplo n.º 21
0
 def _toggle(self, name: str):
     self.todos.element_by(have.exact_text(name)) \
         .element('.toggle').click()
     return self
Exemplo n.º 22
0
def test_pl_header():
    MainPage()._header.should(have.exact_text('Welcome to'))
def test_search_inner_selement():
    given_active("a", "b")
    s("#todo-list").s("li").should(have.exact_text("a"))
Exemplo n.º 24
0
def toogle(text):
    _elements.element_by(have.exact_text(text)).element('.toggle').click()
Exemplo n.º 25
0
def test_condition_have_text():
    assert have.exact_text("text").expected_text == 'text'
    assert have.text("t").expected_text == 't'
Exemplo n.º 26
0
 def test_forgot_password_with_valid_email(self):
     page = forgot_password_methods.ForgotPasswordPage(driver)
     page.send_forgot_password_request("*****@*****.**")
     s(ForgotPassPageLocators.EMAIL_TITLE).should(have.exact_text("CHECK YOUR EMAIL"))
     s(ForgotPassPageLocators.SMALL_EMAIL_TITLE).should(have.exact_text("Please check your inbox, an email is on the way"))
Exemplo n.º 27
0
 def select_by_exact_text(self, text):
     self._options().element_by(have.exact_text(text)).click()
Exemplo n.º 28
0
 def delete(self, name):
     self._todos.element_by(have.exact_text(name)).hover()\
         .element('.destroy').click()
     return self