testcafe
Version:
Automated browser testing for the modern web development stack.
1 lines • 101 kB
JavaScript
!function(){function initTestCafeClientDrivers(window,isIFrameWithoutSrc){var document=window.document;!function(l){"use strict";var f,h,o,m,p,i={".js":[],".json":[],".css":[],".html":[]},u="function"==typeof require?require:null;return m=function(e){var t=new Error("Could not find module '"+e+"'");return t.code="MODULE_NOT_FOUND",t},p=function(e,t,r){var n,o;if("function"==typeof e[t+r])return t+r;for(n=0;o=i[r][n];++n)if("function"==typeof e[t+o])return t+o;return null},f=function(e,t,r,n,o,i){var a,s,l,u,c,d;for("."!==(a=(r=r.split(/[\\/]/)).pop())&&".."!==a||(r.push(a),a="");null!=(s=r.shift());)if(s&&"."!==s&&(".."===s?(e=t.pop(),i=i.slice(0,i.lastIndexOf("/"))):(t.push(e),e=e[s],i+="/"+s),!e))throw m(n);if(a&&"function"!=typeof e[a]&&((d=(d=(d=(d=p(e,a,".js"))||p(e,a,".json"))||p(e,a,".css"))||p(e,a,".html"))?a=d:2!==o&&"object"==typeof e[a]&&(t.push(e),e=e[a],i+="/"+a,a="")),!a)return 1!==o&&e[":mainpath:"]?f(e,t,e[":mainpath:"],n,1,i):f(e,t,"index",n,2,i);if(!(c=e[a]))throw m(n);return c.hasOwnProperty("module")?c.module.exports:(l={},c.module=u={exports:l,id:i+"/"+a},c.call(l,l,u,h(e,t,i)),u.exports)},o=function(e,t,r,n){var o,i=r,a=r.charAt(0),s=0;if("/"===a){if(i=i.slice(1),!(e=l["/"])){if(u)return u(r);throw m(r)}n="/",t=[]}else if("."!==a){if(o=i.split("/",1)[0],!(e=l[o])){if(u)return u(r);throw m(r)}n=o,t=[],(i=i.slice(o.length+1))||(s=(i=e[":mainpath:"])?1:(i="index",2))}return f(e,t,i,r,s,n)},(h=function(t,r,n){return function(e){return o(t,[].concat(r),e,n)}})(l,[],"")}({replicator:{":mainpath:":"index.js","index.js":function(O,P,Q){function _(e,t){this.references=e,this.transforms=t,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var R="@t",T=/^#*@(t|r)$/,U=eval("this"),V="function"==typeof ArrayBuffer,W="function"==typeof Map,X="function"==typeof Set,Y=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],Z=Array.prototype.slice,$={serialize:function(e){return JSON.stringify(e)},deserialize:function(e){return JSON.parse(e)}};_._createRefMark=function(e){var t=Object.create(null);return t["@r"]=e,t},_.prototype._createCircularCandidate=function(e,t,r){this.circularCandidates.push(e),this.circularCandidatesDescrs.push({parent:t,key:r,refIdx:-1})},_.prototype._applyTransform=function(e,t,r,n){var o=Object.create(null),i=n.toSerializable(e);return"object"==typeof i&&this._createCircularCandidate(e,t,r),o[R]=n.type,o.data=this._handleValue(i,t,r),o},_.prototype._handleArray=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=this._handleValue(e[r],t,r);return t},_.prototype._handlePlainObject=function(r){var n=this,o=Object.create(null);return Object.getOwnPropertyNames(r).forEach(function(e){var t=T.test(e)?"#"+e:e;o[t]=n._handleValue(r[e],o,t)}),o},_.prototype._handleObject=function(e,t,r){return this._createCircularCandidate(e,t,r),Array.isArray(e)?this._handleArray(e):this._handlePlainObject(e)},_.prototype._ensureCircularReference=function(e){var t=this.circularCandidates.indexOf(e);if(-1<t){var r=this.circularCandidatesDescrs[t];return-1===r.refIdx&&(r.refIdx=r.parent?++this.circularRefCount:0),_._createRefMark(r.refIdx)}return null},_.prototype._handleValue=function(e,t,r){var n=typeof e,o="object"==n&&null!==e;if(o){var i=this._ensureCircularReference(e);if(i)return i}for(var a=0;a<this.transforms.length;a++){var s=this.transforms[a];if(s.shouldTransform(n,e))return this._applyTransform(e,t,r,s)}return o?this._handleObject(e,t,r):e},_.prototype.transform=function(){for(var e=[this._handleValue(this.references,null,null)],t=0;t<this.circularCandidatesDescrs.length;t++){var r=this.circularCandidatesDescrs[t];0<r.refIdx&&(e[r.refIdx]=r.parent[r.key],r.parent[r.key]=_._createRefMark(r.refIdx))}return e};function aa(e,t){this.references=e,this.transformMap=t,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}aa.prototype._handlePlainObject=function(t){var r=this,n=Object.create(null),e=Object.getOwnPropertyNames(t);for(var o in e.forEach(function(e){r._handleValue(t[e],t,e),T.test(e)&&(n[e.substring(1)]=t[e],delete t[e])}),n)t[o]=n[o]},aa.prototype._handleTransformedObject=function(e,t,r){var n=e[R],o=this.transformMap[n];if(!o)throw new Error("Can't find transform for \""+n+'" type.');this.activeTransformsStack.push(e),this._handleValue(e.data,e,"data"),this.activeTransformsStack.pop(),t[r]=o.fromSerializable(e.data)},aa.prototype._handleCircularSelfRefDuringTransform=function(e,t,r){var n=this.references,o=void 0;Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get:function(){return void 0===o&&(o=n[e]),o},set:function(e){return o=e}})},aa.prototype._handleCircularRef=function(e,t,r){-1<this.activeTransformsStack.indexOf(this.references[e])?this._handleCircularSelfRefDuringTransform(e,t,r):(this.visitedRefs[e]||(this.visitedRefs[e]=!0,this._handleValue(this.references[e],this.references,e)),t[r]=this.references[e])},aa.prototype._handleValue=function(e,t,r){if("object"==typeof e&&null!==e){var n=e["@r"];if(void 0!==n)this._handleCircularRef(n,t,r);else if(e[R])this._handleTransformedObject(e,t,r);else if(Array.isArray(e))for(var o=0;o<e.length;o++)this._handleValue(e[o],e,o);else this._handlePlainObject(e)}},aa.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var ba=[{type:"[[NaN]]",shouldTransform:function(e,t){return"number"===e&&isNaN(t)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(e){return"undefined"===e},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(e,t){return t instanceof Date},toSerializable:function(e){return e.getTime()},fromSerializable:function(e){var t=new Date;return t.setTime(e),t}},{type:"[[RegExp]]",shouldTransform:function(e,t){return t instanceof RegExp},toSerializable:function(e){var t={src:e.source,flags:""};return e.global&&(t.flags+="g"),e.ignoreCase&&(t.flags+="i"),e.multiline&&(t.flags+="m"),t},fromSerializable:function(e){return new RegExp(e.src,e.flags)}},{type:"[[Error]]",shouldTransform:function(e,t){return t instanceof Error},toSerializable:function(e){return{name:e.name,message:e.message,stack:e.stack}},fromSerializable:function(e){var t=new(U[e.name]||Error)(e.message);return t.stack=e.stack,t}},{type:"[[ArrayBuffer]]",shouldTransform:function(e,t){return V&&t instanceof ArrayBuffer},toSerializable:function(e){var t=new Int8Array(e);return Z.call(t)},fromSerializable:function(e){if(V){var t=new ArrayBuffer(e.length);return new Int8Array(t).set(e),t}return e}},{type:"[[TypedArray]]",shouldTransform:function(e,t){for(var r=0;r<Y.length;r++){var n=Y[r];if("function"==typeof U[n]&&t instanceof U[n])return!0}return!1},toSerializable:function(e){return{ctorName:e.constructor.name,arr:Z.call(e)}},fromSerializable:function(e){return"function"==typeof U[e.ctorName]?new U[e.ctorName](e.arr):e.arr}},{type:"[[Map]]",shouldTransform:function(e,t){return W&&t instanceof Map},toSerializable:function(e){var r=[];return e.forEach(function(e,t){r.push(t),r.push(e)}),r},fromSerializable:function(e){if(W){for(var t=new Map,r=0;r<e.length;r+=2)t.set(e[r],e[r+1]);return t}for(var n=[],o=0;o<e.length;o+=2)n.push([e[r],e[r+1]]);return n}},{type:"[[Set]]",shouldTransform:function(e,t){return X&&t instanceof Set},toSerializable:function(e){var t=[];return e.forEach(function(e){t.push(e)}),t},fromSerializable:function(e){if(X){for(var t=new Set,r=0;r<e.length;r++)t.add(e[r]);return t}return e}}],ca=P.exports=function(e){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=e||$,this.addTransforms(ba)};ca.prototype.addTransforms=function(e){e=Array.isArray(e)?e:[e];for(var t=0;t<e.length;t++){var r=e[t];if(this.transformsMap[r.type])throw new Error('Transform with type "'+r.type+'" was already added.');this.transforms.push(r),this.transformsMap[r.type]=r}return this},ca.prototype.removeTransforms=function(e){e=Array.isArray(e)?e:[e];for(var t=0;t<e.length;t++){var r=e[t],n=this.transforms.indexOf(r);-1<n&&this.transforms.splice(n,1),delete this.transformsMap[r.type]}return this},ca.prototype.encode=function(e){var t=new _(e,this.transforms).transform();return this.serializer.serialize(t)},ca.prototype.decode=function(e){var t=this.serializer.deserialize(e);return new aa(t,this.transformsMap).transform()}}},"testcafe-release":{src:{client:{driver:{"command-executors":{"browser-manipulation":{"ensure-crop-options.js":function(e,t,r){e.__esModule=!0,e.default=function(e,t){var r=e.getBoundingClientRect(),n={left:r.left,right:r.right,top:r.top,bottom:r.bottom},o=y.styleUtils.getElementMargin(e),i=y.styleUtils.getElementPadding(e),a=y.styleUtils.getBordersWidth(e);t.originOffset={x:0,y:0};var s=n.left+e.scrollWidth+a.left+a.right,l=n.top+e.scrollHeight+a.top+a.bottom;n.right=Math.max(n.right,s),n.bottom=Math.max(n.bottom,l),t.includeBorders&&t.includePaddings?t.includeMargins&&(t.originOffset.x-=o.left,t.originOffset.y-=o.top,n.left-=o.left,n.top-=o.top,n.right+=o.right,n.bottom+=o.bottom):(t.originOffset.x+=a.left,t.originOffset.y+=a.top,n.left+=a.left,n.top+=a.top,n.right-=a.right,n.bottom-=a.bottom,t.includePaddings||(t.originOffset.x+=i.left,t.originOffset.y+=i.top,n.left+=i.left,n.top+=i.top,n.right-=i.right,n.bottom-=i.bottom));n.width=n.right-n.left,n.height=n.bottom-n.top;var u=w({min:t.crop.left,max:t.crop.right,length:t.crop.width},n.width),c=w({min:t.crop.top,max:t.crop.bottom,length:t.crop.height},n.height);if(t.crop.left=u.min,t.crop.right=u.max,t.crop.width=u.length,t.crop.top=c.min,t.crop.bottom=c.max,t.crop.height=c.length,t.crop.width<=0||t.crop.height<=0)throw new S.InvalidElementScreenshotDimensionsError(t.crop.width,t.crop.height);var d=y.styleUtils.getViewportDimensions();(n.width>d.width||n.height>d.height)&&(t.scrollToCenter=!0);var f="number"==typeof t.scrollTargetX,h="number"==typeof t.scrollTargetY;f||(t.scrollTargetX=T(t.crop.left,t.crop.right,d.width));h||(t.scrollTargetY=T(t.crop.top,t.crop.bottom,d.height));var m=(0,_.getOffsetOptions)(e,t.scrollTargetX,t.scrollTargetY),p=m.offsetX,E=m.offsetY;t.scrollTargetX=p,t.scrollTargetY=E;var g=!f||t.scrollTargetX>=t.crop.left&&t.scrollTargetX<=t.crop.right,v=!h||t.scrollTargetY>=t.crop.top&&t.scrollTargetY<=t.crop.bottom;if(!g||!v)throw new S.ActionInvalidScrollTargetError(g,v)};var n,y=r("../../deps/testcafe-core"),_=r("../../deps/testcafe-automation"),o=r("../../../../utils/limit-number"),i=(n=o)&&n.__esModule?n:{default:n},S=r("../../../../errors/test-run");function w(e,t){var r="number"==typeof e.min,n="number"==typeof e.max,o="number"==typeof e.length;return o&&(e.length=(0,i.default)(e.length,0,t)),r&&e.min<0&&(e.min+=t),n&&e.max<0&&(e.max+=t),r||(e.min=n&&o?e.max-e.length:0),n||(e.max=o?e.min+e.length:t),e.min=(0,i.default)(e.min,0,t),e.max=(0,i.default)(e.max,0,t),e.length=e.max-e.min,e}function T(e,t,r){return Math.round(e+(0,i.default)(t-e,0,r)/2)}t.exports=e.default},"index.js":function(e,t,r){e.__esModule=!0,e.default=function(e,t,r){return new v(e,t,r).execute()};var i=r("../../deps/hammerhead"),a=r("../../deps/testcafe-core"),s=r("../../deps/testcafe-automation"),n=r("../../deps/testcafe-ui"),l=m(r("../../status")),u=m(r("./ensure-crop-options")),c=r("../../utils/ensure-elements"),o=m(r("../../utils/run-with-barriers")),d=m(r("../../../../test-run/client-messages")),f=m(r("../../../../test-run/commands/type")),h=r("../../../../test-run/commands/options");function m(e){return e&&e.__esModule?e:{default:e}}var p=i.eventSandbox.message,E="driver|browser-manipulation|request",g="driver|browser-manipulation|response";p.on(p.SERVICE_MSG_RECEIVED_EVENT,function(t){if(t.message.cmd===E){var e=a.domUtils.findIframeByWindow(t.source),r=t.message,n=r.command,o=r.cropDimensions;o&&(n.options=new h.ElementScreenshotOptions({crop:o,includePaddings:!1}));var i=new v(n);i.element=e,i.execute().then(function(e){return p.sendServiceMsg({cmd:g,result:e},t.source)})}});var v=(y.prototype._getAbsoluteCropValues=function(){var e=this.element.getBoundingClientRect(),t=e.top,r=e.left;r+=this.command.options.originOffset.x,t+=this.command.options.originOffset.y;var n=r+this.command.options.crop.right,o=t+this.command.options.crop.bottom;return{top:t+=this.command.options.crop.top,left:r+=this.command.options.crop.left,bottom:o,right:n}},y.prototype._createManipulationReadyMessage=function(){var e=window.devicePixelRatio||1,t={cmd:d.default.readyForBrowserManipulation,pageDimensions:{dpr:e,innerWidth:window.innerWidth,innerHeight:window.innerHeight,documentWidth:document.documentElement.clientWidth,documentHeight:document.documentElement.clientHeight,bodyWidth:document.body.clientWidth,bodyHeight:document.body.clientHeight},disableResending:!0};return this.command.type===f.default.takeElementScreenshot&&(t.cropDimensions=this._getAbsoluteCropValues()),t},y.prototype._runScrollBeforeScreenshot=function(){var o=this;return i.Promise.resolve().then(function(){if(o.element||!o.command.selector)return i.Promise.resolve();var e=o.command.selector.timeout,t="number"==typeof e?e:o.globalSelectorTimeout;return o.statusBar.showWaitingElementStatus(t),(0,c.ensureElements)([(0,c.createElementDescriptor)(o.command.selector)],o.globalSelectorTimeout).then(function(e){o.statusBar.hideWaitingElementStatus(),o.element=e[0]}).catch(function(e){throw o.statusBar.hideWaitingElementStatus(),e})}).then(function(){(0,u.default)(o.element,o.command.options);var e=o.command.options,t=e.scrollTargetX,r=e.scrollTargetY,n=e.scrollToCenter;return new s.Scroll(o.element,new h.ScrollOptions({offsetX:t,offsetY:r,scrollToCenter:n,skipParentFrames:!0})).run()})},y.prototype._hideUI=function(){return(0,n.hide)(),this.command.markData&&(0,n.showScreenshotMark)(this.command.markData),(0,a.delay)(500)},y.prototype._showUI=function(){this.command.markData&&(0,n.hideScreenshotMark)(),(0,n.show)()},y.prototype._requestManipulation=function(){if(window.top===window)return i.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var e=this._getAbsoluteCropValues();return(0,a.sendRequestToFrame)({cmd:E,command:this.command,cropDimensions:e},g,window.parent).then(function(e){if(!e.result)return{result:null};var t=e.result,r=t.result,n=t.executionError;if(n)throw n;return{result:r}})},y.prototype._runManipulation=function(){var n=this,o=null;return i.Promise.resolve().then(function(){return n.command.type!==f.default.takeElementScreenshot?i.Promise.resolve():(a.scrollController.stopPropagation(),n._runScrollBeforeScreenshot())}).then(function(){return window.top===window?n._hideUI():i.Promise.resolve()}).then(function(){return n._requestManipulation()}).then(function(e){var t=e.result,r=e.error;if(r)throw r;return a.scrollController.enablePropagation(),o=t,window.top===window&&n._showUI(),(0,a.delay)(200)}).then(function(){return new l.default({isCommandResult:!0,result:o})}).catch(function(e){return a.scrollController.enablePropagation(),new l.default({isCommandResult:!0,executionError:e})})},y.prototype.execute=function(){var e=this;return(0,o.default)(function(){return e._runManipulation()}).barriersPromise},y);function y(e,t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),this.command=e,this.globalSelectorTimeout=t,this.statusBar=r,this.element=null}t.exports=e.default}},"client-functions":{"client-function-executor.js":function(e,t,r){e.__esModule=!0;var n=r("../../deps/hammerhead"),o=l(r("../../status")),i=r("./replicator"),a=l(r("./eval-function")),s=r("../../../../errors/test-run");function l(e){return e&&e.__esModule?e:{default:e}}var u=(c.prototype.getResult=function(){var t=this;return n.Promise.resolve().then(function(){var e=t.replicator.decode(t.command.args);return t._executeFn(e)}).catch(function(e){throw e.isTestCafeError||(e=new s.UncaughtErrorInClientFunctionCode(t.command.instantiationCallsiteName,e)),e})},c.prototype.getResultDriverStatus=function(){var t=this;return this.getResult().then(function(e){return new o.default({isCommandResult:!0,result:t.replicator.encode(e)})}).catch(function(e){return new o.default({isCommandResult:!0,executionError:e})})},c.prototype._createReplicator=function(){return(0,i.createReplicator)([new i.ClientFunctionNodeTransform(this.command.instantiationCallsiteName),new i.FunctionTransform])},c.prototype._executeFn=function(e){return this.fn.apply(window,e)},c);function c(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),this.command=e,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=(0,a.default)(this.command.fnCode,this.dependencies)}e.default=u,t.exports=e.default},"eval-function.js":function(exports,module,require){exports.__esModule=!0,exports.default=evalFunction;var _hammerhead=require("../../deps/hammerhead"),_hammerhead2=_interopRequireDefault(_hammerhead);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var Promise=_hammerhead2.default.Promise;function evalFunction(fnCode,__dependencies$){"use strict";return eval(fnCode)}module.exports=exports.default},"replicator.js":function(e,t,r){e.__esModule=!0,e.ClientFunctionNodeTransform=e.SelectorNodeTransform=e.FunctionTransform=void 0,e.createReplicator=function(e){return new n.default({serialize:d,deserialize:d}).addTransforms(e)};var n=l(r("replicator")),o=l(r("./eval-function")),i=r("./selector-executor/node-snapshots"),a=r("../../../../errors/test-run"),s=l(r("../../deps/hammerhead"));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var c=window.Node,d=function(e){return e};e.FunctionTransform=(f.prototype.shouldTransform=function(e){return"function"===e},f.prototype.toSerializable=function(){return""},f.prototype.fromSerializable=function(e){var t=e.fnCode,r=e.dependencies;return(0,o.default)(t,r)},f);function f(){u(this,f),this.type="Function"}e.SelectorNodeTransform=(h.prototype._extend=function(e,r){var n=this;s.default.nativeMethods.objectKeys.call(window.Object,this.customDOMProperties).forEach(function(t){try{e[t]=n.customDOMProperties[t](r)}catch(e){throw new a.UncaughtErrorInCustomDOMPropertyCode(n.instantiationCallsiteName,e,t)}})},h.prototype.shouldTransform=function(e,t){return t instanceof c},h.prototype.toSerializable=function(e){var t=1===e.nodeType?new i.ElementSnapshot(e):new i.NodeSnapshot(e);return this._extend(t,e),t},h);function h(e){u(this,h),this.type="Node",this.customDOMProperties=e||{}}e.ClientFunctionNodeTransform=(m.prototype.shouldTransform=function(e,t){if(t instanceof c)throw new a.DomNodeClientFunctionResultError(this.instantiationCallsiteName)},m);function m(e){u(this,m),this.type="Node",this.instantiationCallsiteName=e}},"selector-executor":{"filter.js":function(e,t,r){var n,o=function(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e};function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=r("../../../../../errors/test-run"),s=r("../../../utils/element-utils"),l=c(r("../../../deps/testcafe-core")),u=c(r("../../../deps/hammerhead"));function c(e){return e&&e.__esModule?e:{default:e}}var d=l.default.arrayUtils,f=u.default.utils.types,h=u.default.nativeMethods,m=1,p=2,E=3,g=((n={})[m]=/^\.filterVisible\(\)$/,n[p]=/^\.filterHidden\(\)$/,n[E]=/^\.nth\(\d+\)$/,n),v=(y.prototype.filter=function(e,t,r){var n=d.filter(e,s.exists);if(t.filterVisible&&(n=n.filter(s.visible),this.assertFilterError(n,r,m)),t.filterHidden&&(n=n.filter(function(e){return!(0,s.visible)(e)}),this.assertFilterError(n,r,p)),t.counterMode)n=null!==t.index?this.getNodeByIndex(n,t.index)?1:0:n.length;else{if(t.collectionMode){if(null!==t.index){var o=this.getNodeByIndex(n,t.index);n=o?[o]:[]}}else n=this.getNodeByIndex(n,t.index||0);"number"==typeof t.index&&this.assertFilterError(n,r,E)}return n},y.prototype.cast=function(e){var t=null;if(f.isNullOrUndefined(e))t=[];else if(e instanceof Node)t=[e];else{if(!(0,s.IsNodeCollection)(e))throw new a.InvalidSelectorResultError;t=e}return t},y.prototype.assertFilterError=function(e,t,r){e&&0!==e.length||(this.error=this.getErrorItem(t,r))},y.prototype.getErrorItem=function(e,t){var r=e.apiFnChain,n=e.apiFnID;if(t)for(var o=n;o<r.length;o++)if(g[t].test(r[o]))return o;return null},y.prototype.getNodeByIndex=function(e,t){return t<0?e[e.length+t]:e[t]},o(y,[{key:"error",get:function(){return this.err},set:function(e){null===this.err&&(this.err=e)}}]),y);function y(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),this.err=null}h.objectDefineProperty.call(window,window,"%testCafeSelectorFilter%",{value:new v,configurable:!0})},"index.js":function(e,t,r){e.__esModule=!0;var n,o=r("../../../deps/hammerhead"),l=r("../../../deps/testcafe-core"),i=r("../client-function-executor"),a=(n=i)&&n.__esModule?n:{default:n},u=r("../../../utils/element-utils"),c=r("../replicator");r("./filter");var d,s=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(f,d=a.default),f.prototype._createReplicator=function(){return(0,c.createReplicator)([new c.FunctionTransform])},f.prototype._getTimeoutErrorParams=function(){var e=window["%testCafeSelectorFilter%"].error,t=this.command.apiFnChain;return void 0!==e?{apiFnIndex:e,apiFnChain:t}:null},f.prototype._validateElement=function(i,a){var s=this;return o.Promise.resolve().then(function(){return s.fn.apply(window,i)}).then(function(e){var t=(0,u.exists)(e),r=!s.command.visibilityCheck||(0,u.visible)(e),n=t?s.createIsInvisibleError:s.createNotFoundError,o=new Date-a>=s.timeout;if(t&&r)return e;if(!o)return(0,l.delay)(200).then(function(){return s._validateElement(i,a)});if(n)throw n(s._getTimeoutErrorParams());return null})},f.prototype._executeFn=function(e){if(this.counterMode)return d.prototype._executeFn.call(this,e);var t=new Date,r=null,n=null;return this._validateElement(e,t).catch(function(e){r=e}).then(function(e){if(r)throw r;n=e}).then(function(){return n})},f);function f(e,t,r,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,d.call(this,e));if(i.createNotFoundError=n,i.createIsInvisibleError=o,i.timeout="number"==typeof e.timeout?e.timeout:t,i.counterMode=i.dependencies.filterOptions.counterMode,r){var a=new Date-r;i.timeout=Math.max(i.timeout-a,0)}var s=i.dependencies&&i.dependencies.customDOMProperties;return i.replicator.addTransforms([new c.SelectorNodeTransform(s)]),i}e.default=s,t.exports=e.default},"node-snapshots.js":function(e,t,r){e.__esModule=!0,e.ElementSnapshot=e.NodeSnapshot=void 0;var n=r("../../../deps/testcafe-core"),o=r("../../../../../client-functions/selectors/snapshot-properties");function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a={textContent:function(e){return e.textContent},childNodeCount:function(e){return e.childNodes.length},hasChildNodes:function(e){return!!a.childNodeCount(e)},childElementCount:function(e){var t=e.children;if(t)return t.length;for(var r=0,n=e.childNodes.length,o=0;o<n;o++)1===e.childNodes[o].nodeType&&r++;return r},hasChildElements:function(e){return!!a.childElementCount(e)}},s=e.NodeSnapshot=(l.prototype._initializeProperties=function(e,t,r){for(var n=0;n<t.length;n++){var o=t[n],i=r[o];this[o]=i?i(e):e[o]}},l);function l(e){i(this,l),this._initializeProperties(e,o.NODE_SNAPSHOT_PROPERTIES,a)}var u,c={tagName:function(e){return e.tagName.toLowerCase()},visible:n.positionUtils.isElementVisible,focused:function(e){return n.domUtils.getActiveElement()===e},attributes:function(e){for(var t=e.attributes,r={},n=t.length-1;0<=n;n--)r[t[n].name]=t[n].value;return r},boundingClientRect:function(e){var t=e.getBoundingClientRect();return{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width,height:t.height}},classNames:function(e){var t=e.className;return(t="string"==typeof t.animVal?t.animVal:t).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(e){for(var t={},r=window.getComputedStyle(e),n=0;n<r.length;n++){var o=r[n];t[o]=r[o]}return t},innerText:function(e){return e.innerText}};e.ElementSnapshot=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(d,u=s),d);function d(e){i(this,d);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,u.call(this,e));return t._initializeProperties(e,o.ELEMENT_SNAPSHOT_PROPERTIES,c),t}}}},"execute-action.js":function(e,t,r){e.__esModule=!0,e.default=function(e,t,r,n){return new h(e,t,r,n).execute()};var i=r("../deps/hammerhead"),n=r("../deps/testcafe-core"),a=r("../deps/testcafe-automation"),s=d(r("../status")),l=d(r("../utils/run-with-barriers")),o=r("../utils/ensure-elements"),u=r("../../../errors/test-run"),c=d(r("../../../test-run/commands/type"));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!n.domUtils.isContentEditableElement(e))throw new u.ActionElementNonContentEditableError(t)}var h=(m.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},m.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?(0,n.delay)(2e3*(1-this.command.options.speed)):i.Promise.resolve()},m.prototype._isExecutionTimeoutExpired=function(){return Date.now()-this.executionStartTime>=this.commandSelectorTimeout},m.prototype._ensureCommandArguments=function(){if(this.command.type===c.default.pressKey&&(0,n.parseKeySequence)(this.command.keys).error)throw new u.ActionIncorrectKeysError("keys")},m.prototype._ensureCommandElements=function(){var t=this,e=[];return this.command.selector&&e.push((0,o.createElementDescriptor)(this.command.selector)),this.command.type===c.default.dragToElement?e.push((0,o.createAdditionalElementDescriptor)(this.command.destinationSelector,"destinationSelector")):this.command.type===c.default.selectEditableContent&&(e.push((0,o.createAdditionalElementDescriptor)(this.command.startSelector,"startSelector")),e.push((0,o.createAdditionalElementDescriptor)(this.command.endSelector||this.command.startSelector,"endSelector"))),(0,o.ensureElements)(e,this.globalSelectorTimeout).then(function(e){t.elements=e})},m.prototype._ensureCommandElementsProperties=function(){this.command.type===c.default.selectText?function(e){if(!n.domUtils.isEditableElement(e))throw new u.ActionElementNonEditableError}(this.elements[0]):this.command.type===c.default.selectTextAreaContent?function(e){if(!n.domUtils.isTextAreaElement(e))throw new u.ActionElementNotTextAreaError}(this.elements[0]):this.command.type===c.default.selectEditableContent?(f(this.elements[0],"startSelector"),f(this.elements[1],"endSelector"),function(e){if(!n.contentEditable.getNearestCommonAncestor(e[0],e[1]))throw new u.ActionRootContainerNotFoundError}(this.elements)):this.command.type!==c.default.setFilesToUpload&&this.command.type!==c.default.clearUpload||function(e){if(!n.domUtils.isFileInput(e))throw new u.ActionElementIsNotFileInputError}(this.elements[0])},m.prototype._ensureCommandOptions=function(){this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&function(e,t){var r=(0,a.getOffsetOptions)(e,t.offsetX,t.offsetY),n=r.offsetX,o=r.offsetY;t.offsetX=n,t.offsetY=o}(this.elements[0],this.command.options)},m.prototype._createAutomation=function(){var e=null;switch(this.command.type){case c.default.click:return/option|optgroup/.test(n.domUtils.getTagName(this.elements[0]))?new a.SelectChildClick(this.elements[0],this.command.options):new a.Click(this.elements[0],this.command.options);case c.default.rightClick:return new a.RClick(this.elements[0],this.command.options);case c.default.doubleClick:return new a.DblClick(this.elements[0],this.command.options);case c.default.hover:return new a.Hover(this.elements[0],this.command.options);case c.default.drag:return new a.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case c.default.dragToElement:return new a.DragToElement(this.elements[0],this.elements[1],this.command.options);case c.default.typeText:return new a.Type(this.elements[0],this.command.text,this.command.options);case c.default.selectText:case c.default.selectTextAreaContent:return e=(0,a.calculateSelectTextArguments)(this.elements[0],this.command),new a.SelectText(this.elements[0],e.startPos,e.endPos,this.command.options);case c.default.selectEditableContent:return new a.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case c.default.pressKey:return new a.Press((0,n.parseKeySequence)(this.command.keys).combinations,this.command.options);case c.default.setFilesToUpload:return new a.Upload(this.elements[0],this.command.filePath,function(e){return new u.ActionCannotFindFileToUploadError(e)});case c.default.clearUpload:return new a.Upload(this.elements[0])}return null},m.prototype._runAction=function(t){var r=this;return this._ensureCommandElements().then(function(){return r._ensureCommandElementsProperties()}).then(function(){r._ensureCommandOptions();var e=r._createAutomation();return e.TARGET_ELEMENT_FOUND_EVENT?e.on(e.TARGET_ELEMENT_FOUND_EVENT,function(){r.statusBar.hideWaitingElementStatus(!0),r.executionStartedHandler()}):(r.statusBar.hideWaitingElementStatus(!0),r.executionStartedHandler()),e.run(t)})},m.prototype._runRecursively=function(){var t=this,e=!1,r=!0;return n.promiseUtils.whilst(function(){return!e},function(){return t._runAction(r).then(function(){e=!0}).catch(function(e){if(t._isExecutionTimeoutExpired()){if(e.message===a.ERROR_TYPES.foundElementIsNotTarget)return r=!1,i.Promise.resolve();throw e.message===a.ERROR_TYPES.elementIsInvisibleError?new u.ActionElementIsInvisibleError:e}return(0,n.delay)(250)})})},m.prototype.execute=function(){var o=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new i.Promise(function(e){o.executionStartedHandler=e}),completionPromise:new i.Promise(function(t){o.executionStartTime=new Date;try{o._ensureCommandArguments()}catch(e){return void t(new s.default({isCommandResult:!0,executionError:e}))}o.commandSelectorTimeout=o._getSpecificTimeout(),o.statusBar.showWaitingElementStatus(o.commandSelectorTimeout);var e=(0,l.default)(function(){return o._runRecursively()}),r=e.actionPromise,n=e.barriersPromise;r.then(function(){return i.Promise.all([o._delayAfterExecution(),n])}).then(function(){return t(new s.default({isCommandResult:!0}))}).catch(function(e){return o.statusBar.hideWaitingElementStatus(!1).then(function(){return t(new s.default({isCommandResult:!0,executionError:e}))})})})}},m);function m(e,t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,m),this.command=e,this.globalSelectorTimeout=t,this.statusBar=r,this.testSpeed=n,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}t.exports=e.default},"execute-navigate-to.js":function(e,t,r){e.__esModule=!0,e.default=function(t){var e=l.url.getNavigationUrl(t.url,window),r=n.default.Promise.resolve();e&&o.browser.isRetryingTestPagesEnabled()&&(r=o.browser.fetchPageToCache(e,s));return r.then(function(){var e=new o.RequestBarrier;return n.default.navigateTo(t.url,t.forceReload),n.default.Promise.all([e.wait(),o.pageUnloadBarrier.wait()])}).then(function(){return new i.default({isCommandResult:!0})}).catch(function(e){return new i.default({isCommandResult:!0,executionError:e})})};var n=a(r("../deps/hammerhead")),o=r("../deps/testcafe-core"),i=a(r("../status"));function a(e){return e&&e.__esModule?e:{default:e}}var s=n.default.createNativeXHR,l=n.default.utils;t.exports=e.default},"execute-selector.js":function(e,t,r){e.__esModule=!0,e.getResult=function(e,t,r,n,o,i){var a=new s.default(e,t,r,n,o);return i.showWaitingElementStatus(a.timeout),a.getResult().then(function(e){return i.hideWaitingElementStatus(!!e).then(function(){return e})}).catch(function(e){return i.hideWaitingElementStatus(!1).then(function(){throw e})})},e.getResultDriverStatus=function(e,t,r,n,o,i){var a=new s.default(e,t,r,n,o);return i.showWaitingElementStatus(a.timeout),a.getResultDriverStatus().then(function(e){return i.hideWaitingElementStatus(!!e.result).then(function(){return e})})};var n,o=r("./client-functions/selector-executor"),s=(n=o)&&n.__esModule?n:{default:n}}},deps:{"hammerhead.js":function(e,t,r){e.__esModule=!0,e.default=window["%hammerhead%"],t.exports=e.default},"testcafe-automation.js":function(e,t,r){e.__esModule=!0,e.default=window["%testCafeAutomation%"],t.exports=e.default},"testcafe-core.js":function(e,t,r){e.__esModule=!0,e.default=window["%testCafeCore%"],t.exports=e.default},"testcafe-ui.js":function(e,t,r){e.__esModule=!0,e.default=window["%testCafeUI%"],t.exports=e.default}},"driver-link":{"child.js":function(e,t,r){e.__esModule=!0;var n=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e};function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=r("../deps/hammerhead"),a=r("../deps/testcafe-core"),s=r("../../../errors/test-run"),l=d(r("./send-message-to-driver")),u=r("./messages"),c=d(r("../status"));function d(e){return e&&e.__esModule?e:{default:e}}var f=(h.prototype._ensureIframe=function(){var e=this;return a.domUtils.isElementInDocument(this.driverIframe)?(0,a.waitFor)(function(){return a.positionUtils.isElementVisible(e.driverIframe)?e.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new s.CurrentIframeIsInvisibleError}):i.Promise.reject(new s.CurrentIframeNotFoundError)},h.prototype._waitForIframeRemovedOrHidden=function(){var t=this;return new i.Promise(function(e){t.checkIframeInterval=i.nativeMethods.setInterval.call(window,function(){t._ensureIframe().catch(function(){return(0,a.delay)(500).then(function(){return e(new c.default({isCommandResult:!0}))})})},1e3)})},h.prototype._waitForCommandResult=function(){var t=this,r=null;return i.Promise.race([this._waitForIframeRemovedOrHidden(),new i.Promise(function(t){r=function(e){e.message.type===u.TYPE.commandExecuted&&t(e.message.driverStatus)},i.eventSandbox.message.on(i.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,r)})]).then(function(e){return i.eventSandbox.message.off(i.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,r),i.nativeMethods.clearInterval.call(window,t.checkIframeInterval),e})},h.prototype.confirmConnectionEstablished=function(e){var t=new u.ConfirmationMessage(e,{id:this.driverId});i.eventSandbox.message.sendServiceMsg(t,this.driverWindow)},h.prototype.executeCommand=function(t,r){var n=this;return this._ensureIframe().then(function(){var e=new u.ExecuteCommandMessage(t,r);return i.Promise.all([(0,l.default)(e,n.driverWindow,n.iframeAvailabilityTimeout,s.CurrentIframeIsNotLoadedError),n._waitForCommandResult()])}).then(function(e){return e[1]})},n(h,[{key:"availabilityTimeout",set:function(e){this.iframeAvailabilityTimeout=e}}]),h);function h(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),this.driverWindow=e,this.driverIframe=a.domUtils.findIframeByWindow(e),this.driverId=t,this.iframeAvailabilityTimeout=0}e.default=f,t.exports=e.default},"messages.js":function(e,t,r){e.__esModule=!0,e.SetNativeDialogHandlerMessage=e.ConfirmationMessage=e.ExecuteCommandMessage=e.CommandExecutedMessage=e.EstablishConnectionMessage=e.TYPE=void 0;var n,o=r("../generate-id"),i=(n=o)&&n.__esModule?n:{default:n};function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e){l(this,u),this.type=e,this.id=(0,i.default)()}var c,d=e.TYPE={establishConnection:"driver|establish-connection",commandExecuted:"driver|command-executed",executeCommand:"driver|execute-command",confirmation:"driver|confirmation",setNativeDialogHandler:"driver|set-native-dialog-handler"};e.EstablishConnectionMessage=(s(f,c=u),f);function f(){return l(this,f),a(this,c.call(this,d.establishConnection))}var h;e.CommandExecutedMessage=(s(m,h=u),m);function m(e){l(this,m);var t=a(this,h.call(this,d.commandExecuted));return t.driverStatus=e,t}var p;e.ExecuteCommandMessage=(s(E,p=u),E);function E(e,t){l(this,E);var r=a(this,p.call(this,d.executeCommand));return r.command=e,r.testSpeed=t,r}var g;e.ConfirmationMessage=(s(v,g=u),v);function v(e,t){l(this,v);var r=a(this,g.call(this,d.confirmation));return r.requestMessageId=e,r.result=t,r}var y;e.SetNativeDialogHandlerMessage=(s(_,y=u),_);function _(e){l(this,_);var t=a(this,y.call(this,d.setNativeDialogHandler));return t.dialogHandler=e,t}},"parent.js":function(e,t,r){e.__esModule=!0;var n,o=r("../deps/hammerhead"),i=r("./messages"),a=r("../../../errors/test-run"),s=r("./send-message-to-driver"),l=(n=s)&&n.__esModule?n:{default:n};var u=(c.prototype.establishConnection=function(){var e=new i.EstablishConnectionMessage;return(0,l.default)(e,this.driverWindow,5e3,a.CurrentIframeIsNotLoadedError).then(function(e){return e.result.id})},c.prototype.confirmMessageReceived=function(e){var t=new i.ConfirmationMessage(e);o.eventSandbox.message.sendServiceMsg(t,this.driverWindow)},c.prototype.onCommandExecuted=function(e){var t=new i.CommandExecutedMessage(e);o.eventSandbox.message.sendServiceMsg(t,this.driverWindow)},c);function c(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),this.driverWindow=e}e.default=u,t.exports=e.default},"send-message-to-driver.js":function(e,t,r){e.__esModule=!0,e.default=function(r,e,t,n){var o=null,i=null;t=Math.max(t||0,u);return a.Promise.race([(0,s.delay)(t),new a.Promise(function(t){i=function(e){e.message.type===l.TYPE.confirmation&&e.message.requestMessageId===r.id&&t(e.message)},a.eventSandbox.message.on(a.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,i),o=a.nativeMethods.setInterval.call(window,function(){return a.eventSandbox.message.sendServiceMsg(r,e)},c),a.eventSandbox.message.sendServiceMsg(r,e)})]).then(function(e){if(a.nativeMethods.clearInterval.call(window,o),a.nativeMethods.clearTimeout.call(window,null),a.eventSandbox.message.off(a.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,i),!e)throw new n;return e})};var a=r("../deps/hammerhead"),s=r("../deps/testcafe-core"),l=r("./messages"),u=2500,c=1e3;t.exports=e.default}},"driver.js":function(e,t,r){e.__esModule=!0;var n=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e};function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=R(r("./deps/hammerhead")),a=r("./deps/testcafe-core"),s=r("./deps/testcafe-ui"),l=R(r("../../test-run/client-messages")),u=R(r("../../test-run/commands/type")),c=r("../../test-run/commands/utils"),d=r("../../errors/test-run"),f=R(r("../../test-run/browser-console-messages")),h=R(r("./native-dialog-tracker")),m=r("./driver-link/messages"),p=R(r("./storage")),E=R(r("./status")),g=R(r("./generate-id")),v=R(r("./driver-link/child")),y=R(r("./command-executors/execute-action")),_=R(r("./command-executors/browser-manipulation")),S=R(r("./command-executors/execute-navigate-to")),w=r("./command-executors/execute-selector"),T=R(r("./command-executors/client-functions/client-function-executor"));function R(e){return e&&e.__esModule?e:{default:e}}var C=i.default.transport,b=i.default.Promise,I=i.default.eventSandbox.message,x=i.default.storages,N=i.default.nativeMethods,A=N.date,O="testcafe|driver|test-done-sent-flag",M="testcafe|driver|pending-status",P="testcafe|driver|executing-client-function-descriptor",D="testcafe|driver|selector-execution-start-time",U="testcafe|driver|pending-page-error",F="testcafe|driver|active-iframe-selector",k="testcafe|driver|test-speed",j="testcafe|driver|assertion-retries-timeout",H="testcafe|driver|assertion-retries-start-time",B="testcafe|driver|console-messages",L={NotLoadedError:d.ActionIframeIsNotLoadedError,NotFoundError:d.ActionElementNotFoundError,IsInvisibleError:d.ActionElementIsInvisibleError},W={NotLoadedError:d.CurrentIframeIsNotLoadedError,NotFoundError:d.CurrentIframeNotFoundError,IsInvisibleError:d.CurrentIframeIsInvisibleError},V=(G.prototype._onJsError=function(e){if(this.skipJsErrors||this.contextStorage.getItem(O))return b.resolve();var t=new d.UncaughtErrorOnPage(e.stack,e.pageUrl);return this.contextStorage.getItem(U)||this.contextStorage.setItem(U,t),null},G.prototype._unlockPageAfterTestIsDone=function(){return(0,a.disableRealEventsPreventing)(),b.resolve()},G.prototype._failIfClientCodeExecutionIsInterrupted=function(){var e=this.contextStorage.getItem(P);return!!e&&(this._onReady(new E.default({isCommandResult:!0,executionError:new d.ClientFunctionExecutionInterruptionError(e.instantiationCallsiteName)})),!0)},G.prototype._onConsoleMessage=function(e){var t=e.meth,r=e.line,n=this.consoleMessages;n.addMessage(t,r),this.consoleMessages=n},G.prototype._addPendingErrorToStatus=function(e){var t=this.contextStorage.getItem(U);t&&(this.contextStorage.setItem(U,null),e.pageError=t)},G.prototype._addUnexpectedDialogErrorToStatus=function(e){var t=this.nativeDialogsTracker.getUnexpectedDialogError();e.pageError=e.pageError||t},G.prototype._addConsoleMessagesToStatus=function(e){e.consoleMessages=this.consoleMessages,this.consoleMessages=null},G.prototype._sendStatusRequest=function(e){function t(){return(0,a.getTimeLimitedPromise)(C.asyncServiceMsg(n),5e3)}function r(){return(0,a.delay)(300).then(t)}for(var n={cmd:l.default.ready,status:e,disableResending:!0,allowRejecting:!0},o=t(),i=0;i<5;i++)o=o.catch(r);return o},G.prototype._sendStatus=function(e){var t=this;e.resent||(this._addPendingErrorToStatus(e),this._addUnexpectedDialogErrorToStatus(e),this._addConsoleMessagesToStatus(e)),this.contextStorage.setItem(M,e);var r=null;return a.pageUnloadBarrier.wait(0).then(function(){return t._sendStatusRequest(e)}).then(function(e){return r=e,a.pageUnloadBarrier.wait(0)}).then(function(){return t.contextStorage.setItem(M,null),r})},G.prototype._initChildDriverListening=function(){var i=this;I.on(I.SERVICE_MSG_RECEIVED_EVENT,function(e){var t=e.message,r=e.source;if(t.type===m.TYPE.establishConnection){var n=i._getChildDriverLinkByWindow(r);if(!n){var o=i.testRunId+"-"+(0,g.default)();n=new v.default(r,o),i.childDriverLinks.push(n)}n.confirmConnectionEstablished(t.id)}})},G.prototype._getChildDriverLinkByWindow=function(t){return this.childDriverLinks.filter(function(e){return e.driverWindow===t})[0]},G.prototype._runInActiveIframe=function(e){var t=this,r=b.resolve(),n=this.contextStorage.getItem(F);!this.activeChildDriverLink&&n&&(r=this._switchToIframe(n,W)),r.then(function(){return t.contextStorage.setItem(t.EXECUTING_IN_IFRAME_FLAG,!0),t.activeChildDriverLink.executeCommand(e,t.speed)}).then(function(e){return t._onCommandExecutedInIframe(e)}).catch(function(e){return t._onCommandExecutedInIframe(new E.default({isCommandResult:!0,executionError:e}))})},G.prototype._onCommandExecutedInIframe=function(e){this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this._onReady(e)},G.prototype._ensureChildDriverLink=function(e,t,r){var n=this;return(0,a.waitFor)(function(){return n._getChildDriverLinkByWindow(e)},500,r).catch(function(){throw new t})},G.prototype._switchToIframe=function(t,r){var n=this,o="number"==typeof t.timeout?t.timeout:this.selectorTimeout;return(0,w.getResult)(t,o,null,function(e){return new r.NotFoundError(e)},function(){return new r.IsInvisibleError},this.statusBar).then(function(e){if(!a.domUtils.isIframeElement(e))throw new d.ActionElementNotIframeError;return n._ensureChildDriverLink(N.contentWindowGetter.call(e),r.NotLoadedError,o)}).then(function(e){e.availabilityTimeout=o,n.activeChildDriverLink=e,n.contextStorage.setItem(F,t)})},G.prototype._switchToMainWindow=function(e){this.activeChildDriverLink&&this.activeChildDriverLink.executeCommand(e),this.contextStorage.setItem(F,null),this.activeChildDriverLink=null},G.prototype._setNativeDialogHandlerInIframes=function(e){for(var t=new m.SetNativeDialogHandlerMessage(e),r=0;r<this.childDriverLinks.length;r++)I.sendServiceMsg(t,this.childDriverLinks[r].driverWindow)},G.prototype._onActionCommand=function(e){var t=this,r=(0,y.default)(e,this.selectorTimeout,this.statusBar,this.speed),n=r.startPromise,o=r.completionPromise;n.then(function(){return t.contextStorage.setItem(t.COMMAND_EXECUTING_FLAG,!0)}),o.then(function(e){return t.contextStorage.setItem(t.COMMAND_EXECUTING_FLAG,!1),t._onReady(e)})},G.prototype._onSetNativeDialogHandlerCommand=function(e){this.nativeDialogsTracker.setHandler(e.dialogHandler),this._setNativeDialogHandlerInIframes(e.dialogHandler),this._onReady(new E.default({isCommandResult:!0}))},G.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new E.default({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},G.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new E.default({isCommandResult:!0}))},G.prototype._onNavigateToCommand=function(e){var t=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),(0,S.default)(e).then(function(e){return t.contextStorage.setItem(t.COMMAND_EXECUTING_FLAG,!1),t._onReady(e)})},G.prototype._onExecuteClientFunctionCommand=function(e){var t=this;this.contextStorage.setItem(P,{instantiationCallsiteName:e.instantiationCallsiteName}),new T.default(e).getResultDriverStatus().then(function(e){t.contextStorage.setItem(P,null),t._onReady(e)})},G.prototype._onExecuteSelectorCommand=function(e){var t=this,r=this.contextStorage.getItem(D)||new A,n=e.needError?function(e){return new d.CannotObtainInfoForElementSpecifiedBySelectorError(null,e)}:null;(0,w.getResultDriverStatus)(e,this.selectorTimeout,r,n,n,this.statusBar).then(function(e){t.contextStorage.setItem(D,null),t._onReady(e)})},G.prototype._onSwitchToMainWindowCommand=function(e){this._switchToMainWindow(e),this._onReady(new E.default({isCommandResult:!0}))},G.prototype._onSwitchToIframeCommand=function(e){var t=this;this._switchToIframe(e.selector,L).then(function(){return t._onReady(new E.default({isCommandResult:!0}))}).catch(function(e){return t._onReady(new E.default({isCommandResult:!0,executionError:e}))})},G.prototype._onBrowserManipulationCommand=function(e){var t=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),(0,_.default)(e,this.selectorTimeout,this.statusBar).then(function(e){return t.contextStorage.setItem(t.COMMAND_EXECUTING_FLAG,!1),t._onReady(e)})},G.prototype._onSetBreakpointCommand=function(e){var t=this;this.statusBar.showDebuggingStatus(e).then(function(e){return t._onReady(new E.default({isCommandResult:!0,result:e}))})},G.prototype._onSetTestSpeedCommand=function(e){this.speed=e.speed,this._onReady(new E.default({isCommandResult:!0}))},G.prototype._onShowAssertionRetriesStatusCommand=function(e){this.contextStorage.setItem(j,e.timeout),this.contextStorage.setItem(H,Date.now()),this.statusBar.showWaitingAssertionRetriesStatus(e.timeout),this._onReady(new E.default({isCommandResult:!0}))},G.prototype._onHideAssertionRetriesStatusCommand=function(e){var t=this;this.contextStorage.setItem(j,null),this.contextStorage.setItem(H,null),this.statusBar.hideWaitingAssertionRetriesStatus(e.success).then(function(){return t._onReady(new E.default({isCommandResult:!0}))})},G.prototype._checkStatus=function(){var n=this;return a.browser.checkStatus(this.browserStatusDoneUrl,i.default.createNativeXHR,{manualRedirect:!0}).then(function(e){var t=e.command,r=e.redirecting;r&&t.url.indexOf(n.testRunId)<0?(x.clear(),x.lock()):n.contextStorage.setItem(O,!1),r?a.browser.redirect(t):n._onReady({isCommandResult:!1})}).catch(function(){return(0,a.delay)(1e3)})},G.prototype._onCustomCommand=function(e){var t=this;(0,this.customCommandHandlers[e.type].handler)(e).then(function(e){t._onReady(new E.default({isCommandResult:!0,result:e}))})},G.prototype._onTestDone=function(e){var t=this;this.contextStorage.setItem(O,!0),this._sendStatus(e).then(function(){return t._checkStatus()})},G.prototype._onBackupStoragesCommand=function(){this._onReady(new E.default({isCommandResult:!0,result:x.backup()}))},G.prototype._onReady=function(e){var t=this;this._sendStatus(e).then(function(e){e?t._onCommand(e):t.