Esempio n. 1
0
def test_assert_cookie_present(data):
    actions.navigate(data.env.url)
    cookie = {'name': 'foo', 'value': 'bar'}
    actions.add_cookie(cookie)
    actions.assert_cookie_present('foo')
    assert golem_steps.get_last_step_message() == "Assert that cookie 'foo' exists"
    with expected_exception(AssertionError, "cookie 'not_exists' was not found"):
        actions.assert_cookie_present('not_exists')
def test(data):
    actions.navigate(data.env.url + 'alert/')
    with expected_exception(AssertionError, 'an alert was not present'):
        actions.assert_alert_present()
    actions.click('#alert-button')
    actions.assert_alert_present()
    assert golem_steps.get_last_step_message() == 'Assert an alert is present'
    actions.dismiss_alert()
Esempio n. 3
0
def test(data):
    actions.navigate(data.env.url)
    actions.add_cookie({'name': 'foo', 'value': 'bar'})
    actions.assert_cookie_value('foo', 'bar')
    assert golem_steps.get_last_step_message(
    ) == "Assert that cookie 'foo' value is 'bar'"
    msg = "expected cookie 'foo' value to be 'incorrect' but was 'bar'"
    with expected_exception(AssertionError, msg):
        actions.assert_cookie_value('foo', 'incorrect')
Esempio n. 4
0
def test_assert_alert_text_is_not(data):
    actions.navigate(data.env.url + 'alert/')
    actions.click('#alert-button')
    actions.assert_alert_text_is_not('incorrect text')
    assert golem_steps.get_last_step_message(
    ) == "Assert alert text is not 'incorrect text'"
    with expected_exception(AssertionError,
                            "expected alert text not to be 'an alert'"):
        actions.assert_alert_text_is_not('an alert')
    actions.dismiss_alert()
def test(data):
    actions.navigate(data.env.url + 'tabs/')
    actions.assert_amount_of_windows(1)
    assert golem_steps.get_last_step_message(
    ) == 'Assert amount of open windows is 1'
    actions.click('#openTab')
    actions.wait_for_window_present_by_title('Tab', 3)
    actions.assert_amount_of_windows(2)
    with expected_exception(AssertionError, 'expected 3 windows but got 2'):
        actions.assert_amount_of_windows(3)
Esempio n. 6
0
def test(data):
    actions.open_browser()
    actions.navigate(data.env.url)
    assert browser.get_browser().current_url == data.env.url
    actions.open_browser('second_browser')
    actions.activate_browser('second_browser')
    assert golem_steps.get_last_step_message(
    ) == 'Activate browser second_browser'
    actions.navigate(data.env.url + 'elements/')
    assert browser.get_browser().current_url == data.env.url + 'elements/'
    actions.activate_browser('main')
    assert browser.get_browser().current_url == data.env.url