コード例 #1
0
ファイル: views.py プロジェクト: malazay/ASM
def run_server(request, server_id):
    server = get_object_or_404(Server, pk=server_id)
    server.server_status = server.isActive()
    params = "--local-timezone"
    reset = "no"
    if server.full_reset:
        reset = "full"
    if server.udid is not None and type(server.udid) is not 'NoneType' and len(server.udid) > 0:
        params += " -U " + server.udid
    if server.is_iOS:
        params += " --webkit-debug-proxy-port " + server.webkit_executable.port
    if server.is_iOS and not server.webkit_proxy_open():
        webkit_counter = 0
        start_webkit_proxy(server.webkit_executable.node_path, server.webkit_executable.executable_path,
                           server.webkit_executable.port, server.udid, "", server_id + "webkit.txt")
        while not server.webkit_proxy_open() and webkit_counter < 10:
            time.sleep(1)
            webkit_counter += 1
        if not server.webkit_proxy_open():
            print "Webkit Server can't be opened, be sure you have an iOS device/simulator opened"
    start_appium_server(server.appium_executable.node_path, server.appium_executable.executable_path, server.ip_address,
                        server.port_number, server.chromedriver_port, server.bootstrap_port, server.selendroid_port,
                        reset,server.session_override, params, server_id+".txt")

    counter = 0
    while not server.isActive() and counter < 60:
        time.sleep(1)
        counter += 1
    return HttpResponseRedirect(request.META.get('HTTP_REFERER'))
コード例 #2
0
ファイル: views.py プロジェクト: malazay/ASM
def start_webkit(request, server_id):
    server = get_object_or_404(Server, pk=server_id)
    params = ""
    if server.udid is not None and type(server.udid) is not 'NoneType' and len(server.udid) > 0:
        params += " -U " + server.udid
    if server.is_iOS and not server.webkit_proxy_open():
        webkit_counter = 0
        start_webkit_proxy(server.webkit_executable.node_path, server.webkit_executable.executable_path,
                           server.webkit_executable.port, server.udid, "", server_id + "webkit.txt")
        while not server.webkit_proxy_open() and webkit_counter < 10:
            kill_webkit_proxy(server.webkit_executable.port)
            time.sleep(3)
            webkit_counter += 1
        if not server.webkit_proxy_open():
            print "Webkit Server can't be opened, be sure you have an iOS device/simulator opened"
    return HttpResponseRedirect(request.META.get('HTTP_REFERER'))