var url,progress,WebSocket=require("..").Client,deflate=require("permessage-deflate"),pace=require("pace"),host="ws://localhost:9001",agent=encodeURIComponent("node-"+process.version),cases=0,options={extensions:[deflate]},socket=new WebSocket(host+"/getCaseCount");socket.onmessage=function(e){console.log("Total cases to run: "+e.data),cases=parseInt(e.data),progress=pace(cases)};var runCase=function(e){e>cases?(socket=new WebSocket(url=host+"/updateReports?agent="+agent)).onclose=process.exit:((socket=new WebSocket(url=host+"/runCase?case="+e+"&agent="+agent,[],options)).pipe(socket),socket.on("close",function(){progress.op(),runCase(e+1)}))};socket.onclose=function(){runCase(1)};