functionM(){for(vare=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;varr=Array(e),o=0;for(t=0;t<n;t++)for(varu=arguments[t],i=0,c=u.length;i<c;i++,o++)r[o]=u[i];returnr}"undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);for(varA=[],D=0;D<256;++D)A[D]=(D+256).toString(16).substr(1);functionN(e){vart=getCurrentPages().find((function(t){returnt.$page.id===e}));if(!t)throwError("page["+e+"] not found");varn=t.$vm._$weex;returnn.document.__$weex__||(n.document.__$weex__=n),n.document}vark={},q={};["text","image","input","textarea","video","web-view","slider"].forEach((function(e){k[e]=!0,q["u-"+e]=!0}));varj=["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"],R=j.map((function(e){returns(a(e))}));functionV(e){vart=e.type;if(q[t])returnt.replace("u-","");varn=e.__vue__&&e.__vue__.$options.name;return"USlider"===n?"slider":n&&-1!==R.indexOf(n)?i(n):t}functionL(e){vart={elementId:e.nodeId,tagName:V(e),nvue:!0},n=e.__vue__;returnn&&!n.$options.isReserved&&(t.nodeId=n._uid),"video"===t.tagName&&(t.videoId=t.nodeId),t}functionB(e,t,n){for(varr=e.children,o=0;o<r.length;o++){varu=r[o];if(t(u)){if(!n)returnu;n.push(u)}if(n)B(u,t,n);else{vari=B(u,t,n);if(i)returni}}returnn}functionH(e,t,n){varr,o;if(0===t.indexOf("#")?(r=t.substr(1),o=function(e){returne.attr&&e.attr.id===r}):0===t.indexOf(".")&&(r=t.substr(1),o=function(e){returne.classList&&-1!==e.classList.indexOf(r)}),o){varu=B(e,o,n);if(!u)throwError("Node("+t+") not exists");returnu}if("body"===t)returnObject.assign({},e,{type:"page"});0===t.indexOf("uni-")&&(t=t.replace("uni-",""));vari=k[t]?"u-"+t:t,c=-1!==j.indexOf(i)?s(a(i)):"",f=B(e,(function(e){returne.type===i||c&&e.__vue__&&e.__vue__.$options.name===c}),n);if(!f)throwError("Node("+t+") not exists");returnf}varU=[{test:function(e){return2===e.length&&-1!==e.indexOf("document.documentElement.scrollWidth")&&-1!==e.indexOf("document.documentElement.scrollHeight")},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e){return1===e.length&&"document.documentElement.scrollTop"===e[0]},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){n([e.size&&Math.abs(e.size.top)||0])}))}))}},{test:function(e){return2===e.length&&-1!==e.indexOf("offsetWidth")&&-1!==e.indexOf("offsetHeight")},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e,t){return1===e.length&&"innerText"===e[0]},call:function(e){returnPromise.resolve([X(e,[]).join("")])}}];functionX(e,t){return"u-text"===e.type?t.push(e.attr.value):e.pureChildren.map((function(e){returnX(e,t)})),t}functionW(e){returne.replace(/\n/g,"").replace(/<u-/g,"<").replace(/<\/u-/g,"</")}functionz(e,t){return"outer"===t?"body"===e.role&&"scroll-view"===e.type?"<page>"+W(z(e,"inner"))+"</page>":W(e.toString()):W(e.pureChildren.map((function(e){returne.toString()})).join(""))}varJ={input:{input:function(e,t){e.setValue(t)}},textarea:{input:function(e,t){e.setValue(t)}},"scroll-view":{scrollTo:function(e,t,n){e.scrollTo(n)},scrollTop:function(e){return0},scrollLeft:function(e){return0},scrollWidth:function(e){return0},scrollHeight:function(e){return0}},swiper:{swipeTo:function(e,t){e.__vue__.current=t}},"movable-view":{moveTo:function(e,t,n){varr=e.__vue__;r.x=t,r.y=n}},switch:{tap:function(e){vart=e.__vue__;t.checked=!t.checked}},slider:{slideTo:function(e,t){e.__vue__.value=t}}};functionF(e){returnN(e).body}varK={getWindow:function(e){returnF(e)},getDocument:function(e){returnF(e)},getEl:function(e,t){varn=N(t).getRef(e);if(!n)throwError("element destroyed");returnn},getOffset:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n({left:e.size.left,top:e.size.top}):n({left:0,top:0})}))}))},querySelector:function(e,t){returnPromise.resolve(L(H(e,t)))},querySelectorAll:function(e,t){returnPromise.resolve({elements:H(e,t,[]).map((function(e){returnL(e)}))})},queryProperties:function(e,t){varn=U.find((function(n){returnn.test(t,e)}));returnn?n.call(e).then((function(e){return{properties:e}})):Promise.resolve({properties:t.map((function(t){returnd(e,t)}))})},queryAttributes:function(e,t){varn=e.attr;returnPromise.resolve({attributes:t.map((function(t){return"class"===t?(e.classList||[]).join(""):String(n[t]||n[a(t)]||"")}))})},queryStyles:function(e,t){varn=e.style;returnPromise.resolve({styles:t.map((function(e){returnn[e]}))})},queryHTML:function(e,t){returnPromise.resolve({html:z(e,t)})},dispatchTapEvent:function(e){returne.fireEvent("click",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchLongpressEvent:function(e){returne.fireEvent("longpress",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchTouchEvent:function(e,t,n){returnn||(n={}),n.touches||(n.touches=[]),n.changedTouches||(n.changedTouches=[]),n.touches.length||n.touches.push({identifier:Date.now(),target:e}),e.fireEvent(t,Object.assign({timeStamp:Date.now(),target:e,currentTarget:e},n),!0),Promise.resolve()},callFunction:function(e,t,n){varr=d(J,t);returnr?Promise.resolve({result:r.apply(null,M([e],n))}):Promise.reject(Error(t+" not exists"))},triggerEvent:function(e,t,n){varr=e.__vue__;returnr?r.$trigger&&r.$trigger(t,{},n):e.fireEvent(t,{timeStamp:Date.now(),target:e,currentTarget:e},!1,{params:[{detail:n}]}),Promise.resolve()}};varQ={};Object.keys($).forEach((function(e){Q["App."+e]=$[e]})),Object.keys(b).forEach((function(e){Q["Page."+e]=b[e]})),Object.keys(C).forEach((function(e){Q["Element."+e]=C[e]}));varY,Z,G,ee=process.env.UNI_AUTOMATOR_WS_ENDPOINT;functionte(e){G.send({data:JSON.stringify(e)})}functionne(e){vart=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,u={id:n},i=Q[r];if(!i){if(Z){varc=Z(n,r,o,u);if(!0===c)return;i=c}if(!i)returnu.error={message:r+" unimplemented"},te(u)}try{i(o).then((function(e){e&&(u.result=e)})).catch((function(e){u.error={message:e.message}})).finally((function(){te(u)}))}catch(e){u.error={message:e.message},te(u)}}Z=function(e,t,n,r){varo=n.pageId,u=function(e){vart=getCurrentPages();if(!e)returnt[t.length-1];returnt.find((function(t){returnt.$page.id===e}))}(o);returnu?!u.$page.meta.isNVue?(UniServiceJSBridge.publishHandler("sendAutoMessage",{id:e,method:t,params:n},o),!0):(Y||(Y=Object.assign({},function(e){return{"Page.getElement":function(t){returne.querySelector(e.getDocument(t.pageId),t.selector)},"Page.getElements":function(t){returne.querySelectorAll(e.getDocument(t.pageId),t.selector)},"Page.getWindowProperties":function(t){returne.queryProperties(e.getWindow(t.pageId),t.names)}}}(K),function(e){vart=function(t){returne.getEl(t.elementId,t.pageId)};return{"Element.getElement":function(n){returne.querySelector(t(n),n.selector)},"Element.getElements":function(n){returne.querySelectorAll(t(n),n.selector)},"Element.getDOMProperties":function(n){returne.queryProperties(t(n),n.names)},"Element.getProperties":function(n){varr=t(n),o=r.__vue__||r.attr||{};returne.queryProperties(o,n.names)},"Element.getOffset":function(n){returne.getOffset(t(n))},"Element.getAttributes":function(n){returne.queryAttributes(t(n),n.names)},"Element.getStyles":function(n){returne.queryStyles(t(n),n.names)},"Element.getHTML":function(n){returne.queryHTML(t(n),n.type)},"Element.tap":function(n){returne.dispatchTapEvent(t(n))},"Element.longpress":function(n){returne.dispatchLongpressEvent(t(n))},"Element.touchstart":function(n){returne.dispatchTouchEvent(t(n),"touchstart",n)},"Element.touchmove":function(n){returne.dispatchTouchEvent(t(n),"touchmove",n)},"Element.touchend":function(n){returne.dispatchTouchEvent(t(n),"touchend",n)},"Element.callFunction":function(n){returne.callFunction(t(n),n.functionName,n.args)},"Element.triggerEvent":function(n){returne.triggerEvent(t(n),n.type,n.detail)}}}(K))),Y[t]):(r.error={message:"page["+o+"] not exists"},te(r),!0)},UniServiceJSBridge.subscribe("onAutoMessageReceive",(function(e){te(e)})),setTimeout((function(){vare;global.testMessage=ne,void0===e&&(e={}),(G=uni.connectSocket({url:ee,complete:function(){}})).onMessage(ne),G.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),G.onError((function(e){console.log("automator.onError",e)})),G.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))}),500);
functionM(){for(vare=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;varr=Array(e),o=0;for(t=0;t<n;t++)for(varu=arguments[t],i=0,c=u.length;i<c;i++,o++)r[o]=u[i];returnr}"undefined"!=typeofcrypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeofmsCrypto&&"function"==typeofmsCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);for(varA=[],D=0;D<256;++D)A[D]=(D+256).toString(16).substr(1);functionN(e){vart=getCurrentPages().find((function(t){returnt.$page.id===e}));if(!t)throwError("page["+e+"] not found");varn=t.$vm._$weex;returnn.document.__$weex__||(n.document.__$weex__=n),n.document}vark={},q={};["text","image","input","textarea","video","web-view","slider"].forEach((function(e){k[e]=!0,q["u-"+e]=!0}));varj=["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"],R=j.map((function(e){returns(a(e))}));functionV(e){vart=e.type;if(q[t])returnt.replace("u-","");varn=e.__vue__&&e.__vue__.$options.name;return"USlider"===n?"slider":n&&-1!==R.indexOf(n)?i(n):t}functionL(e){vart={elementId:e.nodeId,tagName:V(e),nvue:!0},n=e.__vue__;returnn&&!n.$options.isReserved&&(t.nodeId=n._uid),"video"===t.tagName&&(t.videoId=t.nodeId),t}functionB(e,t,n){for(varr=e.children,o=0;o<r.length;o++){varu=r[o];if(t(u)){if(!n)returnu;n.push(u)}if(n)B(u,t,n);else{vari=B(u,t,n);if(i)returni}}returnn}functionH(e,t,n){varr,o;if(0===t.indexOf("#")?(r=t.substr(1),o=function(e){returne.attr&&e.attr.id===r}):0===t.indexOf(".")&&(r=t.substr(1),o=function(e){returne.classList&&-1!==e.classList.indexOf(r)}),o){varu=B(e,o,n);if(!u)throwError("Node("+t+") not exists");returnu}if("body"===t)returnObject.assign({},e,{type:"page"});0===t.indexOf("uni-")&&(t=t.replace("uni-",""));vari=k[t]?"u-"+t:t,c=-1!==j.indexOf(i)?s(a(i)):"",f=B(e,(function(e){returne.type===i||c&&e.__vue__&&e.__vue__.$options.name===c}),n);if(!f)throwError("Node("+t+") not exists");returnf}varU=[{test:function(e){return2===e.length&&-1!==e.indexOf("document.documentElement.scrollWidth")&&-1!==e.indexOf("document.documentElement.scrollHeight")},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e){return1===e.length&&"document.documentElement.scrollTop"===e[0]},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){n([e.size&&Math.abs(e.size.top)||0])}))}))}},{test:function(e){return2===e.length&&-1!==e.indexOf("offsetWidth")&&-1!==e.indexOf("offsetHeight")},call:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e,t){return1===e.length&&"innerText"===e[0]},call:function(e){returnPromise.resolve([X(e,[]).join("")])}}];functionX(e,t){return"u-text"===e.type?t.push(e.attr.value):e.pureChildren.map((function(e){returnX(e,t)})),t}functionW(e){returne.replace(/\n/g,"").replace(/<u-/g,"<").replace(/<\/u-/g,"</")}functionz(e,t){return"outer"===t?"body"===e.role&&"scroll-view"===e.type?"<page>"+W(z(e,"inner"))+"</page>":W(e.toString()):W(e.pureChildren.map((function(e){returne.toString()})).join(""))}varJ={input:{input:function(e,t){e.setValue(t)}},textarea:{input:function(e,t){e.setValue(t)}},"scroll-view":{scrollTo:function(e,t,n){e.scrollTo(n)},scrollTop:function(e){return0},scrollLeft:function(e){return0},scrollWidth:function(e){return0},scrollHeight:function(e){return0}},swiper:{swipeTo:function(e,t){e.__vue__.current=t}},"movable-view":{moveTo:function(e,t,n){varr=e.__vue__;r.x=t,r.y=n}},switch:{tap:function(e){vart=e.__vue__;t.checked=!t.checked}},slider:{slideTo:function(e,t){e.__vue__.value=t}}};functionF(e){returnN(e).body}varK={getWindow:function(e){returnF(e)},getDocument:function(e){returnF(e)},getEl:function(e,t){varn=N(t).getRef(e);if(!n)throwError("element destroyed");returnn},getOffset:function(e){vart=e.__$weex__||e.ownerDocument.__$weex__;returnnewPromise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n({left:e.size.left,top:e.size.top}):n({left:0,top:0})}))}))},querySelector:function(e,t){returnPromise.resolve(L(H(e,t)))},querySelectorAll:function(e,t){returnPromise.resolve({elements:H(e,t,[]).map((function(e){returnL(e)}))})},queryProperties:function(e,t){varn=U.find((function(n){returnn.test(t,e)}));returnn?n.call(e).then((function(e){return{properties:e}})):Promise.resolve({properties:t.map((function(t){returnd(e,t)}))})},queryAttributes:function(e,t){varn=e.attr;returnPromise.resolve({attributes:t.map((function(t){return"class"===t?(e.classList||[]).join(""):String(n[t]||n[a(t)]||"")}))})},queryStyles:function(e,t){varn=e.style;returnPromise.resolve({styles:t.map((function(e){returnn[e]}))})},queryHTML:function(e,t){returnPromise.resolve({html:z(e,t)})},dispatchTapEvent:function(e){returne.fireEvent("click",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchLongpressEvent:function(e){returne.fireEvent("longpress",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchTouchEvent:function(e,t,n){returnn||(n={}),n.touches||(n.touches=[]),n.changedTouches||(n.changedTouches=[]),n.touches.length||n.touches.push({identifier:Date.now(),target:e}),e.fireEvent(t,Object.assign({timeStamp:Date.now(),target:e,currentTarget:e},n),!0),Promise.resolve()},callFunction:function(e,t,n){varr=d(J,t);returnr?Promise.resolve({result:r.apply(null,M([e],n))}):Promise.reject(Error(t+" not exists"))},triggerEvent:function(e,t,n){varr=e.__vue__;returnr?r.$trigger&&r.$trigger(t,{},n):e.fireEvent(t,{timeStamp:Date.now(),target:e,currentTarget:e},!1,{params:[{detail:n}]}),Promise.resolve()}};varQ={};Object.keys($).forEach((function(e){Q["App."+e]=$[e]})),Object.keys(b).forEach((function(e){Q["Page."+e]=b[e]})),Object.keys(C).forEach((function(e){Q["Element."+e]=C[e]}));varY,Z,G,ee=process.env.UNI_AUTOMATOR_WS_ENDPOINT;functionte(e){G.send({data:JSON.stringify(e)})}functionne(e){vart=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,u={id:n},i=Q[r];if(!i){if(Z){varc=Z(n,r,o,u);if(!0===c)return;i=c}if(!i)returnu.error={message:r+" unimplemented"},te(u)}try{i(o).then((function(e){e&&(u.result=e)})).catch((function(e){u.error={message:e.message}})).finally((function(){te(u)}))}catch(e){u.error={message:e.message},te(u)}}Z=function(e,t,n,r){varo=n.pageId,u=function(e){vart=getCurrentPages();if(!e)returnt[t.length-1];returnt.find((function(t){returnt.$page.id===e}))}(o);returnu?!u.$page.meta.isNVue?(UniServiceJSBridge.publishHandler("sendAutoMessage",{id:e,method:t,params:n},o),!0):(Y||(Y=Object.assign({},function(e){return{"Page.getElement":function(t){returne.querySelector(e.getDocument(t.pageId),t.selector)},"Page.getElements":function(t){returne.querySelectorAll(e.getDocument(t.pageId),t.selector)},"Page.getWindowProperties":function(t){returne.queryProperties(e.getWindow(t.pageId),t.names)}}}(K),function(e){vart=function(t){returne.getEl(t.elementId,t.pageId)};return{"Element.getElement":function(n){returne.querySelector(t(n),n.selector)},"Element.getElements":function(n){returne.querySelectorAll(t(n),n.selector)},"Element.getDOMProperties":function(n){returne.queryProperties(t(n),n.names)},"Element.getProperties":function(n){varr=t(n),o=r.__vue__||r.attr||{};returne.queryProperties(o,n.names)},"Element.getOffset":function(n){returne.getOffset(t(n))},"Element.getAttributes":function(n){returne.queryAttributes(t(n),n.names)},"Element.getStyles":function(n){returne.queryStyles(t(n),n.names)},"Element.getHTML":function(n){returne.queryHTML(t(n),n.type)},"Element.tap":function(n){returne.dispatchTapEvent(t(n))},"Element.longpress":function(n){returne.dispatchLongpressEvent(t(n))},"Element.touchstart":function(n){returne.dispatchTouchEvent(t(n),"touchstart",n)},"Element.touchmove":function(n){returne.dispatchTouchEvent(t(n),"touchmove",n)},"Element.touchend":function(n){returne.dispatchTouchEvent(t(n),"touchend",n)},"Element.callFunction":function(n){returne.callFunction(t(n),n.functionName,n.args)},"Element.triggerEvent":function(n){returne.triggerEvent(t(n),n.type,n.detail)}}}(K))),Y[t]):(r.error={message:"page["+o+"] not exists"},te(r),!0)},UniServiceJSBridge.subscribe("onAutoMessageReceive",(function(e){te(e)})),setTimeout((function(){vare;void0===e&&(e={}),(G=uni.connectSocket({url:ee,complete:function(){}})).onMessage(ne),G.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),G.onError((function(e){console.log("automator.onError",e)})),G.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))}),500);