Ejemplo n.º 1
0
def verify_download(context, filename, timeout):
    path = os.path.join(context.download_dir, filename)

    def check():
        return os.path.exists(path)

    assert _retry(check, timeout), u'File has not been downloaded'
Ejemplo n.º 2
0
def is_enabled(context, xpath, timeout):
    el = context.browser.find_by_xpath(xpath)
    assert el, u'Element not found'
    element = el.first

    check = lambda: element._element.is_enabled()
    assert _retry(check, timeout), u'Element is not enabled'
Ejemplo n.º 3
0
def verify_download(context, filename, timeout):
    path = os.path.join(context.download_dir, filename)

    def check():
        return os.path.exists(path)

    assert _retry(check, timeout), u'File has not been downloaded'
Ejemplo n.º 4
0
def alert_contains_text_timeout(context, text, timeout):
    def check():
        try:
            alert = context.browser.get_alert(), u'Alert not found'
            return alert is not None and text in alert[0].text
        except NoAlertPresentException:
            return False
    assert _retry(check, timeout), u'Alert not found'
Ejemplo n.º 5
0
def alert_is_present_timeout(context, timeout):
    def check():
        try:
            alert = context.browser.get_alert(), u'Alert not found'
            return alert is not None
        except NoAlertPresentException:
            return False
    assert _retry(check, timeout), u'Alert not found'
Ejemplo n.º 6
0
def alert_is_present_timeout(context, timeout):
    def check():
        try:
            alert = context.browser.get_alert(), u'Alert not found'
            return alert is not None
        except NoAlertPresentException:
            return False

    assert _retry(check, timeout), u'Alert not found'
Ejemplo n.º 7
0
def is_enabled(context, name, timeout):
    el = context.browser.find_by_xpath(
        ("//*[@id='%(name)s']|"
         "//*[@name='%(name)s']") % {'name': name})
    assert el, u'Element not found'
    element = el.first

    check = lambda: element._element.is_enabled()
    assert _retry(check, timeout), u'Element is not enabled'
Ejemplo n.º 8
0
def alert_contains_text_timeout(context, text, timeout):
    def check():
        try:
            alert = context.browser.get_alert()
            return alert is not None and text in alert.text
        except NoAlertPresentException:
            return False

    assert _retry(check, timeout), u"Alert not found"
Ejemplo n.º 9
0
def verify_download_contents(context, filename, text, timeout):
    path = os.path.join(context.download_dir, filename)

    def check():
        return os.path.exists(path)

    assert _retry(check, timeout), u'File has not been downloaded'
    with open(path, 'r') as f:
        contents = f.read()

    assert text.encode('utf-8') in contents, u'Text not found in file'
Ejemplo n.º 10
0
def verify_download_contents(context, filename, text, timeout):
    path = os.path.join(context.download_dir, filename)

    def check():
        return os.path.exists(path)

    assert _retry(check, timeout), u'File has not been downloaded'
    with open(path, 'r') as f:
        contents = f.read()

    assert text.encode('utf-8') in contents, u'Text not found in file'