Beispiel #1
0
def test(data):
    actions.navigate(data.env.url + 'disabled-elements/')
    actions.verify_element_not_enabled('#text')
    golem_steps.assert_last_step_message('Verify element #text is not enabled')
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_not_enabled('#input-one')
    golem_steps.assert_last_error('Element #input-one is enabled')
Beispiel #2
0
def test(data):
    actions.navigate(data.env.url)
    actions.add_cookie({'name': 'foo', 'value': 'bar'})
    actions.verify_cookie_exists('foo')
    golem_steps.assert_last_step_message("Verify that cookie 'foo' exists")
    actions.verify_cookie_exists('baz')
    golem_steps.assert_last_error("Cookie 'baz' was not found")
def test(data):
    actions.navigate(data.env.url + 'special-elements/')
    actions.verify_element_displayed('#double-click-one')
    golem_steps.assert_last_step_message(
        'Verify element #double-click-one is displayed')
    actions.verify_element_displayed('#hidden-button')
    golem_steps.assert_last_error('element #hidden-button is not displayed')
Beispiel #4
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_has_not_attribute('#button-one', 'not-this-one')
    golem_steps.assert_last_step_message(
        'Verify element #button-one has not attribute not-this-one')
    actions.verify_element_has_not_attribute('#button-one', 'onclick')
    golem_steps.assert_last_error('element #button-one has attribute onclick')
Beispiel #5
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_not_present('#does-not-exist')
    golem_steps.assert_last_step_message(
        'Verify element #does-not-exist is not present')
    actions.verify_element_not_present('#button-one')
    golem_steps.assert_last_error('element #button-one is present')
Beispiel #6
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_title_not_contains('incorrect title')
    golem_steps.assert_last_step_message(
        "Verify page title does not contain 'incorrect title'")
    actions.verify_title_not_contains('Elem')
    golem_steps.assert_last_error("title contains 'Elem'")
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_attribute('#input-one', 'class', 'form-control')
    expected = "Verify element #input-one attribute class value is 'form-control'"
    golem_steps.assert_last_step_message(expected)
    actions.verify_element_attribute('#input-one', 'class', 'incorrect')
    expected = "expected element #input-one attribute class to be 'incorrect' but was 'form-control'"
    golem_steps.assert_last_error(expected)
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_text_not_contains('#link1', 'not-contained')
    golem_steps.assert_last_step_message(
        "Verify element #link1 does not contains text 'not-contained'")
    actions.verify_element_text_not_contains('#link1', 'this is a link')
    msg = "expected element #link1 text 'this is a link to index' to not contain 'this is a link'"
    golem_steps.assert_last_error(msg)
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_has_not_focus('#input-one')
    golem_steps.assert_last_step_message(
        'Verify element #input-one does not have focus')
    actions.focus_element('#input-one')
    actions.verify_element_has_not_focus('#input-one')
    golem_steps.assert_last_error('element #input-one has focus')
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_text_is_not('#link1', 'incorrect text')
    golem_steps.assert_last_step_message(
        "Verify element #link1 text is not 'incorrect text'")
    actions.verify_element_text_is_not('#link1', 'this is a link to index')
    golem_steps.assert_last_error(
        "expected element #link1 text to not be 'this is a link to index'")
Beispiel #11
0
def test(data):
    url = data.env.url + 'elements/'
    actions.navigate(url)
    actions.verify_url(url)
    golem_steps.assert_last_step_message("Verify URL is '{}'".format(url))
    actions.verify_url('http://incorrect_url')
    exp = "expected URL to be 'http://incorrect_url' but was '{}'".format(url)
    golem_steps.assert_last_error(exp)
Beispiel #12
0
def test_verify_alert_present(data):
    actions.navigate(data.env.url + 'alert/')
    actions.verify_alert_present()
    golem_steps.assert_last_step_message('Verify an alert is present')
    golem_steps.assert_last_error('an alert was not present')
    actions.click('#alert-button')
    actions.verify_alert_present()
    actions.dismiss_alert()
Beispiel #13
0
def test(data):
    actions.navigate(data.env.url + 'special-elements/')
    actions.verify_page_not_contains_text('THIS TEXT IS NOT PRESENT')
    golem_steps.assert_last_step_message(
        "Verify 'THIS TEXT IS NOT PRESENT' is not present in the page")
    actions.verify_page_not_contains_text('Special Elements')
    golem_steps.assert_last_error(
        "text 'Special Elements' was found in the page")
Beispiel #14
0
def test(data):
    url = data.env.url + 'elements/'
    actions.navigate(url)
    actions.verify_url_is_not('http://incorrect')
    golem_steps.assert_last_step_message(
        "Verify URL is not 'http://incorrect'")
    actions.verify_url_is_not(url)
    golem_steps.assert_last_error("expected URL to not be '{}'".format(url))
Beispiel #15
0
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_title('Web Playground - Elements')
    golem_steps.assert_last_step_message(
        "Verify page title is 'Web Playground - Elements'")
    actions.verify_title('incorrect title')
    msg = "expected title to be 'incorrect title' but was 'Web Playground - Elements'"
    golem_steps.assert_last_error(msg)
Beispiel #16
0
def test(data):
    url = data.env.url + 'elements/'
    actions.navigate(url)
    actions.verify_url_contains('elements')
    golem_steps.assert_last_step_message("Verify URL contains 'elements'")
    actions.verify_url_contains('incorrect-partial-url')
    msg = "expected URL '{}' to contain 'incorrect-partial-url'".format(url)
    golem_steps.assert_last_error(msg)
def test(data):
    url = data.env.url + 'elements/'
    actions.navigate(url)
    actions.verify_url_not_contains('incorrect')
    golem_steps.assert_last_step_message(
        "Verify URL does not contain 'incorrect'")
    actions.verify_url_not_contains('elem')
    golem_steps.assert_last_error(
        "expected URL '{}' to not contain 'elem'".format(url))
def test(data):
    actions.navigate(data.env.url)
    actions.add_cookie({'name': 'foo', 'value': 'bar'})
    actions.verify_cookie_value('foo', 'bar')
    golem_steps.assert_last_step_message(
        "Verify that cookie 'foo' value is 'bar'")
    actions.verify_cookie_value('foo', 'baz')
    expected = "Expected cookie 'foo' value to be 'baz' but was 'bar'"
    golem_steps.assert_last_error(expected)
def test(data):
    actions.navigate(data.env.url + 'elements/')
    actions.verify_element_checked('#selected-checkbox')
    actions.verify_element_checked('#unselected-checkbox')
    golem_steps.assert_last_error(
        'element #unselected-checkbox is not checked')
    actions.verify_element_checked('#exampleRadios1')
    actions.verify_element_checked('#exampleRadios2')
    golem_steps.assert_last_error('element #exampleRadios2 is not checked')
def test(data):
    input_one = '#input-one'
    actions.navigate(data.env.url + 'elements/')
    actions.send_keys(input_one, 'foo')
    actions.verify_element_value_is_not(input_one, 'bar')
    expected = "Verify element {} value is not 'bar'".format(input_one)
    golem_steps.assert_last_step_message(expected)
    actions.verify_element_value_is_not(input_one, 'foo')
    msg = ("expected element {} value to not be 'foo'".format(input_one))
    golem_steps.assert_last_error(msg)
Beispiel #21
0
def test(data):
    actions.navigate(data.env.url + 'alert/')
    actions.verify_alert_not_present()
    golem_steps.assert_last_step_message('Verify an alert is not present')
    actions.click('#alert-button')
    # Temporarily disable screenshot on error
    # Selenium cannot take screenshots when alert is present
    # TODO
    current = execution.settings['screenshot_on_error']
    execution.settings['screenshot_on_error'] = False
    actions.verify_alert_not_present()
    golem_steps.assert_last_error('an alert was present')
    actions.dismiss_alert()
    execution.settings['screenshot_on_error'] = current
Beispiel #22
0
def test(data):
    actions.navigate(data.env.url + 'alert/')
    actions.click('#alert-button')
    actions.verify_alert_text('an alert')
    golem_steps.assert_last_step_message("Verify alert text is 'an alert'")
    # Temporarily disable screenshot on error
    # Selenium cannot take screenshots when alert is present
    # TODO
    current = execution.settings['screenshot_on_error']
    execution.settings['screenshot_on_error'] = False
    actions.verify_alert_text('incorrect text')
    expected = "Expected alert text to be 'incorrect text' but was 'an alert'"
    golem_steps.assert_last_error(expected)
    actions.dismiss_alert()
    execution.settings['screenshot_on_error'] = current
Beispiel #23
0
def test(data):
    actions.navigate(data.env.url+'elements/')
    actions.verify_title_is_not('incorrect title')
    golem_steps.assert_last_step_message("Verify page title is not 'incorrect title'")
    actions.verify_title_is_not('Web Playground - Elements')
    golem_steps.assert_last_error("expected title to not be 'Web Playground - Elements'")
Beispiel #24
0
def test(data):
    actions.navigate(data.env.url+'elements/')
    actions.verify_element_not_checked('#unselected-checkbox')
    golem_steps.assert_last_step_message('Verify element #unselected-checkbox is not checked')
    actions.verify_element_not_checked('#selected-checkbox')
    golem_steps.assert_last_error('element #selected-checkbox is checked')
Beispiel #25
0
def test(data):
    actions.error('foo', 'bar')
    golem_steps.assert_last_step_message('ERROR')
    golem_steps.assert_last_error('foo', 'bar')