def main():
    cmd_opts, args = get_opts_remote()

    clear_old_results()

    print "--------------------------------------------------------------"

    runtests.runtests(
        args,
        test_dir=cmd_opts.dir_name,
        file_match=cmd_opts.file_match,
        report_format=cmd_opts.report_format,
        browser_type=cmd_opts.browser_type,
        browser_version=cmd_opts.browser_version,
        browser_platform=cmd_opts.browser_platform,
        session_name=cmd_opts.session_name,
        webdriver_remote_url=cmd_opts.webdriver_remote_url,
        javascript_disabled=cmd_opts.javascript_disabled,
        shared_directory=cmd_opts.shared_modules,
        screenshots_on=cmd_opts.screenshots_on,
        failfast=cmd_opts.failfast,
        debug=cmd_opts.debug,
        extended=cmd_opts.extended_tracebacks,
    )

    print "--------------------------------------------------------------"
Example #2
0
def main():
    cmd_opts, args = command.get_opts_remote()

    command.clear_old_results()

    print '--------------------------------------------------------------'

    browser_factory = runtests.RemoteBrowserFactory(
        {
            "browserName": cmd_opts.browser_type.lower(),
            "platform": cmd_opts.browser_platform.upper(),
            "version": cmd_opts.browser_version,
            "javascriptEnabled": not cmd_opts.javascript_disabled,
            "name": cmd_opts.session_name},
        cmd_opts.webdriver_remote_url)
    runtests.runtests(
        args,
        test_dir=cmd_opts.dir_name,
        count_only=cmd_opts.count_only,
        report_format=cmd_opts.report_format,
        browser_factory=browser_factory,
        shared_directory=cmd_opts.shared_modules,
        screenshots_on=cmd_opts.screenshots_on,
        failfast=cmd_opts.failfast,
        debug=cmd_opts.debug,
        extended=cmd_opts.extended_tracebacks,
        # FIXME: not tested -- vila 2013-05-23
        excludes=cmd_opts.excludes
    )

    print '--------------------------------------------------------------'
Example #3
0
def main():
    cmd_opts, args = get_opts_remote()

    clear_old_results()

    print '--------------------------------------------------------------'

    runtests.runtests(
        args,
        test_dir=cmd_opts.dir_name,
        collect_only=cmd_opts.collect_only,
        report_format=cmd_opts.report_format,
        browser_type=cmd_opts.browser_type,
        browser_version=cmd_opts.browser_version,
        browser_platform=cmd_opts.browser_platform,
        session_name=cmd_opts.session_name,
        webdriver_remote_url=cmd_opts.webdriver_remote_url,
        javascript_disabled=cmd_opts.javascript_disabled,
        shared_directory=cmd_opts.shared_modules,
        screenshots_on=cmd_opts.screenshots_on,
        failfast=cmd_opts.failfast,
        debug=cmd_opts.debug,
        extended=cmd_opts.extended_tracebacks,
        saucelabs_enabled=cmd_opts.saucelabs_enabled,
        custom_options=cmd_opts.custom
    )

    print '--------------------------------------------------------------'
Example #4
0
def main():
    cmd_opts, args = get_opts_run()

    print '--------------------------------------------------------------'
    print 'starting SST...'

    cleanups = []

    if cmd_opts.browsermob and cmd_opts.run_tests:
        print 'Warning: can not record local traffic from django testproject'

    if cmd_opts.browsermob:
        browsermob_process = run_browsermob_server(cmd_opts.browsermob)

        def browsermob_cleanup():
            browsermob_process.kill()
            browsermob_process.wait()

        cleanups.append(('\nkilling browsermob proxy...', browsermob_cleanup))

    if cmd_opts.run_tests:
        cmd_opts.dir_name = 'selftests'
        run_django()
        cleanups.append(('\nkilling django...', kill_django))

    if cmd_opts.xserver_headless:
        from sst.xvfbdisplay import Xvfb
        print '\nstarting virtual display...'
        display = Xvfb(width=1024, height=768)
        display.start()
        cleanups.append(('\nstopping virtual display...', display.stop))

    if not cmd_opts.quiet:
        print ''
        print '  date time: %s' \
            % datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
        print '  test directory: %r' % cmd_opts.dir_name
        print '  report format: %r' % cmd_opts.report_format
        print '  browser type: %r' % cmd_opts.browser_type
        print '  javascript disabled: %r' % cmd_opts.javascript_disabled
        print '  browswermob proxy launcher: %r' % cmd_opts.browsermob
        print '  shared directory: %r' % cmd_opts.shared_modules
        print '  screenshots on error: %r' % cmd_opts.screenshots_on
        print '  failfast: %r' % cmd_opts.failfast
        print '  debug: %r' % cmd_opts.debug
        print '  headless xserver: %r' % cmd_opts.xserver_headless
        print '  custom options: %r' % cmd_opts.custom
        print ''

    try:
        clear_old_results()
        runtests.runtests(
            args,
            test_dir=cmd_opts.dir_name,
            collect_only=cmd_opts.collect_only,
            report_format=cmd_opts.report_format,
            browser_type=cmd_opts.browser_type,
            javascript_disabled=cmd_opts.javascript_disabled,
            browsermob_enabled=bool(cmd_opts.browsermob),
            shared_directory=cmd_opts.shared_modules,
            screenshots_on=cmd_opts.screenshots_on,
            failfast=cmd_opts.failfast,
            debug=cmd_opts.debug,
            extended=cmd_opts.extended_tracebacks,
            saucelabs_enabled=cmd_opts.saucelabs_enabled,
            custom_options=cmd_opts.custom
        )
    finally:

        print '--------------------------------------------------------------'
        for desc, cmd in cleanups:
            # Run cleanups, displaying but not propagating exceptions
            try:
                print desc
                cmd()
            except Exception:
                print traceback.format_exc()
def main():
    cmd_opts, args = command.get_opts_run()

    print '--------------------------------------------------------------'
    print 'starting SST...'

    cleanups = []

    if cmd_opts.run_tests:
        cmd_opts.dir_name = 'selftests'
        if not tests.check_devserver_port_used(sst.DEVSERVER_PORT):
            run_django(sst.DEVSERVER_PORT)
            cleanups.append(('\nkilling django...', kill_django,
                             sst.DEVSERVER_PORT))
        else:
            print 'Error: port is in use.'
            print 'can not launch devserver for internal tests.'
            sys.exit(1)

    if cmd_opts.xserver_headless:
        from sst.xvfbdisplay import Xvfb
        print '\nstarting virtual display...'
        display = Xvfb(width=1024, height=768)
        display.start()
        cleanups.append(('\nstopping virtual display...', display.stop))

    if not cmd_opts.quiet:
        print ''
        print '  date time: %s' \
            % datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
        print '  test directory: %r' % cmd_opts.dir_name
        print '  report format: %r' % cmd_opts.report_format
        print '  browser type: %r' % cmd_opts.browser_type
        print '  shared directory: %r' % cmd_opts.shared_modules
        print '  screenshots on error: %r' % cmd_opts.screenshots_on
        print '  failfast: %r' % cmd_opts.failfast
        print '  debug: %r' % cmd_opts.debug
        print '  headless xserver: %r' % cmd_opts.xserver_headless
        print ''

    try:
        command.clear_old_results()
        factory = browsers.browser_factories.get(cmd_opts.browser_type)
        failures = runtests.runtests(
            args,
            test_dir=cmd_opts.dir_name,
            collect_only=cmd_opts.collect_only,
            report_format=cmd_opts.report_format,
            browser_factory=factory(cmd_opts.javascript_disabled),
            shared_directory=cmd_opts.shared_modules,
            screenshots_on=cmd_opts.screenshots_on,
            failfast=cmd_opts.failfast,
            debug=cmd_opts.debug,
            extended=cmd_opts.extended_tracebacks,
            excludes=cmd_opts.excludes
        )
    finally:

        print '--------------------------------------------------------------'
        for cleanup in cleanups:
            # run cleanups, displaying but not propagating exceptions
            desc = cleanup[0]
            cmd = cleanup[1]
            args = cleanup[2:]
            print desc
            try:
                cmd(*args)
            except Exception:
                print traceback.format_exc()

    return failures
Example #6
0
def main():
    cmd_opts, args = get_opts_run()

    print '----------------------------------------------------------------------'
    print 'starting SST...'

    if cmd_opts.browsermob and cmd_opts.run_tests:
        print 'Warning: can not record local traffic from django testproject'

    if cmd_opts.browsermob:
        browsermob_process = run_browsermob_server(cmd_opts.browsermob)

    if cmd_opts.run_tests:
        cmd_opts.dir_name = 'selftests'
        run_django()

    if cmd_opts.xserver_headless:
        from sst.xvfbdisplay import Xvfb
        print '\nstarting virtual display...'
        display = Xvfb(width=1024, height=768)
        display.start()

    if not cmd_opts.quiet:
        print ''
        print '  date time: %s' % datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
        print '  test directory: %r' % cmd_opts.dir_name
        print '  report format: %r' % cmd_opts.report_format
        print '  browser type: %r' % cmd_opts.browser_type
        print '  javascript disabled: %r' % cmd_opts.javascript_disabled
        print '  browswermob proxy launcher: %r' % cmd_opts.browsermob
        print '  shared directory: %r' % cmd_opts.shared_modules
        print '  screenshots on error: %r' % cmd_opts.screenshots_on
        print '  failfast: %r' % cmd_opts.failfast
        print '  debug: %r' % cmd_opts.debug
        print '  headless xserver: %r' % cmd_opts.xserver_headless
        print ''

    clear_old_results()
    sst.runtests(
        args,
        test_dir=cmd_opts.dir_name,
        report_format=cmd_opts.report_format,
        browser_type=cmd_opts.browser_type,
        javascript_disabled=cmd_opts.javascript_disabled,
        browsermob_enabled=bool(cmd_opts.browsermob),
        shared_directory=cmd_opts.shared_modules,
        screenshots_on=cmd_opts.screenshots_on,
        failfast=cmd_opts.failfast,
        debug=cmd_opts.debug,
        extended=cmd_opts.extended_tracebacks,
    )

    print '----------------------------------------------------------------------'

    if cmd_opts.browsermob:
        print '\nkilling browsermob proxy...'
        browsermob_process.kill()
        browsermob_process.wait()

    if cmd_opts.xserver_headless:
        print '\nstopping virtual display...'
        display.stop()

    if cmd_opts.run_tests:
        print '\nkilling django...'
        kill_django()