1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
window["%hammerhead%"].utils.removeInjectedScript(),function Ue(Me){var Ae=Me.document;!function(s,o,t){var e="default"in s?s.default:s,i="default"in o?o.default:o;t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var u={uiRoot:null,element:function(){return this.uiRoot||(this.uiRoot=Ae.createElement("div"),s.shadowUI.getRoot().appendChild(this.uiRoot)),this.uiRoot},hide:function(){this.uiRoot&&(this.uiRoot.style.visibility="hidden")},show:function(){this.uiRoot&&(this.uiRoot.style.visibility="")},remove:function(){var t=s.shadowUI.getRoot();s.nativeMethods.nodeParentNodeGetter.call(t).removeChild(t)}},h=e.shadowUI,c=e.utils.browser,a=e.utils.featureDetection,d=e.nativeMethods,p=e.eventSandbox.eventSimulator,m=e.eventSandbox.listeners,f=i.positionUtils,g=i.domUtils,v=i.styleUtils,y=i.eventUtils,C=i.arrayUtils,E=i.selectController,_="tcOptionList",r="disabled",w=c.isIE?30:20;function S(t){var e=d.eventTargetGetter.call(t),i=E.currentEl;(e||t.srcElement)===i||g.containsElement(i,e)||g.containsElement(E.optionList,e)||I()}function x(t,e,i){var n,s=d.eventTargetGetter.call(t),o=C.indexOf(E.options,s);o<0||(i(),(n=-1<s.className.indexOf(r))&&c.isWebKit||function(t,e){var i=E.currentEl,n=i.selectedIndex,s=i.getElementsByTagName("option")[t],o=!e&&t!==n;o&&!c.isIE&&(i.selectedIndex=t),c.isFirefox||c.isIE||!o||(p.input(i),p.change(i)),(c.isFirefox||c.isIE)&&p.mousedown(c.isFirefox?s:i),a.isTouchDevice||p.mouseup(c.isFirefox?s:i),(c.isFirefox||c.isIE)&&o&&(c.isIE&&(i.selectedIndex=t),c.isIE||p.input(i),p.change(i)),a.isTouchDevice||p.click(c.isFirefox||c.isIE?s:i),e||I()}(o,n))}function I(){g.remove(E.optionList),y.unbind(Ae,"mousedown",S),E.clear()}var n=Object.freeze({__proto__:null,expandOptionList:function(t){var e=t.children;if(e.length&&!t.disabled){if(E.currentEl){var i=t===E.currentEl;if(I(),i)return}var n=E.currentEl=t,s=E.optionList=Ae.createElement("div");u.element().appendChild(s),h.addClass(s,_),E.createChildren(e,s),m.addInternalEventBeforeListener(Me,["click"],x),d.setTimeout.call(Me,function(){y.bind(Ae,"mousedown",S)},0),v.set(s,{position:"absolute",fontSize:v.get(n,"fontSize"),fontFamily:v.get(n,"fontFamily"),minWidth:v.getWidth(n)+"px",left:f.getOffsetPosition(n).left+"px",height:g.getSelectVisibleChildren(t).length>w?v.getOptionHeight(t)*w:""});var o,a=f.getOffsetPosition(n).top,r=v.getHeight(s),l=a+v.getHeight(n)+2;l+r>v.getScrollTop(Me)+v.getHeight(Me)&&(o=a-3-r)>=v.getScrollTop(Me)&&(l=o),v.set(s,"top",l+"px")}},collapseOptionList:I,scrollOptionListByChild:function(t){var e,i,n,s,o,a,r=g.getSelectParent(t);r&&(e=v.getSelectElementSize(r),i=v.getOptionHeight(r),n=0,o=(s=Math.max(v.getScrollTop(r)/i,0))+e-1,(a=g.getChildVisibleIndex(r,t))<s?(n=i*(s-a),v.setScrollTop(r,Math.max(v.getScrollTop(r)-n,0))):o<a&&(n=i*(a-o),v.setScrollTop(r,v.getScrollTop(r)+n)))},getSelectChildCenter:function(t){var e=g.getSelectParent(t);if(!e)return{x:0,y:0};var i=v.getOptionHeight(e),n=f.getElementRectangle(t);return{x:Math.round(n.left+n.width/2),y:Math.round(n.top+i/2)}},switchOptionsByKeys:function(t,e){var i=v.getSelectElementSize(t),n=!v.hasDimensions(h.select("."+_)[0]);if(/down|up/.test(e)||!c.isIE&&(i<=1||c.isFirefox)&&(n||c.isFirefox)&&/left|right/.test(e)){for(var s=t.querySelectorAll("option"),o=[],a=0;a<s.length;a++){var r=s[a].parentElement;s[a].disabled||"optgroup"===g.getTagName(r)&&r.disabled||o.push(s[a])}var l=C.indexOf(o,s[t.selectedIndex])+(/down|right/.test(e)?1:-1);0<=l&&l<o.length&&(t.selectedIndex=C.indexOf(s,o[l]),c.isIE||p.input(t),p.change(t))}}}),l="Loading page...",b="modal-background",B="loading-text",T="loading-icon",U=null,M=null,A=null,V=!1;function D(){function t(){var t=o.styleUtils.getHeight(Me),e=o.styleUtils.getWidth(Me);o.styleUtils.set(U,"width",e+"px"),o.styleUtils.set(U,"height",t+"px"),o.styleUtils.set(A,{left:Math.round((e-o.styleUtils.getWidth(A))/2)+"px",top:Math.round((t-o.styleUtils.getHeight(A))/2)+"px"})}t(),o.eventUtils.bind(Me,"resize",t)}function R(){var t,e,i,n;t=u.element(),U=Ae.createElement("div"),t.appendChild(U),s.shadowUI.addClass(U,b),M=Ae.createElement("div"),s.nativeMethods.nodeTextContentSetter.call(M,l),t.appendChild(M),s.shadowUI.addClass(M,B),A=Ae.createElement("div"),o.styleUtils.set(A,"visibility","hidden"),t.appendChild(A),s.shadowUI.addClass(A,T),D(),e=o.styleUtils.getHeight(Me),i=o.styleUtils.getWidth(Me),(n=!o.styleUtils.hasDimensions(M))&&(o.styleUtils.set(M,"visibility","hidden"),o.styleUtils.set(M,"display","block")),o.styleUtils.set(M,{left:Math.max((i-o.styleUtils.getWidth(M))/2,0)+"px",top:Math.max((e-o.styleUtils.getHeight(M))/2,0)+"px"}),n&&(o.styleUtils.set(M,"display","none"),o.styleUtils.set(M,"visibility","")),V=!0}var P=Object.freeze({__proto__:null,initAndShowLoadingText:function(){function t(){R(),o.styleUtils.set(U,"opacity",.8),o.styleUtils.set(U,"display","block"),o.styleUtils.set(M,"display","block"),e=!0}var e=!1,i=function(){e||(Ae.body?t():s.nativeMethods.setTimeout.call(Me,i,0))};i(),o.eventUtils.documentReady().then(function(){e||t()})},show:function(t){V||R(),o.styleUtils.set(U,"opacity",t?0:.7),o.styleUtils.set(U,"display","block")},hide:function(){V&&(o.styleUtils.set(M,"display","none"),o.styleUtils.set(U,"display","none"))},showLoadingIcon:function(){o.styleUtils.set(A,"visibility","visible")},hideLoadingIcon:function(){o.styleUtils.set(A,"visibility","hidden")}}),k=e.shadowUI,W=i.styleUtils,O="success",F=(N.prototype.setValue=function(t){t="number"!=typeof t?0:Math.min(Math.max(t,0),100),W.set(this.valueElement,"width",t+"%")},N.prototype.setSuccess=function(t){t?k.addClass(this.containerElement,O):k.removeClass(this.containerElement,O)},N);function N(t){this.containerElement=Ae.createElement("div"),this.valueElement=Ae.createElement("div"),t.appendChild(this.containerElement),this.containerElement.appendChild(this.valueElement),k.addClass(this.containerElement,"progress-bar"),k.addClass(this.valueElement,"value")}var H=e.shadowUI,L=e.nativeMethods,q=i.eventUtils,z=i.styleUtils,G="progress-panel",j="title",K="content",Y=(X._getInvisibleElementProperty=function(t,e){var i="none"===z.get(t,"display");i&&z.set(t,"display","block");var n=t[e];return i&&z.set(t,"display","none"),n},X._showAtWindowCenter=function(t){var e=X._getInvisibleElementProperty(t,"offsetHeight"),i=X._getInvisibleElementProperty(t,"offsetWidth"),n=Math.round(z.getHeight(Me)/2-e/2),s=Math.round(z.getWidth(Me)/2-i/2);z.set(t,{left:s+"px",top:n+"px"})},X.prototype._setCurrentProgress=function(){var t=Math.round((L.dateNow()-this.startTime)/this.maxTimeout*100);this.progressBar.setValue(t)},X.prototype._setSuccess=function(t){this.progressBar.setSuccess(t)},X.prototype._stopAnimation=function(){L.clearInterval.call(Me,this.animationInterval)},X.prototype._animate=function(t,e,i,n){var s,o,a,r=this,l=L.dateNow(),u=i?0:1;i&&(z.set(t,"opacity",u),z.set(t,"display","block")),this._stopAnimation(),this.animationInterval=L.setInterval.call(Me,function(){s=L.dateNow()-l,o=Math.min(s/e,1),a=.5-Math.cos(o*Math.PI)/2,z.set(t,"opacity",u+(i?a:-a)),1===o&&(r._stopAnimation(),n&&n())},10)},X.prototype._showPanel=function(){q.bind(Me,"resize",this.disposePanel),this._animate(this.panelDiv,200,!0)},X.prototype._hidePanel=function(t){var e=this;this.startTime=null,q.unbind(Me,"resize",this.disposePanel),this._animate(this.panelDiv,t?0:600,!1,function(){return z.set(e.panelDiv,"display","none")})},X.prototype.show=function(t,e){var i=this;this.startTime=L.dateNow(),this.maxTimeout=e,L.nodeTextContentSetter.call(this.titleDiv,t),this._setSuccess(!1),this.openingTimeout=L.setTimeout.call(Me,function(){i.openingTimeout=null,i._setCurrentProgress(),i._showPanel(),i.updateInterval=L.setInterval.call(Me,function(){return i._setCurrentProgress()},100)},300)},X.prototype.close=function(t){var e=this;t&&this._setSuccess(!0),this.openingTimeout&&(L.clearTimeout.call(Me,this.openingTimeout),this.openingTimeout=null),this.updateInterval&&(L.clearInterval.call(Me,this.updateInterval),this.updateInterval=null),t?this.startTime&&L.dateNow()-this.startTime<1e3?L.setTimeout.call(Me,function(){L.setTimeout.call(Me,function(){return e._hidePanel(!1)},200)},100):L.setTimeout.call(Me,function(){return e._hidePanel(!1)},200):this._hidePanel(!0)},X);function X(){var t=this;this.startTime=null,this.openingTimeout=null,this.updateInterval=null,this.animationInterval=null,this.panelDiv=Ae.createElement("div"),u.element().appendChild(this.panelDiv),this.titleDiv=Ae.createElement("div"),this.panelDiv.appendChild(this.titleDiv),this.contentDiv=Ae.createElement("div"),this.panelDiv.appendChild(this.contentDiv),H.addClass(this.panelDiv,G),H.addClass(this.titleDiv,j),H.addClass(this.contentDiv,K),X._showAtWindowCenter(this.panelDiv),this.progressBar=new F(this.contentDiv),this.disposePanel=function(){return X._showAtWindowCenter(t.panelDiv)}}var J=function(t,e){return(J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function Q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}J(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var Z=e.shadowUI,$=e.nativeMethods,tt=i.styleUtils,et="determinate",it=(nt.prototype._setCurrentProgress=function(){var t=($.dateNow()-this.startTime)/this.maxTimeout,e=Math.min(Math.max(t,0),1),i=tt.getWidth(this.progressBar),n=Math.round(i*e);tt.set(this.firstValueElement,"width",n+"px")},nt.prototype.start=function(t,e){var i=this;Z.addClass(this.progressBar,et),this.maxTimeout=t,this.startTime=e||$.dateNow(),this._setCurrentProgress(),this.animationInterval=$.setInterval.call(Me,function(){return i._setCurrentProgress()},10)},nt.prototype.stop=function(){this.animationInterval&&($.clearInterval.call(Me,this.animationInterval),this.animationInterval=null)},nt.prototype.reset=function(){tt.set(this.firstValueElement,"width",0),Z.removeClass(this.progressBar,et)},nt);function nt(t,e){this.progressBar=t,this.firstValueElement=e,this.maxTimeout=null,this.startTime=null,this.animationInterval=null}function st(t,e,i){if(e.x===t.x)return 0;var n=(e.y-t.y)/(e.x-t.x),s=t.x*(t.y-e.y)/(e.x-t.x)+t.y;return Math.round(n*i+s)}var ot=e.shadowUI,at=e.nativeMethods,rt=i.styleUtils,lt={time:2800,points:[.815,.395],positionByCompletePercent:{0:{left:-35,right:100},.6:{left:100,right:-90},1:{left:100,right:-90}}},ut={time:3e3,points:[.84,1],positionByCompletePercent:{0:{left:-200,right:100},.6:{left:107,right:-8},1:{left:107,right:-8}}},ht=0,ct=.6,dt=1,pt="indeterminate",mt=(ft._updateValueAnimation=function(t,e,i){var n,s,o,a,r,l,u,h,c,d,p=i.time,m=i.points,f=i.positionByCompletePercent,g=at.dateNow()-t,v=(n=g/p,s=m[0],o=m[1],3*Math.pow(1-n,2)*n*s+3*(1-n)*n*n*o+n*n*n),y=(h=(l=(a=v)<ct)?ct:dt,c=(r=f)[u=l?ht:ct],d=r[h],{left:st({x:u,y:c.left},{x:h,y:d.left},a),right:st({x:u,y:c.right},{x:h,y:d.right},a)}),C=y.left,E=y.right;rt.set(e,"left",Math.round(C)+"%"),rt.set(e,"right",Math.round(E)+"%")},ft.prototype._clearFirstValueAnimation=function(){this.animationInterval&&(at.clearInterval.call(Me,this.animationInterval),this.animationInterval=null),rt.set(this.firstValue,"left","-35%"),rt.set(this.firstValue,"right","100%")},ft.prototype._clearSecondValueAnimation=function(){this.secondValueAnimationInterval&&(at.clearInterval.call(Me,this.secondValueAnimationInterval),this.secondValueAnimationInterval=null),rt.set(this.secondValue,"left","-200%"),rt.set(this.secondValue,"right","100%")},ft.prototype._startFirstValueAnimation=function(){var t=this;this._clearFirstValueAnimation();var e=at.dateNow();this.animationInterval=at.setInterval.call(Me,function(){ft._updateValueAnimation(e,t.firstValue,lt)},10)},ft.prototype._startSecondValueAnimation=function(){var t=this;this._clearSecondValueAnimation();var e=at.dateNow();this.secondValueAnimationInterval=at.setInterval.call(Me,function(){ft._updateValueAnimation(e,t.secondValue,ut)},10)},ft.prototype._startAnimation=function(){var t=this;this._startFirstValueAnimation(),this.secondValueAnimationTimeout=at.setTimeout.call(Me,function(){return t._startSecondValueAnimation()},1e3),this.restartAnimationTimeout=at.setTimeout.call(Me,function(){return t._startAnimation()},1950)},ft.prototype._stopAnimation=function(){this._clearFirstValueAnimation(),this._clearSecondValueAnimation(),this.secondValueAnimationTimeout&&(at.clearInterval.call(Me,this.secondValueAnimationTimeout),this.secondValueAnimationTimeout=null),this.restartAnimationTimeout&&(at.clearInterval.call(Me,this.restartAnimationTimeout),this.restartAnimationTimeout=null)},ft.prototype.start=function(){ot.addClass(this.progressBar,pt),this._startAnimation()},ft.prototype.stop=function(){ot.removeClass(this.progressBar,pt),this._stopAnimation()},ft);function ft(t,e,i){this.progressBar=t,this.firstValue=e,this.secondValue=i,this.animationInterval=null,this.secondValueAnimationInterval=null,this.secondValueAnimationTimeout=null,this.restartAnimationTimeout=null}var gt=e.shadowUI,vt=i.styleUtils,yt=(Ct.prototype._create=function(t){this.progressBar=Ae.createElement("div"),gt.addClass(this.progressBar,"progress-bar"),t.appendChild(this.progressBar);var e=Ae.createElement("div");gt.addClass(e,"value-container"),this.progressBar.appendChild(e),this.firstValueElement=Ae.createElement("div"),gt.addClass(this.firstValueElement,"value"),e.appendChild(this.firstValueElement),this.secondValueElement=Ae.createElement("div"),gt.addClass(this.secondValueElement,"value"),e.appendChild(this.secondValueElement)},Ct.prototype.show=function(){vt.set(this.progressBar,"visibility","visible")},Ct.prototype.hide=function(){vt.set(this.progressBar,"visibility","hidden")},Ct);function Ct(t){this.progressBar=null,this.firstValueElement=null,this.secondValueElement=null,this._create(t),this.determinateIndicator=new it(this.progressBar,this.firstValueElement),this.indeterminateIndicator=new mt(this.progressBar,this.firstValueElement,this.secondValueElement)}var Et,_t="start-waiting-element",wt="end-waiting-element-request",St="end-waiting-element-response",xt="start-waiting-assertion-retries",It="end-waiting-assertion-retries-request",bt="end-waiting-assertion-retries-response",Bt="step",Tt="resume",Ut=e.Promise,Mt=e.shadowUI,At=e.nativeMethods,Vt=e.eventSandbox.message,Dt=e.utils.browser,Rt=e.utils.featureDetection,Pt=e.eventSandbox.listeners,kt=i.styleUtils,Wt=i.eventUtils,Ot=i.domUtils,Ft=i.serviceUtils,Nt=i.arrayUtils,Ht="waiting-element-failed",Lt="waiting-element-success",qt="%testCafeStatusPrefix%",zt=(Q(Gt,Et=Ft.EventEmitter),Object.defineProperty(Gt.prototype,"visibleHeight",{get:function(){return this.maxHeight=Math.max(this.maxHeight,kt.getHeight(this.statusBar)),this.maxHeight},enumerable:!1,configurable:!0}),Gt.prototype._createButton=function(t,e){var i=Ae.createElement("div"),n=Ae.createElement("div"),s=Ae.createElement("span");return At.nodeTextContentSetter.call(s,t),Mt.addClass(i,"button"),Mt.addClass(i,e),Mt.addClass(n,"button-icon"),Dt.isSafari&&(s.style.position="relative",s.style.top="1px"),i.appendChild(n),i.appendChild(s),i},Gt.prototype._createIconArea=function(){this.icon=Ae.createElement("div"),Mt.addClass(this.icon,"icon"),this.statusBar.appendChild(this.icon)},Gt.prototype._createInformationArea=function(){this.infoContainer=Ae.createElement("div"),Mt.addClass(this.infoContainer,"info-container"),this.statusBar.appendChild(this.infoContainer);var t=Ae.createElement("div");Mt.addClass(t,"info-text-container"),this.infoContainer.appendChild(t);var e=Ae.createElement("div");Mt.addClass(e,"status-container"),t.appendChild(e),this.statusDiv=Ae.createElement("div"),this.statusDiv=Ae.createElement("div"),At.nodeTextContentSetter.call(this.statusDiv,this._getFullStatusText("Loading Web Page...")),Mt.addClass(this.statusDiv,"status"),Mt.addClass(this.statusDiv,"info"),e.appendChild(this.statusDiv);var i=Ae.createElement("div");At.nodeTextContentSetter.call(i,"".concat(this.fixtureName," - ").concat(this.testName)),Mt.addClass(i,"fixture"),Mt.addClass(i,"info"),e.appendChild(i);var n=Ae.createElement("div");At.nodeTextContentSetter.call(n,this.userAgent),Mt.addClass(n,"user-agent"),t.appendChild(n)},Gt.prototype._createActionsArea=function(){var t=this;this.actionsContainer=Ae.createElement("div"),Mt.addClass(this.actionsContainer,"actions-container"),this.statusBar.appendChild(this.actionsContainer),this.buttons=Ae.createElement("div"),Mt.addClass(this.buttons,"buttons"),this.actionsContainer.appendChild(this.buttons),this.unlockButton=this._createButton("Unlock Page","locked"),this.resumeButton=this._createButton("Resume","resume"),this.nextButton=this._createButton("Next Action","step"),this.finishButton=this._createButton("Finish","finish"),this.buttons.appendChild(this.unlockButton),this.buttons.appendChild(this.resumeButton),this.buttons.appendChild(this.nextButton),this.actionsContainer.style.display="none",this._bindClickOnce([this.unlockButton],function(){Mt.removeClass(t.unlockButton,"locked"),Mt.addClass(t.unlockButton,"unlocked"),At.nodeTextContentSetter.call(t.unlockButton.querySelector("span"),"Page unlocked"),t.state.locked=!1,t.emit(t.UNLOCK_PAGE_BTN_CLICK,{})}),this.unlockButton.style.display="none"},Gt.prototype._create=function(){this.statusBar=Ae.createElement("div"),Mt.addClass(this.statusBar,"status-bar"),this._createIconArea(),this._createInformationArea(),this._createActionsArea(),this.progressBar=new yt(this.infoContainer),this.progressBar.indeterminateIndicator.start(),this.progressBar.show(),u.element().appendChild(this.statusBar),this._bindHandlers(),this.state.created=!0},Gt.prototype._createBeforeReady=function(){var t,e=this;this.state.created||(t=Me).top!==t||(Ae.body?this._create():At.setTimeout.call(Me,function(){return e._createBeforeReady()},0))},Gt.prototype._animate=function(t){var e,i,n,s=this,o=At.dateNow(),a=parseInt(kt.get(this.statusBar,"opacity"),10)||0;this._stopAnimation(),t&&(kt.set(this.statusBar,"visibility",""),this.state.hidden=!1),this.animationInterval=At.setInterval.call(Me,function(){e=At.dateNow()-o,i=Math.min(e/500,1),n=.5-Math.cos(i*Math.PI)/2,kt.set(s.statusBar,"opacity",a+(t?n:-n)),1===i&&(s._stopAnimation(),t||(kt.set(s.statusBar,"visibility","hidden"),s.state.hidden=!0),s.state.showing=!1,s.state.hiding=!1)},10)},Gt.prototype._stopAnimation=function(){this.animationInterval&&(At.clearInterval.call(Me,this.animationInterval),this.animationInterval=null)},Gt.prototype._fadeOut=function(){this.state.hiding||this.state.debugging||(this.state.showing=!1,this.state.hiding=!0,this._animate())},Gt.prototype._fadeIn=function(){this.state.showing||this.state.debugging||(this.state.hiding=!1,this.state.showing=!0,this._animate(!0))},Gt.prototype._bindHandlers=function(){var e=this;Pt.initElementListening(Me,["resize"]),Pt.addInternalEventBeforeListener(Me,["resize"],function(){e.windowHeight=Me.innerHeight}),Pt.addFirstInternalEventBeforeListener(Me,["mousemove","mouseout","touchmove"],function(t){"mouseout"!==t.type||t.relatedTarget?"mousemove"!==t.type&&"touchmove"!==t.type||(t.clientY>e.windowHeight-e.visibleHeight?e._fadeOut(t):e.state.hidden&&e._fadeIn(t)):e._fadeIn(t)})},Gt.prototype._bindClickOnce=function(i,n){var s=this,o=Rt.isTouchDevice?"touchstart":"mousedown",a=function(t){var e=At.eventTargetGetter.call(t);Nt.find(i,function(t){return Ot.containsElement(t,e)})?(Wt.preventDefault(t),Pt.removeInternalEventBeforeListener(Me,[o],a),n(t)):Ot.containsElement(s.statusBar,e)&&Wt.preventDefault(t)};Pt.addInternalEventBeforeListener(Me,[o],a)},Gt.prototype._initChildListening=function(){var i=this;Vt.on(Vt.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.cmd===_t?i.showWaitingElementStatus(e.timeout):e.cmd===wt?i.hideWaitingElementStatus(e.waitingSuccess).then(function(){return Vt.sendServiceMsg({cmd:St},t.source)}):e.cmd===xt?i.showWaitingAssertionRetriesStatus(e.timeout):e.cmd===It&&i.hideWaitingAssertionRetriesStatus(e.waitingSuccess).then(function(){return Vt.sendServiceMsg({cmd:bt},t.source)})})},Gt.prototype._resetState=function(){this.state.debugging=!1,this.actionsContainer.style.display="none",this.unlockButton.style.display="none",At.nodeTextContentSetter.call(this.statusDiv,this._getFullStatusText("")),this.progressBar.hide()},Gt.prototype._getFullStatusText=function(t){var e=this.contextStorage.getItem(qt)||"";return e+(e&&t?". ":"")+t},Gt.prototype._showWaitingStatus=function(){var t=this.state.assertionRetries?"Waiting for assertion execution...":"Waiting for element to appear...";At.nodeTextContentSetter.call(this.statusDiv,this._getFullStatusText(t)),this.progressBar.show()},Gt.prototype._hideWaitingStatus=function(e){var i=this;return new Ut(function(t){At.setTimeout.call(Me,function(){i.state.waiting||i.state.debugging||(Mt.removeClass(i.statusBar,Lt),Mt.removeClass(i.statusBar,Ht),i.progressBar.determinateIndicator.reset(),i._resetState()),t()},e?0:500)})},Gt.prototype._showDebuggingStatus=function(t){var s=this;return new Ut(function(n){s.state.debugging=!0,s.state.locked=!0,t?(s.buttons.removeChild(s.nextButton),s.buttons.removeChild(s.resumeButton),s.buttons.appendChild(s.finishButton),At.nodeTextContentSetter.call(s.statusDiv,s._getFullStatusText("Test failed")),Mt.removeClass(s.statusBar,Lt),Mt.addClass(s.statusBar,Ht)):At.nodeTextContentSetter.call(s.statusDiv,s._getFullStatusText("Debugging test...")),s.actionsContainer.style.display="",s.unlockButton.style.display="",s._bindClickOnce([s.resumeButton,s.nextButton,s.finishButton],function(t){var e=At.eventTargetGetter.call(t),i=Ot.containsElement(s.nextButton,e);s._resetState(),n(i?Bt:Tt)})})},Gt.prototype._setWaitingStatus=function(t,e){var i=this;this.state.waiting=!0,this.progressBar.determinateIndicator.start(t,e),this.showingTimeout=At.setTimeout.call(Me,function(){i.showingTimeout=null,i._showWaitingStatus()},300)},Gt.prototype._resetWaitingStatus=function(t){this.state.waiting=!1,this.progressBar.determinateIndicator.stop(),t?Mt.addClass(this.statusBar,Lt):Mt.addClass(this.statusBar,Ht);var e=this.showingTimeout&&t;return this.showingTimeout&&(At.clearTimeout.call(Me,this.showingTimeout),this.showingTimeout=null,t||this._showWaitingStatus()),this._hideWaitingStatus(e)},Gt.prototype.hidePageLoadingStatus=function(){this.state.created||this._create(),this.progressBar.indeterminateIndicator.stop(),this._resetState()},Gt.prototype.showDebuggingStatus=function(t){return this._stopAnimation(),kt.set(this.statusBar,"opacity",1),kt.set(this.statusBar,"visibility",""),this.state.hiden=!1,this._showDebuggingStatus(t)},Gt.prototype.showWaitingElementStatus=function(t){this.state.assertionRetries||this._setWaitingStatus(t)},Gt.prototype.hideWaitingElementStatus=function(t){return this.state.assertionRetries?Ut.resolve():this._resetWaitingStatus(t)},Gt.prototype.showWaitingAssertionRetriesStatus=function(t,e){this.state.assertionRetries=!0,this._setWaitingStatus(t,e)},Gt.prototype.hideWaitingAssertionRetriesStatus=function(t){var e=this;return this._resetWaitingStatus(t).then(function(){e.state.assertionRetries=!1})},Gt.prototype.setStatusPrefix=function(t){this.contextStorage.setItem(qt,t),At.nodeTextContentSetter.call(this.statusDiv,this._getFullStatusText(""))},Gt);function Gt(t,e,i,n){var s=Et.call(this)||this;return s.UNLOCK_PAGE_BTN_CLICK="testcafe|ui|status-bar|unlock-page-btn-click",s.userAgent=t,s.fixtureName=e,s.testName=i,s.contextStorage=n,s.statusBar=null,s.infoContainer=null,s.actionsContainer=null,s.icon=null,s.resumeButton=null,s.finishButton=null,s.nextButton=null,s.statusDiv=null,s.buttons=null,s.progressBar=null,s.animationInterval=null,s.showingTimeout=null,s.windowHeight=Ae.documentElement?kt.getHeight(Me):Me.innerHeight,s.maxHeight=0,s.state={created:!1,showing:!1,hiding:!1,debugging:!1,waiting:!1,assertionRetries:!1,hidden:!1},s.currentView=null,s._createBeforeReady(),s._initChildListening(),s}var jt,Kt=i.sendRequestToFrame,Yt=e.eventSandbox.message,Xt=(Q(Jt,jt=zt),Jt.prototype.showWaitingElementStatus=function(t){Yt.sendServiceMsg({cmd:_t,timeout:t},Me.top)},Jt.prototype.hideWaitingElementStatus=function(t){return Kt({cmd:wt,waitingSuccess:t},St,Me.top)},Jt.prototype.showWaitingAssertionRetriesStatus=function(t){Yt.sendServiceMsg({cmd:xt,timeout:t},Me.top)},Jt.prototype.hideWaitingAssertionRetriesStatus=function(t){return Kt({cmd:It,waitingSuccess:t},bt,Me.top)},Jt);function Jt(){return jt.call(this)||this}var Qt="ui|cursor|move|request",Zt="ui|cursor|leftbuttondown|request",$t="ui|cursor|rightbuttondown|request",te="ui|cursor|buttonup|request",ee="ui|cursor|move|response",ie="ui|cursor|leftbuttondown|response",ne="ui|cursor|rightbuttondown|response",se="ui|cursor|buttonup|response",oe=e.Promise,ae=e.shadowUI,re=e.utils.browser,le=e.utils.featureDetection,ue=e.eventSandbox.message,he=i.styleUtils,ce=i.positionUtils,de="l-mouse-down",pe="r-mouse-down",me=[de,pe].join(" ");ue.on(ue.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;switch(e.cmd){case Qt:e.shouldRender||(fe.shouldRender=e.shouldRender),fe.move(ce.getIframePointRelativeToParentFrame({x:e.x,y:e.y},t.source)).then(function(){return ue.sendServiceMsg({cmd:ee},t.source)});break;case Zt:fe.leftButtonDown().then(function(){return ue.sendServiceMsg({cmd:ie},t.source)});break;case $t:fe.rightButtonDown().then(function(){return ue.sendServiceMsg({cmd:ne},t.source)});break;case te:fe.buttonUp().then(function(){return ue.sendServiceMsg({cmd:se},t.source)})}});var fe={cursorElement:null,x:50,y:50,pointerOffsetX:0,pointerOffsetY:0,shouldRender:!0,_createElement:function(){this.cursorElement=Ae.createElement("div"),ae.addClass(this.cursorElement,"cursor"),le.isTouchDevice&&!re.isIE&&(ae.addClass(this.cursorElement,"touch"),this.pointerOffsetX=Math.ceil(he.getWidth(this.cursorElement)/2),this.pointerOffsetY=Math.ceil(he.getHeight(this.cursorElement)/2)),u.element().appendChild(this.cursorElement)},_ensureCursorElement:function(){return!!this.shouldRender&&(this.cursorElement||this._createElement(),!0)},isVisible:function(){return this.cursorElement&&"hidden"!==he.get(this.cursorElement,"visibility")},hide:function(){this._ensureCursorElement()&&this.isVisible()&&he.set(this.cursorElement,"visibility","hidden")},show:function(){this._ensureCursorElement()&&he.set(this.cursorElement,"visibility","")},move:function(t){return this._ensureCursorElement()&&(this.x=t.x,this.y=t.y,he.set(this.cursorElement,{left:this.x-this.pointerOffsetX+"px",top:this.y-this.pointerOffsetY+"px"})),oe.resolve()},leftButtonDown:function(){return this._ensureCursorElement()&&(ae.removeClass(this.cursorElement,me),ae.addClass(this.cursorElement,de)),oe.resolve()},rightButtonDown:function(){return this._ensureCursorElement()&&(ae.removeClass(this.cursorElement,me),ae.addClass(this.cursorElement,pe)),oe.resolve()},buttonUp:function(){return this._ensureCursorElement()&&ae.removeClass(this.cursorElement,me),oe.resolve()}},ge=e.utils.browser.isIE?1:0,ve={move:function(t){var e={cmd:Qt,x:t.x+ge,y:t.y+ge,shouldRender:this.shouldRender};return o.sendRequestToFrame(e,ee,Me.parent)},leftButtonDown:function(){return o.sendRequestToFrame({cmd:Zt},ie,Me.parent)},rightButtonDown:function(){return o.sendRequestToFrame({cmd:$t},ne,Me.parent)},buttonUp:function(){return o.sendRequestToFrame({cmd:te},se,Me.parent)}},ye={screenshotMark:null,_createMark:function(){this.screenshotMark=Ae.createElement("img"),s.shadowUI.addClass(this.screenshotMark,"screenshot-mark"),this.screenshotMark.style.right=10/Me.devicePixelRatio+"px",this.screenshotMark.style.width=32/Me.devicePixelRatio+"px",this.screenshotMark.style.height=10/Me.devicePixelRatio+"px",this.hide(),s.shadowUI.getRoot().appendChild(this.screenshotMark)},hide:function(){this.screenshotMark&&(this.screenshotMark.style.visibility="hidden")},show:function(t){this.screenshotMark||this._createMark(),s.nativeMethods.imageSrcSetter.call(this.screenshotMark,t),this.screenshotMark.style.visibility=""}},Ce=e.Promise,Ee=e.eventSandbox.message,_e=i.sendRequestToFrame,we="ui|hide|request",Se="ui|hide|response",xe="ui|show|request",Ie="ui|show|response";Ee.on(Ee.SERVICE_MSG_RECEIVED_EVENT,function(t){t.message.cmd===we?(u.hide(),Ee.sendServiceMsg({cmd:Se},t.source)):t.message.cmd===xe&&(u.show(),Ee.sendServiceMsg({cmd:Ie},t.source))});var be={};be.uiRoot=u,be.cursorUI=fe,be.iframeCursorUI=ve,be.selectElement=n,be.modalBackground=P,be.ProgressPanel=Y,be.StatusBar=zt,be.IframeStatusBar=Xt,be.hide=function(t){return t?_e({cmd:we},Se,Me.top):(u.hide(),Ce.resolve())},be.show=function(t){return t?_e({cmd:xe},Ie,Me.top):(u.show(),Ce.resolve())},be.showScreenshotMark=function(t){return ye.show(t)},be.hideScreenshotMark=function(){return ye.hide()};var Be=e.nativeMethods,Te=e.EVENTS.evalIframeScript;Be.objectDefineProperty(Me,"%testCafeUI%",{configurable:!0,value:be}),e.on(Te,function(t){return Ue(Be.contentWindowGetter.call(t.iframe))})}(Me["%hammerhead%"],Me["%testCafeCore%"],Me["%hammerhead%"].Promise)}(window); |