コード例 #1
0
ファイル: downloads.py プロジェクト: AndreasHeiberg/behaving
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'
コード例 #2
0
ファイル: steps.py プロジェクト: zhxu73/operation-sanity
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'
コード例 #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'
コード例 #4
0
ファイル: alerts.py プロジェクト: AndreasHeiberg/behaving
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'
コード例 #5
0
ファイル: alerts.py プロジェクト: AndreasHeiberg/behaving
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'
コード例 #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'
コード例 #7
0
ファイル: steps.py プロジェクト: zhxu73/operation-sanity
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'
コード例 #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"
コード例 #9
0
ファイル: downloads.py プロジェクト: AndreasHeiberg/behaving
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'
コード例 #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'