Beispiel #1
0
def assert_browser_suggestions(expected_list):
    suggestion_divs = get_browser().find_all(
        'div.autocomplete-suggestions > div.autocomplete-suggestion')
    actual_suggestions = [s.text for s in suggestion_divs]
    for suggestion in expected_list:
        if suggestion not in actual_suggestions:
            actions.fail('Expected {} to be in browser suggestion list'.format(
                suggestion))
Beispiel #2
0
def test_get_test_status(data):
    for _ in range(10):
        response = report.get_test_status(data.project, data.test,
                                          data.timestamp)
        if response.json()['has_finished'] is True:
            break
        time.sleep(1)

    if response.json()['has_finished']:
        assert len(response.json()['sets']) == 1
    else:
        actions.fail('Test execution did not finish in time')
Beispiel #3
0
def assert_info_bar_message(msg):
    actions.step('Assert an info bar is displayed with msg: {}'.format(msg))
    info_bars = actions.get_browser().find_all('.info-bar')
    if not info_bars:
        time.sleep(1)
        info_bars = actions.get_browser().find_all('.info-bar')
    for bar in info_bars:
        if msg in bar.text:
            return
    info_bars_text = '\n'.join([bar.text for bar in info_bars])
    error = ('expected an info bar with text {}\nInfo Bars found:\n{}'
             .format(msg, info_bars_text))
    actions.fail(error)
Beispiel #4
0
def test(data):
    with expected_exception(AssertionError, 'I have failed you Anakin'):
        actions.fail('I have failed you Anakin')