Exemple #1
0
def evaluate_the_javascript(step, negate, script, value):
    try:
        assert_equals_with_negate("%s" % world.browser.evaluate_script(script),
                                  value, negate)
    except NotImplementedError:
        logger.info(
            "Attempted to run javascript in a javascript-disabled browser. Moving along."
        )
Exemple #2
0
    def assert_javascript_returns_value(negate, script, value):
        try:
            assert_equals_with_negate(
                "%s" % world.browser.evaluate_script(script), value, negate)
        except NotImplementedError:
            logger.info("Attempted to run javascript in a javascript-disabled"
                        "browser. Moving along.")

        return True
Exemple #3
0
def attribute_value_test(element, negate, *args):
    attribute = args[0]
    value = args[1]
    assert_equals_with_negate(element.get_attribute(attribute), value, negate)
Exemple #4
0
 def _this_step(step, negate, first, last, find_pattern, attr_name,
                attr_value):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate("%s" % ele[attr_name], attr_value,
                               negate)
Exemple #5
0
 def _this_step(step, negate, attribute, pick, find_pattern, value):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute), value, negate)
Exemple #6
0
 def assert_url_equals(negate, partial, url):
     if partial == 'is':
         assert_equals_with_negate(world.browser.url, url, negate)
     else:
         assert_with_negate(url in world.browser.url, negate)
     return True
Exemple #7
0
 def _this_step(step, negate, attribute, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute),
                               world.stored_values[name], negate)
Exemple #8
0
 def assert_url_equals(negate, partial, url):
     if partial == 'is':
         assert_equals_with_negate(world.browser.url, url, negate)
     else:
         assert_with_negate(url in world.browser.url, negate)
     return True
Exemple #9
0
def attribute_value_test(element, negate, *args):
    attribute = args[0]
    value = args[1]
    assert_equals_with_negate(element[attribute], value, negate)
Exemple #10
0
def contains_exactly_test(element, negate, *args):
    content = args[0]
    text = getattr(element, 'text', None)
    assert_equals_with_negate(content, text, negate)
Exemple #11
0
def should_be_titled(step, negate, title):
    assert_equals_with_negate(world.browser.title, title, negate)
Exemple #12
0
def should_have_html(step, negate, html):
    assert_equals_with_negate(world.browser.html, html, negate)
Exemple #13
0
def should_have_the_url(step, negate, url):
    assert_equals_with_negate(world.browser.url, url, negate)
Exemple #14
0
 def _this_step(step, first, last, find_pattern, negate, value):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate(ele.value, value, negate)
Exemple #15
0
 def _this_step(step, first, last, find_pattern, negate, value):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate(ele.value, value, negate)
Exemple #16
0
 def _this_step(step, negate, first, last, find_pattern, content):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate(ele.text, content, negate)
Exemple #17
0
 def assert_title_equals(negate, partial, title):
     if 'contains' in partial:
         assert_with_negate(title in world.browser.title, negate)
     else:
         assert_equals_with_negate(world.browser.title, title, negate)
     return True
Exemple #18
0
 def _this_step(step, negate, first, last, find_pattern, attr_name, attr_value):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate("%s" % ele[attr_name], attr_value, negate)
Exemple #19
0
 def assert_page_html_is(negate, partial, html):
     if partial == 'is':
         assert_equals_with_negate(world.browser.html, html, negate)
     else:
         assert_with_negate(html in world.browser.html, negate)
     return True
Exemple #20
0
def should_be_titled(step, negate, title):
    assert_equals_with_negate(world.browser.title, title, negate)
Exemple #21
0
 def _this_step(step, negate, attribute, pick, find_pattern, value):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute), value, negate)
Exemple #22
0
def should_have_the_url(step, negate, url):
    assert_equals_with_negate(world.browser.url, url, negate)
Exemple #23
0
 def assert_title_equals(negate, partial, title):
     if 'contains' in partial:
         assert_with_negate(title in world.browser.title, negate)
     else:
         assert_equals_with_negate(world.browser.title, title, negate)
     return True
Exemple #24
0
def should_have_html(step, negate, html):
    assert_equals_with_negate(world.browser.html, html, negate)
Exemple #25
0
 def assert_page_html_is(negate, partial, html):
     if partial == 'is':
         assert_equals_with_negate(world.browser.html, html, negate)
     else:
         assert_with_negate(html in world.browser.html, negate)
     return True
Exemple #26
0
def contains_exactly_test(element, negate, *args):
    content = args[0]
    text = getattr(element, 'text', None)
    assert_equals_with_negate(content, text, negate)
Exemple #27
0
 def _this_step(step, negate, attribute, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute),
                               world.stored_values[name],
                               negate)
Exemple #28
0
 def _this_step(step, negate, first, last, find_pattern, content):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_equals_with_negate(ele.text, content, negate)