コード例 #1
0
ファイル: elements.py プロジェクト: afsoun1981/salad
def assert_element_exists_with_negate(negate, text, partial, function):
    infix = "partial_" if partial else ""
    found = True
    try:
        _get_visible_element(function % (infix, ), None, text)
    except (ElementDoesNotExist, ElementIsNotVisible,
            ElementAtIndexDoesNotExist):
        found = False
    assert_with_negate(found, negate)
    return True
コード例 #2
0
def assert_element_exists_with_negate(negate, text, partial, function):
    infix = "partial_" if partial else ""
    found = True
    try:
        _get_visible_element(function % (infix, ), None, text)
    except (ElementDoesNotExist, ElementIsNotVisible,
            ElementAtIndexDoesNotExist):
        found = False
    assert_with_negate(found, negate)
    return True
コード例 #3
0
ファイル: alerts.py プロジェクト: kiwnix/salad
 def assert_alert_with_text(negate, type_of_match, text):
     world.prompt = _get_alert_or_none()
     prompt_exists = world.prompt is not None
     text_exists = None
     if "contains" in type_of_match:
         text_exists = text in world.prompt.text
     else:
         text_exists = world.prompt.text == text
     assert_with_negate(prompt_exists and text_exists, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #4
0
 def assert_alert_with_text(negate, type_of_match, text):
     world.prompt = _get_alert_or_none()
     prompt_exists = world.prompt is not None
     text_exists = None
     if 'contains' in type_of_match:
         text_exists = text in world.prompt.text
     else:
         text_exists = world.prompt.text == text
     assert_with_negate(prompt_exists and text_exists, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #5
0
ファイル: navigation.py プロジェクト: mroohian/Leaf
def _check_is_on_page(page, negate):
    if page not in leaf_world.available_pages:
        raise KeyError('"%s" page is undefined.' % page)

    if page not in leaf_world.pages:
        try:
            page_object = create_page_object(page)
        except KeyError:
            raise
    else:
        page_object = leaf_world.pages[page]

    is_on_page = page_object.is_current(world.browser.url, get_page_url(world.browser.url))

    assert_with_negate(is_on_page, negate)

    leaf_world.current_page = page_object
コード例 #6
0
ファイル: alerts.py プロジェクト: kiwnix/salad
 def assert_alert_with_stored_value(negate, type_of_match, upper_lower, name):
     world.prompt = _get_alert_or_none()
     assert world.stored_values[name]
     stored = world.stored_values[name]
     current = world.prompt.text
     if upper_lower:
         stored, current = transform_for_upper_lower_comparison(stored, current, upper_lower)
     prompt_exists = world.prompt is not None
     text_exists = None
     if "contains" in type_of_match:
         text_exists = stored in current
     else:
         text_exists = stored == current
     assert_with_negate(prompt_exists and text_exists, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #7
0
 def assert_alert_with_stored_value(negate, type_of_match, upper_lower,
                                    name):
     world.prompt = _get_alert_or_none()
     assert world.stored_values[name]
     stored = world.stored_values[name]
     current = world.prompt.text
     if upper_lower:
         stored, current = transform_for_upper_lower_comparison(
             stored, current, upper_lower)
     prompt_exists = world.prompt is not None
     text_exists = None
     if 'contains' in type_of_match:
         text_exists = stored in current
     else:
         text_exists = stored == current
     assert_with_negate(prompt_exists and text_exists, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #8
0
ファイル: page.py プロジェクト: afsoun1981/salad
 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
コード例 #9
0
def should_see_alert_with_text(step, negate, text):
    alert = _get_alert_or_none()
    assert_with_negate(alert is not None and alert.text == text, negate)
    if alert:
        alert.accept()
コード例 #10
0
ファイル: elements.py プロジェクト: afsoun1981/salad
def attribute_test(element, negate, *args):
    attribute = args[0]
    assert_with_negate(element.get_attribute(attribute) is not None, negate)
コード例 #11
0
ファイル: page.py プロジェクト: afsoun1981/salad
 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
コード例 #12
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_prompt(step, negate):
    world.prompt = _get_alert_or_none()
    assert_with_negate(world.prompt is not None, negate)
    if world.prompt:
        world.prompt.accept()
コード例 #13
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_in_the_page(step, negate, text):
    assert_with_negate(text in world.browser.html, negate)
コード例 #14
0
ファイル: elements.py プロジェクト: skoczen/salad
 def _this_step(step, negate, first, last, find_pattern, content):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_with_negate(content in ele.text, negate)
コード例 #15
0
ファイル: elements.py プロジェクト: skoczen/salad
def should_see_a_link_to(step, negate, link):
    assert_with_negate(len(world.browser.find_link_by_href(link)) > 0, negate)
コード例 #16
0
ファイル: elements.py プロジェクト: zwant/salad
def should_see_in_the_page(step, negate, text):
    assert_with_negate(world.browser.is_text_present(text), negate)
コード例 #17
0
 def assert_alert(negate):
     world.prompt = _get_alert_or_none()
     assert_with_negate(world.prompt is not None, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #18
0
ファイル: elements.py プロジェクト: skoczen/salad
 def _this_step(step, negate, first, last, find_pattern, attr_name):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_with_negate(ele[attr_name] != None, negate)
コード例 #19
0
ファイル: elements.py プロジェクト: skoczen/salad
def should_see_in_the_page(step, negate, text):
    assert_with_negate(text in world.browser.html, negate)
コード例 #20
0
ファイル: alerts.py プロジェクト: kiwnix/salad
 def assert_alert(negate):
     world.prompt = _get_alert_or_none()
     assert_with_negate(world.prompt is not None, negate)
     if world.prompt:
         world.prompt.accept()
     return True
コード例 #21
0
def should_see_prompt_with_text(step, negate, text):
    world.prompt = _get_alert_or_none()
    assert_with_negate(world.prompt is not None and world.prompt.text == text,
                       negate)
    if world.prompt:
        world.prompt.accept()
コード例 #22
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_a_link_to(step, negate, link):
    assert_with_negate(len(world.browser.find_link_by_href(link)) > 0, negate)
コード例 #23
0
ファイル: page.py プロジェクト: kiwnix/salad
 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
コード例 #24
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
 def _this_step(step, negate, first, last, find_pattern, attr_name):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_with_negate(ele[attr_name] != None, negate)
コード例 #25
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_alert_with_text(step, negate, text):
    alert = _get_alert_or_none()
    assert_with_negate(alert is not None and alert.text == text, negate)
    if alert:
        alert.accept()
コード例 #26
0
def contains_test(element, negate, *args):
    content = args[0]
    text = getattr(element, 'text', None)
    assert_with_negate(content in text, negate)
コード例 #27
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_prompt_with_text(step, negate, text):
    world.prompt = _get_alert_or_none()
    assert_with_negate(world.prompt is not None and world.prompt.text == text, negate)
    if world.prompt:
        world.prompt.accept()
コード例 #28
0
 def assert_text_present_with_negates(negate, text):
     body = world.browser.driver.find_element_by_tag_name('body')
     assert_with_negate(text in body.text, negate)
     return True
コード例 #29
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_a_link_called(step, negate, text):
    assert_with_negate(len(world.browser.find_link_by_text(text)) > 0, negate)
コード例 #30
0
ファイル: elements.py プロジェクト: afsoun1981/salad
 def assert_text_present_with_negates(negate, text):
     body = world.browser.driver.find_element_by_tag_name('body')
     assert_with_negate(text in body.text, negate)
     return True
コード例 #31
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
 def _this_step(step, negate, first, last, find_pattern, content):
     ele = _get_element(finder_function, first, last, find_pattern)
     assert_with_negate(content in ele.text, negate)
コード例 #32
0
def attribute_test(element, negate, *args):
    attribute = args[0]
    assert_with_negate(element[attribute] != None, negate)
コード例 #33
0
def visibility_test(element, negate, *args):
    assert_with_negate(element, negate)
コード例 #34
0
 def assert_text_present_with_negates(negate, text):
     assert_with_negate(world.browser.is_text_present(text), negate)
     return True
コード例 #35
0
def attribute_test(element, negate, *args):
    attribute = args[0]
    assert_with_negate(element.get_attribute(attribute) is not None, negate)
コード例 #36
0
 def assert_link_exists_negates(negate, text):
     assert_with_negate(len(world.browser.find_link_by_href(text)) > 0, negate)
     return True
コード例 #37
0
ファイル: elements.py プロジェクト: Work4Labs/salad
def contains_test(element, negate, *args):
    content = args[0]
    text = getattr(element, 'text', None)
    assert_with_negate(content in text, negate)
コード例 #38
0
ファイル: elements.py プロジェクト: Work4Labs/salad
def attribute_test(element, negate, *args):
    attribute = args[0]
    assert_with_negate(element[attribute] != None, negate)
コード例 #39
0
ファイル: page.py プロジェクト: afsoun1981/salad
 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
コード例 #40
0
ファイル: elements.py プロジェクト: Work4Labs/salad
 def assert_text_present_with_negates(negate, text):
     assert_with_negate(world.browser.is_text_present(text), negate)
     return True
コード例 #41
0
def should_see_alert(step, negate):
    alert = _get_alert_or_none()
    assert_with_negate(alert is not None, negate)
    if alert:
        alert.accept()
コード例 #42
0
ファイル: elements.py プロジェクト: Work4Labs/salad
 def assert_link_exists_negates(negate, text):
     assert_with_negate(len(world.browser.find_link_by_href(text)) > 0, negate)
     return True
コード例 #43
0
def should_see_prompt(step, negate):
    world.prompt = _get_alert_or_none()
    assert_with_negate(world.prompt is not None, negate)
    if world.prompt:
        world.prompt.accept()
コード例 #44
0
ファイル: elements.py プロジェクト: Work4Labs/salad
def visibility_test(element, negate, *args):
    assert_with_negate(element, negate)
コード例 #45
0
ファイル: page.py プロジェクト: kiwnix/salad
 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
コード例 #46
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def should_see_alert(step, negate):
    alert = _get_alert_or_none()
    assert_with_negate(alert is not None, negate)
    if alert:
        alert.accept()
コード例 #47
0
ファイル: page.py プロジェクト: kiwnix/salad
 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
コード例 #48
0
ファイル: elements.py プロジェクト: skoczen/salad
def should_see_a_link_called(step, negate, text):
    assert_with_negate(len(world.browser.find_link_by_text(text)) > 0, negate)