示例#1
0
def test_start_browser(get_binary, app):
    binary = get_binary(app)
    assert binary

    raptor = Raptor(app, binary)
    raptor.start_control_server()

    test = {}
    test['name'] = 'raptor-{}-tp7'.format(app)

    thread = threading.Thread(target=raptor.run_test, args=(test, ))
    thread.start()

    timeout = time.time() + 5  # seconds
    while time.time() < timeout:
        try:
            is_running = raptor.runner.is_running()
            assert is_running
            break
        except RunnerNotStartedError:
            time.sleep(0.1)
    else:
        assert False  # browser didn't start

    raptor.clean_up()
    thread.join(5)
    assert not raptor.runner.is_running()
    assert raptor.runner.returncode is not None
示例#2
0
def test_create_profile(options, app, get_prefs):
    options['app'] = app
    raptor = Raptor(**options)

    assert isinstance(raptor.profile, BaseProfile)
    if app != 'firefox':
        return

    # This pref is set in mozprofile
    firefox_pref = 'user_pref("app.update.enabled", false);'
    # This pref is set in raptor
    raptor_pref = 'user_pref("security.enable_java", false);'

    prefs_file = os.path.join(raptor.profile.profile, 'user.js')
    with open(prefs_file, 'r') as fh:
        prefs = fh.read()
        assert firefox_pref in prefs
        assert raptor_pref in prefs
示例#3
0
def test_create_profile(options, app, get_prefs):
    options['app'] = app
    raptor = Raptor(**options)

    assert isinstance(raptor.profile, BaseProfile)
    if app != 'firefox':
        return

    # These prefs are set in mozprofile
    firefox_prefs = [
        'user_pref("app.update.disabledForTesting", true);', 'user_pref("'
        'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true);'
    ]
    # This pref is set in raptor
    raptor_pref = 'user_pref("security.enable_java", false);'

    prefs_file = os.path.join(raptor.profile.profile, 'user.js')
    with open(prefs_file, 'r') as fh:
        prefs = fh.read()
        for firefox_pref in firefox_prefs:
            assert firefox_pref in prefs
        assert raptor_pref in prefs
示例#4
0
def raptor(options):
    return Raptor(**options)