testcafe 1.13.0 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -10
- package/LICENSE +21 -21
- package/README.md +52 -48
- package/bin/testcafe-with-v8-flag-filter.js +0 -0
- package/lib/api/exportable-lib/index.js +50 -50
- package/lib/api/request-hooks/assert-type.js +7 -7
- package/lib/api/request-hooks/hook-method-names.js +11 -0
- package/lib/api/request-hooks/hook.js +33 -39
- package/lib/api/request-hooks/interfaces.js +3 -3
- package/lib/api/request-hooks/request-logger.js +113 -111
- package/lib/api/request-hooks/request-mock/create-request-mock.js +12 -0
- package/lib/api/request-hooks/request-mock/index.js +46 -0
- package/lib/api/request-hooks/request-mock.js +47 -48
- package/lib/api/structure/base-unit.js +11 -11
- package/lib/api/structure/fixture.js +75 -75
- package/lib/api/structure/interfaces.js +2 -2
- package/lib/api/structure/test-file.js +31 -31
- package/lib/api/structure/test-timeout.js +9 -9
- package/lib/api/structure/test.js +85 -85
- package/lib/api/structure/testing-unit.js +89 -89
- package/lib/api/structure/unit-type.js +9 -9
- package/lib/api/test-controller/assertion.js +88 -88
- package/lib/api/test-controller/execution-context.js +82 -82
- package/lib/api/test-controller/index.js +359 -319
- package/lib/api/test-controller/proxy.js +28 -28
- package/lib/api/test-page-url.js +60 -60
- package/lib/api/test-run-tracker.js +68 -68
- package/lib/api/wrap-test-function.js +49 -49
- package/lib/assertions/executor.js +74 -74
- package/lib/assertions/get-fn.js +46 -46
- package/lib/assertions/type.js +20 -20
- package/lib/assets/content-types.js +9 -9
- package/lib/assets/injectables.js +18 -18
- package/lib/browser/connection/command.js +10 -10
- package/lib/browser/connection/error-hints.js +9 -9
- package/lib/browser/connection/gateway.js +159 -159
- package/lib/browser/connection/get-hints.js +33 -33
- package/lib/browser/connection/heartbeat-status.js +8 -8
- package/lib/browser/connection/index.js +328 -328
- package/lib/browser/connection/remotes-queue.js +46 -46
- package/lib/browser/connection/service-routes.js +12 -12
- package/lib/browser/connection/status.js +12 -12
- package/lib/browser/interfaces.js +2 -2
- package/lib/browser/provider/built-in/dedicated/base.js +80 -80
- package/lib/browser/provider/built-in/dedicated/chrome/browser-client.js +204 -204
- package/lib/browser/provider/built-in/dedicated/chrome/build-chrome-args.js +17 -17
- package/lib/browser/provider/built-in/dedicated/chrome/config.js +110 -110
- package/lib/browser/provider/built-in/dedicated/chrome/create-temp-profile.js +45 -45
- package/lib/browser/provider/built-in/dedicated/chrome/elapsed-upperbounds.js +15 -15
- package/lib/browser/provider/built-in/dedicated/chrome/index.js +102 -102
- package/lib/browser/provider/built-in/dedicated/chrome/interfaces.js +2 -2
- package/lib/browser/provider/built-in/dedicated/chrome/local-chrome.js +24 -24
- package/lib/browser/provider/built-in/dedicated/chrome/runtime-info.js +29 -29
- package/lib/browser/provider/built-in/dedicated/edge/index.js +10 -10
- package/lib/browser/provider/built-in/dedicated/edge/runtime-info.js +29 -29
- package/lib/browser/provider/built-in/dedicated/firefox/config.js +33 -33
- package/lib/browser/provider/built-in/dedicated/firefox/create-temp-profile.js +78 -78
- package/lib/browser/provider/built-in/dedicated/firefox/index.js +73 -73
- package/lib/browser/provider/built-in/dedicated/firefox/local-firefox.js +36 -36
- package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/commands.js +13 -13
- package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/index.js +200 -200
- package/lib/browser/provider/built-in/dedicated/firefox/runtime-info.js +17 -17
- package/lib/browser/provider/built-in/index.js +21 -21
- package/lib/browser/provider/built-in/locally-installed.js +30 -30
- package/lib/browser/provider/built-in/path.js +47 -47
- package/lib/browser/provider/built-in/remote.js +58 -58
- package/lib/browser/provider/index.js +303 -303
- package/lib/browser/provider/parse-provider-name.js +16 -16
- package/lib/browser/provider/plugin-host.js +121 -121
- package/lib/browser/provider/pool.js +115 -115
- package/lib/browser/provider/utils/argument-parsing.js +74 -74
- package/lib/browser/provider/utils/browser-starter.js +34 -34
- package/lib/browser/provider/utils/client-functions.js +24 -24
- package/lib/browser/provider/utils/get-maximized-headless-window-size.js +9 -9
- package/lib/cli/argument-parser.js +284 -279
- package/lib/cli/authentication-helper.js +35 -35
- package/lib/cli/cli.js +134 -134
- package/lib/cli/correct-browsers-and-sources.js +40 -40
- package/lib/cli/index.js +19 -19
- package/lib/cli/log.js +43 -43
- package/lib/cli/remotes-wizard.js +36 -36
- package/lib/cli/termination-handler.js +38 -38
- package/lib/client/automation/index.js +144 -46
- package/lib/client/automation/index.min.js +1 -1
- package/lib/client/browser/idle-page/index.html.mustache +35 -35
- package/lib/client/browser/idle-page/logo.svg +86 -86
- package/lib/client/browser/service-worker.js +4 -6
- package/lib/client/core/index.js +19 -13
- package/lib/client/core/index.min.js +1 -1
- package/lib/client/driver/index.js +1807 -451
- package/lib/client/driver/index.min.js +1 -1
- package/lib/client/driver/internal-properties.js +9 -9
- package/lib/client/test-run/iframe.js.mustache +17 -17
- package/lib/client/test-run/index.js.mustache +51 -51
- package/lib/client/ui/index.js +14 -12
- package/lib/client/ui/index.min.js +1 -1
- package/lib/client/ui/sprite.svg +42 -42
- package/lib/client-functions/builder-symbol.js +4 -4
- package/lib/client-functions/client-function-builder.js +156 -135
- package/lib/client-functions/replicator.js +61 -61
- package/lib/client-functions/return-single-prop-mode.js +8 -8
- package/lib/client-functions/selector-api-execution-mode.js +22 -0
- package/lib/client-functions/selectors/add-api.js +646 -588
- package/lib/client-functions/selectors/create-snapshot-methods.js +13 -13
- package/lib/client-functions/selectors/prepare-api-args.js +20 -20
- package/lib/client-functions/selectors/selector-attribute-filter.js +22 -22
- package/lib/client-functions/selectors/selector-builder.js +154 -150
- package/lib/client-functions/selectors/selector-text-filter.js +43 -43
- package/lib/client-functions/selectors/snapshot-properties.js +48 -48
- package/lib/client-functions/types.js +18 -18
- package/lib/compiler/babel/format-babel-produced-code.js +10 -10
- package/lib/compiler/babel/get-base-babel-options.js +11 -11
- package/lib/compiler/babel/load-libs.js +64 -62
- package/lib/compiler/babel/preset-stage-2.js +19 -19
- package/lib/compiler/compile-client-function.js +73 -73
- package/lib/compiler/compilers.js +33 -33
- package/lib/compiler/index.js +92 -92
- package/lib/compiler/interfaces.js +2 -2
- package/lib/compiler/test-file/api-based.js +146 -146
- package/lib/compiler/test-file/base.js +36 -36
- package/lib/compiler/test-file/exportble-lib-path.js +5 -5
- package/lib/compiler/test-file/formats/coffeescript/compiler.js +38 -38
- package/lib/compiler/test-file/formats/coffeescript/get-test-list.js +29 -29
- package/lib/compiler/test-file/formats/es-next/compiler.js +43 -43
- package/lib/compiler/test-file/formats/es-next/get-test-list.js +166 -166
- package/lib/compiler/test-file/formats/es-next/is-flow-code.js +7 -7
- package/lib/compiler/test-file/formats/raw.js +85 -85
- package/lib/compiler/test-file/formats/typescript/compiler.js +135 -135
- package/lib/compiler/test-file/formats/typescript/get-test-list.js +185 -185
- package/lib/compiler/test-file/test-file-parser-base.js +214 -214
- package/lib/configuration/configuration-base.js +165 -165
- package/lib/configuration/constants.js +9 -9
- package/lib/configuration/customizable-compilers.js +7 -7
- package/lib/configuration/default-values.js +51 -51
- package/lib/configuration/interfaces.js +3 -3
- package/lib/configuration/option-names.js +53 -53
- package/lib/configuration/option-source.js +9 -9
- package/lib/configuration/option.js +14 -14
- package/lib/configuration/quarantine-option-names.js +10 -0
- package/lib/configuration/run-option-names.js +26 -26
- package/lib/configuration/screenshot-option-names.js +10 -10
- package/lib/configuration/testcafe-configuration.js +164 -165
- package/lib/configuration/types.js +2 -2
- package/lib/configuration/typescript-configuration.js +62 -62
- package/lib/custom-client-scripts/assert-type.js +7 -7
- package/lib/custom-client-scripts/client-script-init.js +3 -3
- package/lib/custom-client-scripts/client-script.js +107 -108
- package/lib/custom-client-scripts/get-code.js +11 -11
- package/lib/custom-client-scripts/get-url.js +6 -6
- package/lib/custom-client-scripts/load.js +15 -15
- package/lib/custom-client-scripts/problematic-scripts.js +2 -2
- package/lib/custom-client-scripts/routing.js +36 -36
- package/lib/custom-client-scripts/utils.js +60 -60
- package/lib/embedding-utils.js +83 -83
- package/lib/errors/create-stack-filter.js +18 -18
- package/lib/errors/error-list.js +26 -26
- package/lib/errors/get-callsite.js +31 -31
- package/lib/errors/internal-modules-prefix.js +8 -8
- package/lib/errors/is-internal-stack-frame.js +46 -46
- package/lib/errors/process-test-fn-error.js +37 -37
- package/lib/errors/runtime/index.js +123 -123
- package/lib/errors/runtime/templates.js +116 -114
- package/lib/errors/runtime/type-assertions.js +112 -112
- package/lib/errors/stack-cleaning-hook.js +64 -64
- package/lib/errors/test-run/formattable-adapter.js +59 -59
- package/lib/errors/test-run/index.js +302 -302
- package/lib/errors/test-run/render-error-template.js +31 -31
- package/lib/errors/test-run/templates.js +93 -95
- package/lib/errors/test-run/utils.js +90 -85
- package/lib/errors/types.js +157 -155
- package/lib/index.js +81 -81
- package/lib/live/bootstrapper.js +44 -44
- package/lib/live/controller.js +107 -107
- package/lib/live/file-watcher/index.js +67 -67
- package/lib/live/file-watcher/modules-graph.js +58 -58
- package/lib/live/keyboard-observer.js +76 -76
- package/lib/live/logger/index.js +64 -64
- package/lib/live/test-run-controller.js +96 -96
- package/lib/live/test-run-state.js +6 -6
- package/lib/live/test-run.js +56 -56
- package/lib/live/test-runner.js +168 -168
- package/lib/load-assets.js +29 -29
- package/lib/notifications/add-rendered-warning.js +16 -16
- package/lib/notifications/debug-logger.js +78 -78
- package/lib/notifications/deprecated.js +24 -24
- package/lib/notifications/information-message.js +12 -12
- package/lib/notifications/warning-log.js +32 -31
- package/lib/notifications/warning-message.js +48 -48
- package/lib/reporter/command/command-formatter.js +120 -109
- package/lib/reporter/command/format-command.js +8 -8
- package/lib/reporter/command/interfaces.js +2 -2
- package/lib/reporter/index.js +319 -314
- package/lib/reporter/interfaces.js +2 -2
- package/lib/reporter/plugin-host.js +136 -137
- package/lib/reporter/plugin-methods.js +12 -12
- package/lib/role/index.js +74 -74
- package/lib/role/marker-symbol.js +7 -7
- package/lib/role/phase.js +9 -9
- package/lib/runner/bootstrapper.js +272 -272
- package/lib/runner/browser-job-result.js +9 -9
- package/lib/runner/browser-job.js +153 -123
- package/lib/runner/browser-set.js +114 -114
- package/lib/runner/fixture-hook-controller.js +85 -85
- package/lib/runner/index.js +450 -442
- package/lib/runner/interfaces.js +3 -3
- package/lib/runner/reporter-stream-controller.js +28 -28
- package/lib/runner/task/index.js +152 -133
- package/lib/runner/task/phase.js +9 -9
- package/lib/runner/test-run-controller.js +166 -185
- package/lib/runner/tested-app.js +73 -72
- package/lib/screenshots/capturer.js +141 -141
- package/lib/screenshots/constants.js +11 -11
- package/lib/screenshots/crop.js +111 -111
- package/lib/screenshots/default-extension.js +4 -4
- package/lib/screenshots/index.js +67 -67
- package/lib/screenshots/utils.js +39 -39
- package/lib/services/compiler/host.js +190 -106
- package/lib/services/compiler/io.js +9 -9
- package/lib/services/compiler/protocol.js +17 -16
- package/lib/services/compiler/service.js +225 -106
- package/lib/services/compiler/test-run-proxy.js +111 -73
- package/lib/services/interfaces.js +3 -0
- package/lib/services/process-title.js +8 -8
- package/lib/services/serialization/prepare-options.js +17 -17
- package/lib/services/serialization/replicator/create-replicator.js +27 -0
- package/lib/services/serialization/replicator/custom-error-transform.js +28 -0
- package/lib/services/serialization/test-structure.js +93 -77
- package/lib/services/utils/ipc/interfaces.js +30 -30
- package/lib/services/utils/ipc/io.js +108 -108
- package/lib/services/utils/ipc/message.js +76 -73
- package/lib/services/utils/ipc/packet.js +55 -55
- package/lib/services/utils/ipc/proxy.js +110 -118
- package/lib/services/utils/ipc/transport.js +64 -64
- package/lib/shared/errors/index.js +382 -382
- package/lib/shared/node-modules-folder-name.js +4 -4
- package/lib/test-run/bookmark.js +90 -90
- package/lib/test-run/browser-console-messages.js +73 -73
- package/lib/test-run/browser-manipulation-queue.js +92 -92
- package/lib/test-run/client-messages.js +9 -9
- package/lib/test-run/commands/actions.js +486 -425
- package/lib/test-run/commands/assertion.js +45 -45
- package/lib/test-run/commands/base.js +14 -14
- package/lib/test-run/commands/browser-manipulation.js +95 -95
- package/lib/test-run/commands/from-object.js +82 -82
- package/lib/test-run/commands/observation.js +61 -61
- package/lib/test-run/commands/options.js +231 -215
- package/lib/test-run/commands/service.js +54 -48
- package/lib/test-run/commands/type.js +65 -60
- package/lib/test-run/commands/utils.js +87 -87
- package/lib/test-run/commands/validations/argument.js +90 -90
- package/lib/test-run/commands/validations/factories.js +47 -47
- package/lib/test-run/commands/validations/initializers.js +44 -44
- package/lib/test-run/debug-log.js +32 -32
- package/lib/test-run/execute-js-expression.js +74 -74
- package/lib/test-run/index.js +823 -752
- package/lib/test-run/marker-symbol.js +7 -7
- package/lib/test-run/observed-callsites-storage.js +17 -17
- package/lib/test-run/phase.js +16 -16
- package/lib/test-run/session-controller.js +104 -104
- package/lib/testcafe.js +119 -114
- package/lib/utils/assignable.js +39 -39
- package/lib/utils/async-event-emitter.js +28 -28
- package/lib/utils/async-queue.js +14 -14
- package/lib/utils/browser-connection-timeouts.js +19 -19
- package/lib/utils/callsite.js +17 -17
- package/lib/utils/check-file-path.js +31 -31
- package/lib/utils/check-url.js +51 -51
- package/lib/utils/convert-to-best-fit-type.js +16 -16
- package/lib/utils/correct-file-path.js +21 -21
- package/lib/utils/define-lazy-property.js +13 -13
- package/lib/utils/delay.js +6 -6
- package/lib/utils/delegated-api.js +44 -44
- package/lib/utils/detect-display.js +6 -6
- package/lib/utils/detect-ffmpeg.js +44 -44
- package/lib/utils/diff/colors.js +29 -29
- package/lib/utils/diff/index.js +53 -53
- package/lib/utils/diff/util.js +24 -22
- package/lib/utils/diff.js +29 -29
- package/lib/utils/escape-user-agent.js +10 -10
- package/lib/utils/flag-list.js +17 -17
- package/lib/utils/get-any-key.js +8 -8
- package/lib/utils/get-browser.js +8 -8
- package/lib/utils/get-common-path.js +34 -34
- package/lib/utils/get-filter-fn.js +40 -40
- package/lib/utils/get-options/base.js +36 -36
- package/lib/utils/get-options/compiler.js +33 -33
- package/lib/utils/get-options/grep.js +15 -15
- package/lib/utils/get-options/index.js +21 -19
- package/lib/utils/get-options/meta.js +22 -22
- package/lib/utils/get-options/quarantine.js +92 -0
- package/lib/utils/get-options/screenshot.js +17 -17
- package/lib/utils/get-options/ssl.js +45 -45
- package/lib/utils/get-options/video.js +10 -10
- package/lib/utils/get-viewport-width.js +18 -18
- package/lib/utils/guard-time-execution.js +10 -10
- package/lib/utils/handle-errors.js +74 -74
- package/lib/utils/handle-tag-args.js +8 -8
- package/lib/utils/http.js +30 -30
- package/lib/utils/is-localhost.js +11 -11
- package/lib/utils/is-password-input.js +11 -0
- package/lib/utils/is-repl.js +12 -0
- package/lib/utils/is-window-in-iframe.js +6 -6
- package/lib/utils/limit-number.js +10 -10
- package/lib/utils/make-reg-exp.js +7 -7
- package/lib/utils/moment-loader.js +20 -20
- package/lib/utils/parse-file-list.js +71 -71
- package/lib/utils/parse-user-agent.js +55 -55
- package/lib/utils/path-pattern.js +114 -114
- package/lib/utils/prepare-reporters.js +30 -30
- package/lib/utils/prerender-callsite.js +18 -18
- package/lib/utils/process.js +119 -119
- package/lib/utils/promisified-functions.js +46 -46
- package/lib/utils/re-executable-promise.js +39 -39
- package/lib/utils/render-callsite-sync.js +29 -29
- package/lib/utils/render-template.js +10 -10
- package/lib/utils/reporter.js +30 -30
- package/lib/utils/resolve-path-relatively-cwd.js +7 -7
- package/lib/utils/string.js +105 -105
- package/lib/utils/temp-directory/cleanup-process/commands.js +7 -7
- package/lib/utils/temp-directory/cleanup-process/index.js +143 -143
- package/lib/utils/temp-directory/cleanup-process/worker.js +58 -58
- package/lib/utils/temp-directory/index.js +87 -87
- package/lib/utils/temp-directory/lockfile.js +56 -56
- package/lib/utils/thennable.js +7 -7
- package/lib/utils/timer.js +15 -15
- package/lib/utils/to-posix-path.js +8 -8
- package/lib/utils/types.js +2 -2
- package/lib/video-recorder/interfaces.js +2 -2
- package/lib/video-recorder/process.js +126 -126
- package/lib/video-recorder/recorder.js +136 -136
- package/lib/video-recorder/test-run-video-recorder.js +69 -69
- package/lib/video-recorder/videos.js +37 -37
- package/package.json +7 -7
- package/ts-defs/index.d.ts +109 -17
- package/ts-defs/selectors.d.ts +95 -7
- package/ts-defs/testcafe-scripts.d.ts +96 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
!function qa(Ya){var Ka=Ya.document;!function(c,e,y,_,n){var o="default"in c?c.default:c;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t="default"in y?y.default:y,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,s,a,c){return new(a=a||e)(function(n,e){function r(t){try{o(c.next(t))}catch(t){e(t)}}function i(t){try{o(c.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((c=c.apply(t,s||[])).next())})}function l(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var a,u,d=Math.floor(399);(u=a=a||{}).ready="ready",u.readyForBrowserManipulation="ready-for-browser-manipulation",u.waitForFileDownload="wait-for-file-download";var h=a,f={click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",setTestSpeed:"set-test-speed",setPageLoadTimeout:"set-page-load-timeout",debug:"debug",assertion:"assertion",useRole:"useRole",testDone:"test-done",backupStorages:"backup-storages",executeExpression:"execute-expression",executeAsyncExpression:"execute-async-expression",unlockPage:"unlock-page",recorder:"recorder"},p="E1",m="E4",g="E5",w="E9",v="E10",C="E11",I="E12",E="E24",S="E26",W="E27",T="E28",b="E29",x="E30",D="E31",A="E32",R="E33",P="E34",M="E35",N="E36",k="E37",L="E39",F="E40",O="E41",U="E42",G="E43",H="E44",B="E45",V="E46",z="E49",j="E50",X="E51",q="E52",Y="E57",K="E64",J="E65",$="E68",Q="E69",Z="E70",tt="E71",et="E72",nt="E73",rt="E74",it="E76",ot="E77",st="E78",at="E82",ct="E83";function lt(t){return!(function(t){return t.type===f.executeClientFunction||t.type===f.executeSelector}(r=t)||r.type===f.wait||r.type===f.assertion||r.type===f.executeExpression||dt(t)||(n=t).type===f.testDone||n.type===f.showAssertionRetriesStatus||n.type===f.hideAssertionRetriesStatus||n.type===f.setBreakpoint||n.type===f.takeScreenshotOnFail||n.type===f.recorder)||ut(t)&&!((e=t).type===f.switchToIframe||e.type===f.switchToMainWindow);var e,n,r}function ut(t){return t.type===f.resizeWindow||t.type===f.resizeWindowToFitDevice||t.type===f.maximizeWindow}function dt(t){return(e=t).type===f.takeScreenshot||e.type===f.takeElementScreenshot||e.type===f.takeScreenshotOnFail||ut(t);var e}function ht(t){this.code=t,this.isTestCafeError=!0,this.callsite=null}var ft,pt=(i(mt,ft=ht),mt);function mt(t,e,n){var r=ft.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var gt,wt=(i(vt,gt=ht),vt);function vt(t){var e=gt.call(this,z)||this;return e.instantiationCallsiteName=t,e}var yt,_t=(i(Ct,yt=ht),Ct);function Ct(t){var e=yt.call(this,j)||this;return e.instantiationCallsiteName=t,e}var It,Et=(i(St,It=ht),St);function St(t,e){var n=e.apiFnChain,r=e.apiFnIndex,i=It.call(this,t)||this;return i.apiFnChain=n,i.apiFnIndex=r,i}var Wt,Tt=(i(bt,Wt=ht),bt);function bt(){return Wt.call(this,X)||this}var xt,Dt=(i(At,xt=Et),At);function At(t,e){var n=xt.call(this,q,e)||this;return n.callsite=t,n}var Rt,Pt=(i(Mt,Rt=ht),Mt);function Mt(t,e){var n=Rt.call(this,p)||this;return n.errStack=t,n.pageDestUrl=e,n}var Nt,kt=(i(Lt,Nt=ht),Lt);function Lt(t,e){var n=Nt.call(this,m)||this;return n.errMsg=String(e),n.instantiationCallsiteName=t,n}var Ft,Ot=(i(Ut,Ft=ht),Ut);function Ut(t,e,n){var r=Ft.call(this,g,e,n)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Gt,Ht=(i(Bt,Gt=ht),Bt);function Bt(t){var e=Gt.call(this,K)||this;return e.errMsg=String(t),e}var Vt,zt=(i(jt,Vt=ht),jt);function jt(t,e){var n=Vt.call(this,J)||this;return n.errMsg=String(t),n.moduleName=e,n}var Xt,qt=(i(Yt,Xt=pt),Yt);function Yt(t,e){return Xt.call(this,w,t,e)||this}var Kt,Jt=(i($t,Kt=pt),$t);function $t(t,e){return Kt.call(this,v,t,e)||this}var Qt,Zt=(i(te,Qt=pt),te);function te(t,e){return Qt.call(this,C,t,e)||this}var ee,ne=(i(re,ee=pt),re);function re(t,e){return ee.call(this,I,t,e)||this}var ie,oe=(i(se,ie=Et),se);function se(t){return ie.call(this,E,t)||this}var ae,ce=(i(le,ae=ht),le);function le(){return ae.call(this,S)||this}var ue,de=(i(he,ue=ht),he);function he(t){var e=ue.call(this,W)||this;return e.nodeDescription=t,e}var fe,pe=(i(me,fe=Et),me);function me(t,e){var n=fe.call(this,T,e)||this;return n.argumentName=t,n}var ge,we=(i(ve,ge=ht),ve);function ve(t){var e=ge.call(this,b)||this;return e.argumentName=t,e}var ye,_e=(i(Ce,ye=ht),Ce);function Ce(t,e){var n=ye.call(this,x)||this;return n.argumentName=t,n.nodeDescription=e,n}var Ie,Ee=(i(Se,Ie=ht),Se);function Se(){return Ie.call(this,D)||this}var We,Te=(i(be,We=ht),be);function be(){return We.call(this,A)||this}var xe,De=(i(Ae,xe=ht),Ae);function Ae(t){var e=xe.call(this,R)||this;return e.argumentName=t,e}var Re,Pe=(i(Me,Re=ht),Me);function Me(){return Re.call(this,M)||this}var Ne,ke=(i(Le,Ne=ht),Le);function Le(t){var e=Ne.call(this,N)||this;return e.argumentName=t,e}var Fe,Oe=(i(Ue,Fe=ht),Ue);function Ue(t,e){var n=Fe.call(this,k)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var Ge,He=(i(Be,Ge=ht),Be);function Be(){return Ge.call(this,P)||this}var Ve,ze=(i(je,Ve=ht),je);function je(t,e){var n=Ve.call(this,O)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var Xe,qe=(i(Ye,Xe=ht),Ye);function Ye(t,e){var n=Xe.call(this,Y)||this;return t<=0?e<=0?(n.verb="are",n.dimensions="width and height"):(n.verb="is",n.dimensions="width"):(n.verb="is",n.dimensions="height"),n}var Ke,Je=(i($e,Ke=ht),$e);function $e(){return Ke.call(this,F)||this}var Qe,Ze=(i(tn,Qe=ht),tn);function tn(){return Qe.call(this,L)||this}var en,nn=(i(rn,en=ht),rn);function rn(){return en.call(this,U)||this}var on,sn=(i(an,on=ht),an);function an(){return on.call(this,Q)||this}var cn,ln=(i(un,cn=ht),un);function un(){return cn.call(this,$)||this}var dn,hn=(i(fn,dn=ht),fn);function fn(){return dn.call(this,Z)||this}var pn,mn=(i(gn,pn=ht),gn);function gn(){return pn.call(this,tt)||this}var wn,vn=(i(yn,wn=ht),yn);function yn(){return wn.call(this,nt)||this}var _n,Cn,In=(i(En,_n=ht),En);function En(){return _n.call(this,at)||this}function Sn(t){var e=Cn.call(this,st)||this;return e.errMsg=t,e}i(Sn,Cn=ht);var Wn,Tn=(i(bn,Wn=ht),bn);function bn(){return Wn.call(this,rt)||this}var xn,Dn=(i(An,xn=ht),An);function An(){return xn.call(this,it)||this}var Rn,Pn=(i(Mn,Rn=ht),Mn);function Mn(){return Rn.call(this,ot)||this}var Nn,kn=(i(Ln,Nn=ht),Ln);function Ln(){return Nn.call(this,et)||this}var Fn,On=(i(Un,Fn=ht),Un);function Un(){return Fn.call(this,ct)||this}var Gn,Hn=(i(Bn,Gn=ht),Bn);function Bn(){return Gn.call(this,G)||this}var Vn,zn=(i(jn,Vn=ht),jn);function jn(){return Vn.call(this,H)||this}var Xn,qn=(i(Yn,Xn=ht),Yn);function Yn(t,e){var n=Xn.call(this,B)||this;return n.dialogType=t,n.pageUrl=e,n}var Kn,Jn=(i($n,Kn=ht),$n);function $n(t,e,n){var r=Kn.call(this,V)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}var Qn="_nativeMethods",Zn=(tr.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},tr.prototype._getWindowIds=function(t){return this[Qn].objectKeys(t)},tr.prototype._copyArray=function(t){return this[Qn].arraySlice.call(t)},tr.prototype._concatArrays=function(t,e){return this[Qn].arrayConcat.call(t,e)},tr.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},tr.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Qn].arrayForEach.call(t,function(t){n.ensureMessageContainer(t),n[t].log=n._concatArrays(n[t].log,e[t].log),n[t].info=n._concatArrays(n[t].info,e[t].info),n[t].warn=n._concatArrays(n[t].warn,e[t].warn),n[t].error=n._concatArrays(n[t].error,e[t].error)}),this},tr.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},tr.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Qn].arrayForEach.call(t,function(t){n[t]={log:e._copyArray(e[t].log),info:e._copyArray(e[t].info),warn:e._copyArray(e[t].warn),error:e._copyArray(e[t].error)}}),n},tr);function tr(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Qn,{value:n}),this.concat(t)}var er,nr=(i(rr,er=Zn),rr);function rr(t){return er.call(this,t,c.nativeMethods)||this}var ir=(or.prototype._getAssignableProperties=function(){throw new Error("Not implemented")},or.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t)for(var r=this._getAssignableProperties(),i=0;i<r.length;i++){for(var o,s=r[i],a=s.name,c=s.type,l=s.required,u=s.init,d=s.defaultValue,h=a.split("."),f=h.length-1,p=h[f],m=t,g=this,w=0;w<f&&m&&g;w++)m=m[h[w]],g=g[h[w]];g&&"defaultValue"in r[i]&&(g[a]=d),m&&g&&(void 0===(o=m[p])&&!l||(e&&c&&c(a,o),g[p]=u?u(a,o,n):o))}},or);function or(){}function sr(){return c.nativeMethods.performanceNow().toString()}var ar,cr=(i(lr,ar=ir),lr.prototype._getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isFirstRequestAfterWindowSwitching"}]},lr);function lr(t){var e=ar.call(this,t)||this;return e.id=sr(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isFirstRequestAfterWindowSwitching=!1,e._assignFrom(t,!0),e}var ur,dr=(function(t){function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),n="function"==typeof ArrayBuffer,s="function"==typeof Map,a="function"==typeof Set,c=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],l=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function u(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},u.prototype._handlePlainObject=function(e){var t,n=this,r=Object.create(null),i=Object.getOwnPropertyNames(e);for(t in i.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[t]=r[t]},u.prototype._handleTransformedObject=function(t,e,n){var r=t["@t"],i=this.transformMap[r];if(!i)throw new Error("Can't find transform for \""+r+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=i.fromSerializable(t.data)},u.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var r=this.references,i=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===i&&(i=r[t]),i},set:function(t){return i=t}})},u.prototype._handleCircularRef=function(t,e,n){-1<this.activeTransformsStack.indexOf(this.references[t])?this._handleCircularSelfRefDuringTransform(t,e,n):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),e[n]=this.references[t])},u.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var r=t["@r"];if(void 0!==r)this._handleCircularRef(r,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var i=0;i<t.length;i++)this._handleValue(t[i],t,i);else this._handlePlainObject(t)}},u.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var d=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return n&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return l.call(e)},fromSerializable:function(t){if(n){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){for(var n=0;n<c.length;n++){var r=c[n];if("function"==typeof i[r]&&e instanceof i[r])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:l.call(t)}},fromSerializable:function(t){return"function"==typeof i[t.ctorName]?new i[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return s&&e instanceof Map},toSerializable:function(t){var n=[];return t.forEach(function(t,e){n.push(e),n.push(t)}),n},fromSerializable:function(t){if(s){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return a&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(a){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],h=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(d)};h.prototype.addTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},h.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],r=this.transforms.indexOf(n);-1<r&&this.transforms.splice(r,1),delete this.transformsMap[n.type]}return this},h.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},h.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new u(e,this.transformsMap).transform()}}(ur={exports:{}}),ur.exports);function hr(t,e){return new c.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,c.Promise,RegExp)}var fr=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],pr=["tagName","attributes"],mr=["tagName","visible","focused","attributes","boundingClientRect","classNames","style","innerText","namespaceURI","id","value","checked","selected","selectedIndex","scrollWidth","scrollHeight","scrollLeft","scrollTop","offsetWidth","offsetHeight","offsetLeft","offsetTop","clientWidth","clientHeight","clientLeft","clientTop"],gr={textContent:function(t){return t.textContent},childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!gr.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!gr.childElementCount(t)}},wr=(vr.prototype._initializeProperties=function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r],o=n[i];this[i]=o?o(t):t[i]}},vr);function vr(){}var yr,_r=(i(Cr,yr=wr),Cr);function Cr(t){var e=yr.call(this)||this;return e._initializeProperties(t,fr,gr),e}var Ir,Er={tagName:function(t){return t.tagName.toLowerCase()},visible:y.positionUtils.isElementVisible,focused:function(t){return y.domUtils.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},r=e.length-1;0<=r;r--)n[e[r].name]=e[r].value;return n},boundingClientRect:function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width,height:e.height}},classNames:function(t){var e=t.className;return(e="string"==typeof e.animVal?e.animVal:e).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=Ya.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Sr=(i(Wr,Ir=wr),Wr);function Wr(t){var e=Ir.call(this,t)||this;return e._initializeProperties(t,pr,Er),e}var Tr,br=(i(xr,Tr=_r),xr);function xr(t){var e=Tr.call(this,t)||this;return e._initializeProperties(t,mr,Er),e}function Dr(t){return t}var Ar=Ya.Node;function Rr(t){return new dr({serialize:Dr,deserialize:Dr}).addTransforms(t)}var Pr=(Mr.prototype.shouldTransform=function(t){return"function"===t},Mr.prototype.toSerializable=function(){return""},Mr.prototype.fromSerializable=function(t){return hr(t.fnCode,t.dependencies)},Mr);function Mr(){this.type="Function"}var Nr=(kr.prototype.shouldTransform=function(t,e){return e instanceof Ar},kr.prototype.toSerializable=function(t){return new Sr(t)},kr);function kr(){this.type="Node"}var Lr=(Fr.prototype._extend=function(t,n){var r=this;o.nativeMethods.objectKeys.call(Ya.Object,this.customDOMProperties).forEach(function(e){try{t[e]=r.customDOMProperties[e](n)}catch(t){throw new Ot(r.instantiationCallsiteName,t,e)}})},Fr.prototype.shouldTransform=function(t,e){return e instanceof Ar},Fr.prototype.toSerializable=function(t){var e=new(1===t.nodeType?br:_r)(t);return this._extend(e,t),e},Fr);function Fr(t){this.type="Node",this.customDOMProperties=t||{}}var Or=(Ur.prototype.shouldTransform=function(t,e){if(e instanceof Ar)throw new _t(this.instantiationCallsiteName)},Ur);function Ur(t){this.type="Node",this.instantiationCallsiteName=t}var Gr=(Hr.prototype.getResult=function(){var e=this;return c.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new kt(e.command.instantiationCallsiteName,t)),t})},Hr.prototype.getResultDriverStatus=function(){var e=this;return this.getResult().then(function(t){return new cr({isCommandResult:!0,result:e.replicator.encode(t)})}).catch(function(t){return new cr({isCommandResult:!0,executionError:t})})},Hr.prototype._createReplicator=function(){return Rr([new Or(this.command.instantiationCallsiteName),new Pr])},Hr.prototype._executeFn=function(t){return this.fn.apply(Ya,t)},Hr);function Hr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=hr(this.command.fnCode,this.dependencies)}var Br="appeared-dialog",Vr="unexpected-dialog",zr="handler-error",jr=o.eventSandbox.message,Xr=o.processScript,qr=o.nativeMethods,Yr="testcafe|native-dialog-tracker|appeared-dialogs",Kr="testcafe|native-dialog-tracker|unexpected-dialog",Jr="testcafe|native-dialog-tracker|error-in-handler",$r=Xr("window.location.href"),Qr=(Object.defineProperty(Zr.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Yr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Yr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Zr.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Kr)},set:function(t){this.contextStorage.setItem(Kr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Zr.prototype,"handlerError",{get:function(){return this.contextStorage.getItem(Jr)},set:function(t){this.contextStorage.setItem(Jr,t)},enumerable:!1,configurable:!0}),Zr._getPageUrl=function(){return qr.eval($r)},Zr.prototype._initListening=function(){var n=this;jr.on(jr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===Br?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==Vr||n.unexpectedDialog?e.type!==zr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},Zr.prototype._init=function(){var e=this;o.on(o.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),Ya.alert=function(){return e._defaultDialogHandler("alert")},Ya.confirm=function(){return e._defaultDialogHandler("confirm")},Ya.prompt=function(){return e._defaultDialogHandler("prompt")}},Zr.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=Zr._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new Gr(o.dialogHandler),r=null;try{r=n.fn.apply(Ya,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},Zr.prototype._defaultDialogHandler=function(t){var e=Zr._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},Zr.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},Zr.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},Zr.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){Ya[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},Zr.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new qn(t.type,t.url):e?new Jn(e.type,e.message,e.url):null},Zr);function Zr(t,e){this.contextStorage=t,this.dialogHandler=e,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(e)}function ti(t){this.type=t,this.id=sr()}var ei,ni="driver|establish-connection",ri="driver|switch-to-window",ii="driver|close-window",oi="driver|close-window-validation",si="driver|switch-to-window-validation",ai="driver|get-windows",ci="driver|command-executed",li="driver|execute-command",ui="driver|confirmation",di="driver|set-native-dialog-handler",hi="driver|set-as-master",fi="driver|close-all-child-windows",pi="driver|start-to-restore-child-link",mi="driver|restore-child-link",gi="driver|child-window-is-loaded-in-iframe",wi="driver|child-window-is-opened-in-iframe",vi=(i(yi,ei=ti),yi);function yi(){return ei.call(this,ni)||this}var _i,Ci=(i(Ii,_i=ti),Ii);function Ii(t){var e=t.windowId,n=_i.call(this,oi)||this;return n.windowId=e,n}var Ei,Si=(i(Wi,Ei=ti),Wi);function Wi(t){var e=t.windowId,n=t.fn,r=Ei.call(this,si)||this;return r.windowId=e,r.fn=n,r}var Ti,bi=(i(xi,Ti=ti),xi);function xi(){return Ti.call(this,ai)||this}var Di,Ai=(i(Ri,Di=ti),Ri);function Ri(t){var e=t.windowId,n=t.isCurrentWindow,r=Di.call(this,ii)||this;return r.windowId=e,r.isCurrentWindow=n,r}var Pi,Mi=(i(Ni,Pi=ti),Ni);function Ni(t){var e=t.windowId,n=t.fn,r=Pi.call(this,ri)||this;return r.windowId=e,r.fn=n,r}var ki,Li=(i(Fi,ki=ti),Fi);function Fi(t){var e=ki.call(this,ci)||this;return e.driverStatus=t,e}var Oi,Ui=(i(Gi,Oi=ti),Gi);function Gi(t,e){var n=Oi.call(this,li)||this;return n.command=t,n.testSpeed=e,n}var Hi,Bi=(i(Vi,Hi=ti),Vi);function Vi(t,e){var n=Hi.call(this,ui)||this;return n.requestMessageId=t,n.result=e,n}var zi,ji=(i(Xi,zi=ti),Xi);function Xi(t){var e=zi.call(this,di)||this;return e.dialogHandler=t,e}var qi,Yi=(i(Ki,qi=ti),Ki);function Ki(t){var e=qi.call(this,hi)||this;return e.finalizePendingCommand=t,e}var Ji,$i=(i(Qi,Ji=ti),Qi);function Qi(){return Ji.call(this,fi)||this}var Zi,to=(i(eo,Zi=ti),eo);function eo(){return Zi.call(this,pi)||this}var no,ro=(i(io,no=ti),io);function io(t){var e=no.call(this,mi)||this;return e.windowId=t,e}var oo,so=(i(ao,oo=ti),ao);function ao(t){var e=oo.call(this,gi)||this;return e.windowId=t,e}var co,lo=(i(uo,co=ti),uo);function uo(){return co.call(this,wi)||this}var ho=o.json,fo=o.nativeMethods,po=(mo.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},mo.prototype._loadFromStorage=function(){var t=fo.storageGetItem.call(this.storage,this.storageKey);t&&(this.data=ho.parse(t),fo.storageRemoveItem.call(this.storage,this.storageKey))},mo.prototype.save=function(){fo.storageSetItem.call(this.storage,this.storageKey,ho.stringify(this.data))},mo.prototype.setItem=function(t,e){this.data[t]=e,this.save()},mo.prototype.getItem=function(t){return this.data[t]},mo.prototype.dispose=function(){fo.storageRemoveItem.call(this.storage,this.storageKey)},mo);function mo(t,e,n){this.storage=fo.winSessionStorageGetter.call(t),this.storageKey=this._createStorageKey(e,n),this.data={},this._loadFromStorage()}function go(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),c.Promise.race([y.delay(e),new c.Promise(function(e){s=function(t){t.message.type===ui&&t.message.requestMessageId===n.id&&e(t.message)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=c.nativeMethods.setInterval.call(Ya,function(){return c.eventSandbox.message.sendServiceMsg(n,t)},1e3),c.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(c.nativeMethods.clearInterval.call(Ya,i),c.nativeMethods.clearTimeout.call(Ya,o),c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}var wo=2e4;function vo(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new Bi(e,n);c.eventSandbox.message.sendServiceMsg(i,r)}var yo=(Object.defineProperty(_o.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),_o.prototype._ensureIframe=function(){var t=this;return y.domUtils.isElementInDocument(this.driverIframe)?y.waitFor(function(){return y.positionUtils.isElementVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new zn}):c.Promise.reject(new Hn)},_o.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new c.Promise(function(t){e.checkIframeInterval=c.nativeMethods.setInterval.call(Ya,function(){e._ensureIframe().catch(function(){return y.delay(500).then(function(){return t(new cr({isCommandResult:!0}))})})},1e3)})},_o.prototype._waitForCommandResult=function(){var e=this,n=null;return c.Promise.race([this._waitForIframeRemovedOrHidden(),new c.Promise(function(e){n=function(t){t.message.type===ci&&e(t.message.driverStatus)},c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return c.eventSandbox.message.off(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),c.nativeMethods.clearInterval.call(Ya,e.checkIframeInterval),t})},_o.prototype.sendConfirmationMessage=function(t){vo({requestMsgId:t,result:{id:this.driverId},window:this.driverWindow})},_o.prototype.executeCommand=function(e,n){var r=this;return this._ensureIframe().then(function(){var t=new Ui(e,n);return c.Promise.all([go(t,r.driverWindow,r.iframeAvailabilityTimeout,nn),r._waitForCommandResult()])}).then(function(t){return t[1]})},_o);function _o(t,e){this.driverWindow=t,this.driverIframe=y.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0}var Co=o.Promise,Io=o.nativeMethods,Eo=(So.prototype._onScriptElementAdded=function(t){var e,n,r=this,i=Io.scriptSrcGetter.call(t);void 0!==i&&""!==i&&(this.scriptsCount++,e=null,n=function(){Io.removeEventListener.call(t,"load",n),Io.removeEventListener.call(t,"error",n),Io.clearTimeout.call(Ya,e),r._onScriptLoadedOrFailed()},Io.addEventListener.call(t,"load",n),Io.addEventListener.call(t,"error",n),e=Io.setTimeout.call(Ya,n,this.SCRIPT_LOADING_TIMEOUT))},So.prototype._onScriptLoadedOrFailed=function(){var t=this;this.scriptsCount--,this.scriptsCount||y.delay(25).then(function(){t.resolveWaitingPromise&&(t.scriptsCount||t.resolveWaitingPromise())})},So.prototype.wait=function(){var n=this;return new Co(function(t){function e(){Io.clearTimeout.call(Ya,n.watchdog),o.off(o.EVENTS.scriptElementAdded,n.scriptElementAddedHandler),n.watchdog=null,n.resolveWaitingPromise=null,t()}n.scriptsCount?(n.watchdog=Io.setTimeout.call(Ya,e,n.BARRIER_TIMEOUT),n.resolveWaitingPromise=e):e()})},So);function So(){var e=this;this.watchdog=null,this.SCRIPT_LOADING_TIMEOUT=2e3,this.BARRIER_TIMEOUT=3e3,this.scriptsCount=0,this.resolveWaitingPromise=null,this.scriptElementAddedHandler=function(t){return e._onScriptElementAdded(t.el)},o.on(o.EVENTS.scriptElementAdded,this.scriptElementAddedHandler)}function Wo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new y.RequestBarrier,i=new Eo;y.pageUnloadBarrier.watchForPageNavigationTriggers();var o=null,s=t.apply(void 0,e),a=s.then(function(t){return o=t,c.Promise.all([r.wait().then(function(){return i.wait()}),y.pageUnloadBarrier.wait()])}).then(function(){return o});return{actionPromise:s,barriersPromise:a}}var To,bo=Array.isArray,xo=Ya.Node,Do=Ya.HTMLCollection,Ao=Ya.NodeList;function Ro(t){return!!t}function Po(t){return!(!y.domUtils.isDomElement(t)&&!y.domUtils.isTextNode(t))&&(y.domUtils.isOptionElement(t)||"optgroup"===y.domUtils.getTagName(t)?n.selectElement.isOptionElementVisible(t):y.positionUtils.isElementVisible(t))}function Mo(t){return t instanceof Do||t instanceof Ao||function(t){if(bo(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof xo))return;return 1}}(t)}var No=t.arrayUtils,ko=o.utils.types,Lo=o.nativeMethods,Fo=1,Oo=2,Uo=3,Go=((To={})[Fo]=/^\.filterVisible\(\)$/,To[Oo]=/^\.filterHidden\(\)$/,To[Uo]=/^\.nth\(\d+\)$/,To),Ho=(Object.defineProperty(Bo.prototype,"error",{get:function(){return this.err},set:function(t){null===this.err&&(this.err=t)},enumerable:!1,configurable:!0}),Bo.prototype.filter=function(t,e,n){var r,i=No.filter(t,Ro);return e.filterVisible&&(i=i.filter(Po),this.assertFilterError(i,n,Fo)),e.filterHidden&&(i=i.filter(function(t){return!Po(t)}),this.assertFilterError(i,n,Oo)),e.counterMode?i=null!==e.index?this.getNodeByIndex(i,e.index)?1:0:i.length:(e.collectionMode?null!==e.index&&(i=(r=this.getNodeByIndex(i,e.index))?[r]:[]):i=this.getNodeByIndex(i,e.index||0),"number"==typeof e.index&&this.assertFilterError(i,n,Uo)),i},Bo.prototype.cast=function(t){var e=null;if(ko.isNullOrUndefined(t))e=[];else if(t instanceof Node)e=[t];else{if(!Mo(t))throw new Tt;e=t}return e},Bo.prototype.assertFilterError=function(t,e,n){t&&0!==t.length||(this.error=this.getErrorItem(e,n))},Bo.prototype.getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(Go[e].test(n[i]))return i;return null},Bo.prototype.getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},Bo);function Bo(){this.err=null}Lo.objectDefineProperty.call(Ya,Ya,"%testCafeSelectorFilter%",{value:new Ho,configurable:!0});var Vo,zo=c.nativeMethods.date,jo=(i(Xo,Vo=Gr),Xo.prototype._createReplicator=function(){return Rr([new Pr])},Xo.prototype._getTimeoutErrorParams=function(){var t=Ya["%testCafeSelectorFilter%"].error,e=this.command.apiFnChain;return void 0!==t?{apiFnIndex:t,apiFnChain:e}:null},Xo.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},Xo.prototype._validateElement=function(o,s){var a=this;return c.Promise.resolve().then(function(){return a.fn.apply(Ya,o)}).then(function(t){var e=!!t,n=!a.command.visibilityCheck||Po(t),r=new zo-s>=a.timeout;if(e&&(n||y.domUtils.isShadowRoot(t)))return t;if(!r)return y.delay(200).then(function(){return a._validateElement(o,s)});var i=a.getVisibleValueMode?null:a._getTimeoutError(e);if(i)throw i(a._getTimeoutErrorParams());return null})},Xo.prototype._executeFn=function(t){if(this.counterMode)return Vo.prototype._executeFn.call(this,t);var e=new zo,n=null,r=null;return this._validateElement(t,e).catch(function(t){n=t}).then(function(t){if(n)throw n;r=t}).then(function(){return r})},Xo);function Xo(t,e,n,r,i){var o,s=Vo.call(this,t)||this;s.createNotFoundError=r,s.createIsInvisibleError=i,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,n&&(o=new zo-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies&&s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Lr(a)]),s}var qo=c.nativeMethods.date,Yo=(Ko.prototype._ensureElement=function(t){var e=this,n=t.selector,r=t.createNotFoundError,i=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new jo(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!y.domUtils.isDomElement(t))throw o(y.NODE_TYPE_DESCRIPTIONS[t.nodeType]);e.elements.push(t)})},Ko.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Ko);function Ko(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=c.Promise.resolve(),this.ensureElementsStartTime=new qo,t.forEach(function(t){return n._ensureElement(t)})}function Jo(t,e){return new Yo(t,e).getElements()}function $o(t){return{selector:t,createNotFoundError:function(t){return new oe(t)},createIsInvisibleError:function(){return new ce},createHasWrongNodeTypeError:function(t){return new de(t)}}}function Qo(t,e){return{selector:t,createNotFoundError:function(t){return new pe(e,t)},createIsInvisibleError:function(){return new we(e)},createHasWrongNodeTypeError:function(t){return new _e(e,t)}}}function Zo(t,e){if(!y.domUtils.isContentEditableElement(t))throw new De(e)}var ts=c.nativeMethods.date,es=(ns.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},ns.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?y.delay(2e3*(1-this.command.options.speed)):c.Promise.resolve()},ns.prototype._isExecutionTimeoutExpired=function(){return c.nativeMethods.dateNow()-this.executionStartTime>=this.commandSelectorTimeout},ns.prototype._ensureCommandArguments=function(){if(this.command.type===f.pressKey&&y.parseKeySequence(this.command.keys).error)throw new ke("keys")},ns.prototype._ensureCommandElements=function(){var e=this,t=[];return this.command.selector&&t.push($o(this.command.selector)),this.command.type===f.dragToElement?t.push(Qo(this.command.destinationSelector,"destinationSelector")):this.command.type===f.selectEditableContent&&(t.push(Qo(this.command.startSelector,"startSelector")),t.push(Qo(this.command.endSelector||this.command.startSelector,"endSelector"))),Jo(t,this.globalSelectorTimeout).then(function(t){e.elements=t})},ns.prototype._ensureCommandElementsProperties=function(){this.command.type===f.selectText?function(t){if(!y.domUtils.isEditableElement(t))throw new Ee}(this.elements[0]):this.command.type===f.selectTextAreaContent?function(t){if(!y.domUtils.isTextAreaElement(t))throw new Te}(this.elements[0]):this.command.type===f.selectEditableContent?(Zo(this.elements[0],"startSelector"),Zo(this.elements[1],"endSelector"),function(t){if(!y.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Pe}(this.elements)):this.command.type!==f.setFilesToUpload&&this.command.type!==f.clearUpload||function(t){if(!y.domUtils.isFileInput(t))throw new He}(this.elements[0])},ns.prototype._ensureCommandOptions=function(){var t,e,n,r,i;this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&(t=this.elements[0],e=this.command.options,n=_.getOffsetOptions(t,e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.offsetX=r,e.offsetY=i)},ns.prototype._createAutomation=function(){var t;switch(this.command.type){case f.click:return/option|optgroup/.test(y.domUtils.getTagName(this.elements[0]))?new _.SelectChildClick(this.elements[0],this.command.options):new _.Click(this.elements[0],this.command.options);case f.rightClick:return new _.RClick(this.elements[0],this.command.options);case f.doubleClick:return new _.DblClick(this.elements[0],this.command.options);case f.hover:return new _.Hover(this.elements[0],this.command.options);case f.drag:return new _.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case f.dragToElement:return new _.DragToElement(this.elements[0],this.elements[1],this.command.options);case f.typeText:return new _.Type(this.elements[0],this.command.text,this.command.options);case f.selectText:case f.selectTextAreaContent:return t=_.calculateSelectTextArguments(this.elements[0],this.command),new _.SelectText(this.elements[0],t.startPos,t.endPos,this.command.options);case f.selectEditableContent:return new _.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case f.pressKey:return new _.Press(y.parseKeySequence(this.command.keys).combinations,this.command.options);case f.setFilesToUpload:return new _.Upload(this.elements[0],this.command.filePath,function(t,e){return new Oe(t,e)});case f.clearUpload:return new _.Upload(this.elements[0])}return null},ns.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){n._ensureCommandOptions();var t=n._createAutomation();return t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n.targetElement=t.element,n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()}):(n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()),t.run(e)})},ns.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return y.promiseUtils.whilst(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(e._isExecutionTimeoutExpired()){if(t.message===_.ERROR_TYPES.foundElementIsNotTarget)return n=!1,c.Promise.resolve();throw t.message===_.ERROR_TYPES.elementIsInvisibleError?new ce:t}return y.delay(250)})})},ns.prototype.execute=function(){var i=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new c.Promise(function(t){i.executionStartedHandler=t}),completionPromise:new c.Promise(function(n){i.executionStartTime=new ts;try{i._ensureCommandArguments()}catch(t){return void n(new cr({isCommandResult:!0,executionError:t}))}i.commandSelectorTimeout=i._getSpecificTimeout(),i.statusBar.showWaitingElementStatus(i.commandSelectorTimeout);var t=Wo(function(){return i._runRecursively()}),e=t.actionPromise,r=t.barriersPromise;e.then(function(){return c.Promise.all([i._delayAfterExecution(),r])}).then(function(){var t={isCommandResult:!0},e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(i.elements);i.targetElement&&(e[0]=i.targetElement),t.result=Rr(new Nr).encode(e),n(new cr(t))}).catch(function(t){return i.statusBar.hideWaitingElementStatus(!1).then(function(){return n(new cr({isCommandResult:!0,executionError:t}))})})})}},ns);function ns(t,e,n,r){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.testSpeed=r,this.targetElement=null,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}function rs(t,e,n){return Math.min(Math.max(e,t),n)}function is(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=rs(t.length,0,e)),n&&t.min<0&&(t.min+=e),r&&t.max<0&&(t.max+=e),n||(t.min=r&&i?t.max-t.length:0),r||(t.max=i?t.min+t.length:e),t.min=rs(t.min,0,e),t.max=rs(t.max,0,e),t.length=t.max-t.min,t}function os(t,e,n){return Math.round(t+rs(e-t,0,n)/2)}function ss(r){return function(t,e){var n=typeof e;if("number"!=n)throw new r(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new r(t,e)}}var as,cs,ls,us,ds,hs=ss(qt),fs=(cs=ss(as=Jt),function(t,e){if(cs(t,e),e<0)throw new as(t,e)}),ps=(ls=Zt,function(t,e){var n=typeof e;if("boolean"!=n)throw new ls(t,n)}),ms=(us=ne,function(t,e){var n=typeof e;if("number"!=n)throw new us(t,n);if(isNaN(e)||e<.01||1<e)throw new us(t,e)}),gs=(i(ws,ds=ir),ws.prototype._getAssignableProperties=function(){return[{name:"speed",type:ms}]},ws);function ws(t,e){var n=ds.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var vs,ys=(i(_s,vs=gs),_s.prototype._getAssignableProperties=function(){return vs.prototype._getAssignableProperties.call(this).concat([{name:"offsetX",type:hs},{name:"offsetY",type:hs}])},_s);function _s(t,e){var n=vs.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var Cs,Is=(i(Es,Cs=ys),Es.prototype._getAssignableProperties=function(){return Cs.prototype._getAssignableProperties.call(this).concat([{name:"scrollToCenter",type:ps},{name:"skipParentFrames",type:ps}])},Es);function Es(t,e){var n=Cs.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var Ss,Ws=(i(Ts,Ss=gs),Ts.prototype._getAssignableProperties=function(){return Ss.prototype._getAssignableProperties.call(this).concat([{name:"scrollTargetX",type:hs},{name:"scrollTargetY",type:hs},{name:"crop.left",type:hs},{name:"crop.right",type:hs},{name:"crop.top",type:hs},{name:"crop.bottom",type:hs},{name:"includeMargins",type:ps},{name:"includeBorders",type:ps},{name:"includePaddings",type:ps}])},Ts);function Ts(t,e){var n=Ss.call(this)||this;return n.scrollTargetX=null,n.scrollTargetY=null,n.includeMargins=!1,n.includeBorders=!0,n.includePaddings=!0,n.crop={left:null,right:null,top:null,bottom:null},n._assignFrom(t,e),n}var bs,xs=(i(Ds,bs=ys),Ds.prototype._getAssignableProperties=function(){return bs.prototype._getAssignableProperties.call(this).concat([{name:"modifiers.ctrl",type:ps},{name:"modifiers.alt",type:ps},{name:"modifiers.shift",type:ps},{name:"modifiers.meta",type:ps}])},Ds);function Ds(t,e){var n=bs.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var As,Rs,Ps,Ms,Ns,ks,Ls=(i(Fs,As=xs),Fs.prototype._getAssignableProperties=function(){return As.prototype._getAssignableProperties.call(this).concat([{name:"caretPos",type:fs}])},Fs);function Fs(t,e){var n=As.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}function Os(t,e){var n=Rs.call(this)||this;return n.speed=null,n.minMovingTime=null,n.holdLeftButton=!1,n.skipScrolling=!1,n.skipDefaultDragBehavior=!1,n._assignFrom(t,e),n}function Us(t,e){var n=Ps.call(this)||this;return n.replace=!1,n.paste=!1,n._assignFrom(t,e),n}function Gs(t,e){var n=Ms.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function Hs(t,e){var n=Ns.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function Bs(t,e){var n=ks.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function Vs(t){return t.top!==t}i(Os,Rs=xs),Os.prototype._getAssignableProperties=function(){return Rs.prototype._getAssignableProperties.call(this).concat([{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:ps},{name:"skipDefaultDragBehavior",type:ps}])},i(Us,Ps=Ls),Us.prototype._getAssignableProperties=function(){return Ps.prototype._getAssignableProperties.call(this).concat([{name:"replace",type:ps},{name:"paste",type:ps}])},i(Gs,Ms=xs),Gs.prototype._getAssignableProperties=function(){return Ms.prototype._getAssignableProperties.call(this).concat([{name:"destinationOffsetX",type:hs},{name:"destinationOffsetY",type:hs}])},i(Hs,Ns=ir),Hs.prototype._getAssignableProperties=function(){return[{name:"portraitOrientation",type:ps}]},i(Bs,ks=ir),Bs.prototype._getAssignableProperties=function(){return[{name:"timeout",type:fs},{name:"allowUnawaitedPromise",type:ps}]};var zs=c.eventSandbox.message,js="driver|browser-manipulation|request",Xs="driver|browser-manipulation|response";zs.on(zs.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===js&&(t=y.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new Ws({crop:i,includePaddings:!1})),(o=new qs(r)).element=t,o.execute().then(function(t){return zs.sendServiceMsg({cmd:Xs,result:t},e.source)}))});var qs=(Ys.prototype._getAbsoluteCropValues=function(){var t=this.element.getBoundingClientRect(),e=t.top,n=t.left;n+=this.command.options.originOffset.x,e+=this.command.options.originOffset.y;var r=n+this.command.options.crop.right,i=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:i,right:r}},Ys.prototype._createManipulationReadyMessage=function(){var t=Ya.devicePixelRatio||1,e={cmd:h.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:Ya.innerWidth,innerHeight:Ya.innerHeight,documentWidth:Ka.documentElement.clientWidth,documentHeight:Ka.documentElement.clientHeight,bodyWidth:Ka.body.clientWidth,bodyHeight:Ka.body.clientHeight},disableResending:!0};return this.command.type===f.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},Ys.prototype._runScrollBeforeScreenshot=function(){var i=this;return c.Promise.resolve().then(function(){if(i.element||!i.command.selector)return c.Promise.resolve();var t=i.command.selector.timeout,e="number"==typeof t?t:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(e),Jo([$o(i.command.selector)],i.globalSelectorTimeout).then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){!function(t,e){var n=t.getBoundingClientRect(),r={left:n.left,right:n.right,top:n.top,bottom:n.bottom},i=y.styleUtils.getElementMargin(t),o=y.styleUtils.getElementPadding(t),s=y.styleUtils.getBordersWidth(t);e.originOffset={x:0,y:0};var a=r.left+t.scrollWidth+s.left+s.right,c=r.top+t.scrollHeight+s.top+s.bottom;r.right=Math.max(r.right,a),r.bottom=Math.max(r.bottom,c),e.includeBorders&&e.includePaddings?e.includeMargins&&(e.originOffset.x-=i.left,e.originOffset.y-=i.top,r.left-=i.left,r.top-=i.top,r.right+=i.right,r.bottom+=i.bottom):(e.originOffset.x+=s.left,e.originOffset.y+=s.top,r.left+=s.left,r.top+=s.top,r.right-=s.right,r.bottom-=s.bottom,e.includePaddings||(e.originOffset.x+=o.left,e.originOffset.y+=o.top,r.left+=o.left,r.top+=o.top,r.right-=o.right,r.bottom-=o.bottom)),r.width=r.right-r.left,r.height=r.bottom-r.top;var l=is({min:e.crop.left,max:e.crop.right,length:e.crop.width},r.width),u=is({min:e.crop.top,max:e.crop.bottom,length:e.crop.height},r.height);if(e.crop.left=l.min,e.crop.right=l.max,e.crop.width=l.length,e.crop.top=u.min,e.crop.bottom=u.max,e.crop.height=u.length,e.crop.width<=0||e.crop.height<=0)throw new qe(e.crop.width,e.crop.height);var d=y.styleUtils.getViewportDimensions();(r.width>d.width||r.height>d.height)&&(e.scrollToCenter=!0);var h="number"==typeof e.scrollTargetX,f="number"==typeof e.scrollTargetY;h||(e.scrollTargetX=os(e.crop.left,e.crop.right,d.width)),f||(e.scrollTargetY=os(e.crop.top,e.crop.bottom,d.height));var p=_.getOffsetOptions(t,e.scrollTargetX,e.scrollTargetY),m=p.offsetX,g=p.offsetY;e.scrollTargetX=m,e.scrollTargetY=g;var w=!h||e.scrollTargetX>=e.crop.left&&e.scrollTargetX<=e.crop.right,v=!f||e.scrollTargetY>=e.crop.top&&e.scrollTargetY<=e.crop.bottom;if(!w||!v)throw new ze(w,v)}(i.element,i.command.options);var t=i.command.options,e=t.scrollTargetX,n=t.scrollTargetY,r=t.scrollToCenter;return new _.Scroll(i.element,new Is({offsetX:e,offsetY:n,scrollToCenter:r,skipParentFrames:!0})).run()})},Ys.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),y.delay(500)},Ys.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},Ys.prototype._requestManipulation=function(){if(!Vs(Ya))return c.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return y.sendRequestToFrame({cmd:js,command:this.command,cropDimensions:t},Xs,Ya.parent).then(function(t){if(!t.result)return{result:null};var e=t.result,n=e.result,r=e.executionError;if(r)throw r;return{result:n}})},Ys.prototype._runManipulation=function(){var r=this,i=null;return c.Promise.resolve().then(function(){return r.command.type!==f.takeElementScreenshot?c.Promise.resolve():(y.scrollController.stopPropagation(),r._runScrollBeforeScreenshot())}).then(function(){return Vs(Ya)?c.Promise.resolve():r._hideUI()}).then(function(){return r._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return y.scrollController.enablePropagation(),i=e,Vs(Ya)||r._showUI(),y.delay(200)}).then(function(){return new cr({isCommandResult:!0,result:i})}).catch(function(t){return y.scrollController.enablePropagation(),new cr({isCommandResult:!0,executionError:t})})},Ys.prototype.execute=function(){var t=this;return Wo(function(){return t._runManipulation()}).barriersPromise},Ys);function Ys(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}var Ks=o.Promise,Js=($s.prototype.setAsMaster=function(t){return go(new Yi(t),this.driverWindow,wo,hn)},$s.prototype.closeAllChildWindows=function(){return go(new $i,this.driverWindow,wo,mn)},$s.prototype.findChildWindows=function(t,e){return go(new e(t),this.driverWindow,wo,hn)},$s.prototype.startToRestore=function(){return go(new to,this.driverWindow,wo,hn)},$s);function $s(t,e){this.driverWindow=t,this.windowId=e}var Qs=(Zs.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},Zs.prototype._setAsMaster=function(t,e){return go(new Yi(e),t,wo,hn)},Zs.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},Zs.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},Zs.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},Zs.prototype.restoreChild=function(r){return s(this,void 0,void 0,function(){var e,n;return l(this,function(t){return e=new ro(r),n=this.currentDriverWindow.opener,go(e,n,wo,hn),[2]})})},Zs);function Zs(t){this.currentDriverWindow=t}var ta,ea="master",na="replica",ra=o.settings,ia=o.transport,oa=o.Promise,sa=o.eventSandbox.message,aa=o.storages,ca=o.nativeMethods,la=ca.date,ua=o.eventSandbox.listeners,da="testcafe|driver|test-done-sent-flag",ha="testcafe|driver|pending-status",fa="testcafe|driver|executing-client-function-descriptor",pa="testcafe|driver|selector-execution-start-time",ma="testcafe|driver|pending-page-error",ga="testcafe|driver|active-iframe-selector",wa="testcafe|driver|test-speed",va="testcafe|driver|assertion-retries-timeout",ya="testcafe|driver|assertion-retries-start-time",_a="testcafe|driver|console-messages",Ca="testcafe|driver|pending-child-window-count",Ia={NotLoadedError:Ze,NotFoundError:oe,IsInvisibleError:ce},Ea={NotLoadedError:nn,NotFoundError:Hn,IsInvisibleError:zn},Sa=Math.pow(2,31)-1,Wa="status-with-command-result-event",Ta="empty-command-event",ba="child-window-closed",xa=(i(Da,ta=y.serviceUtils.EventEmitter),Da.prototype._isOpenedInIframe=function(){var t=Ya.opener;return t&&t.top&&t.top!==t},Object.defineProperty(Da.prototype,"speed",{get:function(){return this.contextStorage.getItem(wa)},set:function(t){this.contextStorage.setItem(wa,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Da.prototype,"consoleMessages",{get:function(){return new nr(this.contextStorage.getItem(_a))},set:function(t){return this.contextStorage.setItem(_a,t?t.getCopy():null)},enumerable:!1,configurable:!0}),Da.prototype._getReadyPromise=function(){return s(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,y.eventUtils.documentReady(this.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},Da.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},Da.prototype._getCurrentWindowId=function(){var t=Ya.location.toString(),e=o.utils.url.parseProxyUrl(t);return e&&e.windowId||null},Da.prototype._onJsError=function(t){if(this.skipJsErrors||this.contextStorage.getItem(da))return oa.resolve();var e=new Pt(t.stack,t.pageUrl);return this.contextStorage.getItem(ma)||this.contextStorage.setItem(ma,e),null},Da.prototype._unlockPageAfterTestIsDone=function(){return y.disableRealEventsPreventing(),oa.resolve()},Da.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(fa);return!!t&&(this._onReady(new cr({isCommandResult:!0,executionError:new wt(t.instantiationCallsiteName)})),!0)},Da.prototype.onCustomClientScriptError=function(t,e){var n=e?new zt(t,e):new Ht(t);this.contextStorage.getItem(ma)||this.contextStorage.setItem(ma,n)},Da.prototype._addChildWindowDriverLink=function(t){var e=new Js(t.window,t.windowId);this.childWindowDriverLinks.push(e),this._ensureClosedChildWindowWatcher()},Da.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=ca.setInterval.call(Ya,function(){var t=y.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(ba),y.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(ca.clearInterval.call(Ya,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},Da.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===ea},Da.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),oa.resolve().then(function(){return y.browser.setActiveWindowId(t.browserActiveWindowId,o.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new cr({isCommandResult:!0,executionError:new hn}))}))},Da.prototype._onChildWindowOpened=function(t){this._addChildWindowDriverLink(t),this._switchToChildWindow(t.windowId)},Da.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(Ca,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},Da.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(da)&&(t.preventSubmit=!0)},Da.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,r=this.consoleMessages;r.addMessage(e,n,this.windowId),this.consoleMessages=r},Da.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(ma);e&&(this.contextStorage.setItem(ma,null),t.pageError=e)},Da.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},Da.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},Da.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},Da.prototype._sendStatusRequest=function(t){function e(){return y.getTimeLimitedPromise(ia.asyncServiceMsg(r),5e3)}function n(){return y.delay(300).then(e)}for(var r={cmd:h.ready,status:t,disableResending:!0,allowRejecting:!0},i=e(),o=0;o<d;o++)i=i.catch(n);return i},Da.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem(ha,t);var n=null;return y.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,y.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem(ha,null),n})},Da.prototype._addChildIframeDriverLink=function(t,e){var n,r=this._getChildIframeDriverLinkByWindow(e);r||(n=this.testRunId+"-"+sr(),r=new yo(e,n),this.childIframeDriverLinks.push(r)),r.sendConfirmationMessage(t)},Da.prototype._getTargetWindowNotFoundResult=function(t,e){return oa.resolve({success:!1,errCode:t,errMsg:e})},Da.prototype._getChildWindowValidateResult=function(t){var e=t.find(function(t){return t.result.success});if(e)return e.result;var n=t.find(function(t){return t.result.errCode===nt||t.result.errCode===at});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},Da.prototype._handleWindowValidation=function(n,r,i,o){return s(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,r,i,o)];case 1:return e=t.sent(),vo({requestMsgId:n.id,window:r,result:e}),[2]}})})},Da.prototype._getWindowInfo=function(){var t=o.utils.url.parseProxyUrl(Ya.location.toString());return{id:this.windowId,title:Ka.title,url:t.destUrl}},Da.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},Da.prototype._validateWindow=function(r,t,i,o){return s(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return this._isTargetWindow(r)?[2,i()]:this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(r,o)}),[4,oa.all(e)]):[2,this._getTargetWindowNotFoundResult(rt)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},Da._createWindowValidationError=function(t){var e=t.errCode;return new(e===nt?vn:e===at?In:Tn)},Da.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?oa.resolve({success:!1,errCode:nt}):oa.resolve({success:!0}):oa.resolve({success:!1,errCode:at})},Da.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},Ci)},Da.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return oa.resolve({success:!0})},Si)},Da.prototype._handleCloseWindow=function(e,n){return s(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),vo({requestMsgId:e.id,window:n}),[2]}})})},Da.prototype._closeWindowAndWait=function(t,e){var n=this._createWaitForEventPromise(ba,2e3);return t.ignoreMasterSwitching=!e.isCurrentWindow,t.driverWindow.close(),n},Da.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return oa.resolve();var t=this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId});if(t)return this._closeWindowAndWait(t,e);var n=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Ai)});return oa.all(n)},Da.prototype._getWindows=function(){return s(this,void 0,void 0,function(){var e,n,r,i,o,s;return l(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},bi)}),[4,oa.all(e)]):[2,[this._getWindowInfo()]];case 1:for(n=t.sent(),r=[this._getWindowInfo()],i=0,o=n;i<o.length;i++)s=o[i],Array.isArray(s.result)&&(r=r.concat(s.result));return[2,r]}})})},Da.prototype._handleGetWindows=function(n,r){return s(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,r)];case 1:return e=t.sent(),vo({requestMsgId:n.id,window:r,result:e}),[2]}})})},Da.prototype._handleSwitchToWindow=function(e,n){return s(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),vo({requestMsgId:e.id,window:n}),[2]}})})},Da.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?oa.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?oa.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Mi)})):oa.resolve()},Da.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,vo({requestMsgId:t.id,window:e}),oa.resolve().then(function(){return y.browser.setActiveWindowId(n.browserActiveWindowId,o.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new hn}))}))},Da.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){vo({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new mn}))})},Da.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},Da.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink({window:e,windowId:t.windowId}),this.childWindowDriverLinks.length===this.contextStorage.getItem(Ca)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(Ca,0)),vo({requestMsgId:t.id,window:e}))},Da.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new oa(function(t){e._resolvePendingChildWindowInIframe=t})},Da.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){vo({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId})},Da.prototype._initChildDriverListening=function(){var r=this;sa.on(sa.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case ni:r._addChildIframeDriverLink(e.id,n);break;case wi:r._handleChildWindowIsOpenedInIFrame(e,n);break;case gi:r._handleChildWindowIsLoadedInIFrame(e,n);break;case hi:r._handleSetAsMasterMessage(e,n);break;case ri:r._handleSwitchToWindow(e,n);break;case ii:r._handleCloseWindow(e,n);break;case si:r._handleSwitchToWindowValidation(e,n);break;case oi:r._handleCloseWindowValidation(e,n);break;case ai:r._handleGetWindows(e,n);break;case fi:r._handleCloseAllWindowsMessage(e,n);break;case pi:r._handleStartToRestoreChildLinkMessage();break;case mi:r._handleRestoreChildLink(e,n)}})},Da.prototype._getChildIframeDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},Da.prototype._getChildWindowDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},Da.prototype._runInActiveIframe=function(t){var e=this,n=oa.resolve(),r=this.contextStorage.getItem(ga);!this.activeChildIframeDriverLink&&r&&(n=this._switchToIframe(r,Ea)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new cr({isCommandResult:!0,executionError:t}))})},Da.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=oa.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},Da.prototype._ensureChildIframeDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},Da.prototype._ensureChildWindowDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},Da.prototype._switchToIframe=function(e,n){var t,r,i,o,s,a,c,l=this,u="number"==typeof e.timeout?e.timeout:this.selectorTimeout;return t=e,r=u,i=null,o=function(t){return new n.NotFoundError(t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,c=new jo(t,r,i,o,s),a.showWaitingElementStatus(c.timeout),c.getResult().then(function(t){return a.hideWaitingElementStatus(!!t).then(function(){return t})}).catch(function(t){return a.hideWaitingElementStatus(!1).then(function(){throw t})}).then(function(t){if(!y.domUtils.isIframeElement(t))throw new Je;return l._ensureChildIframeDriverLink(ca.contentWindowGetter.call(t),n.NotLoadedError,u)}).then(function(t){t.availabilityTimeout=u,l.activeChildIframeDriverLink=t,l.contextStorage.setItem(ga,e)})},Da.prototype._createWaitForEventPromise=function(e,n){var r=this,i=null,t=new oa(function(t){ca.setTimeout.call(Ya,function(){r.off(e,i),t()},n)}),o=new oa(function(t){i=function(){this.off(e,i),t()},r.on(e,i)});return oa.race([t,o])},Da.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(Wa,Sa):oa.resolve()},Da.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(Ta,3e4)},Da.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw y.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new kn},Da.prototype._switchToChildWindow=function(t){var e=this;this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0);var n=this.contextStorage.getItem(this.WINDOW_COMMAND_API_CALL_FLAG);return function(e,t){if("string"!=typeof e)return Ks.resolve(null);var n=y.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return Ks.resolve(n);var r=new sn;return Ks.reject(r)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,ln,e.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return e._abortSwitchingToChildWindowIfItClosed(),e._stopInternal(),e.activeChildWindowDriverLink.setAsMaster(n)}).then(function(){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(t){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1),t instanceof kn?e._onReady(new cr):e._onReady(new cr({isCommandResult:!0,executionError:new hn}))})},Da.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},Da.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},Da.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),oa.resolve().then(function(){return n._stopInternal(),t(e)}).then(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1),n._onReady(new cr({isCommandResult:!0,executionError:new hn}))})},Da.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},Da.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(ga,null),this.activeChildIframeDriverLink=null},Da.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new ji(t),n=0;n<this.childIframeDriverLinks.length;n++)sa.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},Da.prototype._onActionCommand=function(t){var e,n,r,i,o=this,s=(e=t,n=this.selectorTimeout,r=this.statusBar,i=this.speed,new es(e,n,r,i).execute()),a=s.startPromise,c=s.completionPromise;a.then(function(){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),c.then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o._onReady(t)})},Da.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new cr({isCommandResult:!0}))},Da.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new cr({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},Da.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new cr({isCommandResult:!0}))},Da.prototype._onNavigateToCommand=function(t){var e=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),function(r){return s(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new y.RequestBarrier,c.navigateTo(r.url,r.forceReload),[4,c.Promise.all([e.wait(),y.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new cr({isCommandResult:!0})];case 2:return n=t.sent(),[2,new cr({isCommandResult:!0,executionError:n})];case 3:return[2]}})})}(t).then(function(t){return e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e._onReady(t)})},Da.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(fa,{instantiationCallsiteName:t.instantiationCallsiteName}),new Gr(t).getResultDriverStatus().then(function(t){e.contextStorage.setItem(fa,null),e._onReady(t)})},Da.prototype._onExecuteSelectorCommand=function(t){var e,n,r,i,o,s,a,c=this,l=this.contextStorage.getItem(pa)||new la,u=t.needError?function(t){return new Dt(null,t)}:null;e=t,n=this.selectorTimeout,r=l,o=i=u,s=this.statusBar,a=new jo(e,n,r,i,o),s.showWaitingElementStatus(a.timeout),a.getResultDriverStatus().then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){c.contextStorage.setItem(pa,null),c._onReady(t)})},Da.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new cr({isCommandResult:!0}))},Da.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,Ia).then(function(){return e._onReady(new cr({isCommandResult:!0}))}).catch(function(t){return e._onReady(new cr({isCommandResult:!0,executionError:t}))})},Da.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),Ya.open(t.url)},Da.prototype._onWindowCloseCommand=function(a){return s(this,void 0,void 0,function(){var e,n,r,i,o,s;return l(this,function(t){switch(t.label){case 0:e=this._getTopOpenedWindow(),n=a.windowId||this.windowId,r=n===this.windowId,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this._validateChildWindowCloseCommandExists(n,e)];case 2:if(i=t.sent(),!(o=i.result).success)throw Da._createWindowValidationError(o);return[4,go(new Ai({windowId:n,isCurrentWindow:r}),e,wo,hn)];case 3:return t.sent(),r||this._onReady(new cr({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},Da.prototype._onGetCurrentWindowCommand=function(){this._onReady(new cr({isCommandResult:!0,result:{id:this.windowId}}))},Da.prototype._onGetWindowsCommand=function(){return s(this,void 0,void 0,function(){var e,n;return l(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,go(new bi,e,wo,hn)];case 1:return n=t.sent(),this._onReady(new cr({isCommandResult:!0,result:n.result})),[2]}})})},Da.prototype._validateChildWindowCloseCommandExists=function(t,e){return go(new Ci({windowId:t}),e,wo,hn)},Da.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,r=t.fn;return go(new Si({windowId:n,fn:r}),e,wo,hn)},Da.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||Ya).top},Da.prototype._onSwitchToWindow=function(i,o){return s(this,void 0,void 0,function(){var e,n,r;return l(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:i.windowId,fn:i.findWindow},e)];case 1:return n=t.sent(),(r=n.result).success?(this._stopInternal(),go(new Mi({windowId:i.windowId,fn:i.findWindow}),e,wo,hn)):this._onReady(new cr({isCommandResult:!0,executionError:o||Da._createWindowValidationError(r)})),[2]}})})},Da.prototype._restoreChildWindowLinks=function(){return s(this,void 0,void 0,function(){var e,n=this;return l(this,function(t){switch(t.label){case 0:if(!this.contextStorage.getItem(Ca))return[2];e=new oa(function(t){n._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,y.getTimeLimitedPromise(e,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:new On})),[3,4];case 4:return[2]}})})},Da.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Pn)},Da.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new cr({isCommandResult:!0,executionError:new Dn}))},Da.prototype._onBrowserManipulationCommand=function(t){var e,n,r,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.selectorTimeout,r=this.statusBar,new qs(e,n,r).execute().then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},Da.prototype._onSetBreakpointCommand=function(t){var e=this;this.statusBar.showDebuggingStatus(t).then(function(t){return e._onReady(new cr({isCommandResult:!0,result:t}))})},Da.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new cr({isCommandResult:!0}))},Da.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem(va,t.timeout),this.contextStorage.setItem(ya,ca.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new cr({isCommandResult:!0}))},Da.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem(va,null),this.contextStorage.setItem(ya,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new cr({isCommandResult:!0}))})},Da.prototype._checkStatus=function(){var r=this;return y.browser.checkStatus(this.browserStatusDoneUrl,o.createNativeXHR,{manualRedirect:!0}).then(function(t){var e=t.command,n=t.redirecting;n&&e.url.indexOf(r.testRunId)<0?(aa.clear(),aa.lock()):r.contextStorage.setItem(da,!1),n?y.browser.redirect(e):r._onReady({isCommandResult:!1})}).catch(function(){return y.delay(1e3)})},Da.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new cr({isCommandResult:!0,result:t}))})},Da.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?oa.all(this.childWindowDriverLinks.map(function(t){return t.closeAllChildWindows()})).then(function(){ca.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):oa.resolve()},Da.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(da,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new cr({isCommandResult:!0,executionError:mn}))})},Da.prototype._onBackupStoragesCommand=function(){this._onReady(new cr({isCommandResult:!0,result:aa.backup()}))},Da.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},Da.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},Da.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(Wa),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(Ta);e._onReady(new cr)}})},Da.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===f.testDone?this._onTestDone(new cr({isCommandResult:!0})):t.type===f.setBreakpoint?this._onSetBreakpointCommand(t.isTestError):t.type===f.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===f.switchToIframe?this._onSwitchToIframeCommand(t):t.type===f.openWindow?this._onWindowOpenCommand(t):t.type===f.closeWindow?this._onWindowCloseCommand(t):t.type===f.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===f.getCurrentWindows?this._onGetWindowsCommand():t.type===f.switchToWindow?this._onSwitchToWindow(t):t.type===f.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===f.switchToParentWindow?this._onSwitchToParentWindow():dt(t)?this._onBrowserManipulationCommand(t):t.type===f.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===f.executeSelector?this._onExecuteSelectorCommand(t):t.type===f.navigateTo?this._onNavigateToCommand(t):t.type===f.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===f.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===f.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===f.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===f.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===f.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===f.backupStorages?this._onBackupStoragesCommand():this._onActionCommand(t)},Da.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===f.testDone||e.type===f.switchToMainWindow||e.type===f.setNativeDialogHandler||e.type===f.getNativeDialogHistory||e.type===f.setTestSpeed||e.type===f.showAssertionRetriesStatus||e.type===f.hideAssertionRetriesStatus||e.type===f.setBreakpoint||dt(e)&&e.type!==f.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},Da.prototype._onCommand=function(n){var r=this;this.readyPromise.then(function(){var t,e=lt(n);r.contextStorage.getItem(ma)&&e?r._onReady(new cr({isCommandResult:!0})):(t=r.activeChildIframeDriverLink||r.contextStorage.getItem(ga),r._isExecutableInTopWindowOnly(n)||!t?r._executeCommand(n):r._runInActiveIframe(n))})},Da.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},Da.prototype._startInternal=function(t){this.role=ea,y.browser.startHeartbeat(this.heartbeatUrl,o.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},Da.prototype._stopInternal=function(){this.role=na,y.browser.stopHeartbeat(),_.cursor.hide()},Da.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem(va);e&&(t=n.contextStorage.getItem(ya),0<e-(new la-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},Da.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,r=this.contextStorage.getItem(ha);r&&(r.resent=!0),this.contextStorage.getItem(da)?r?this._onTestDone(r):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=r||new cr({isCommandResult:e,isFirstRequestAfterWindowSwitching:t.isFirstRequestAfterWindowSwitching,result:t.result}),this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!1),this._onReady(n))},Da.prototype._initParentWindowLink=function(){Ya.opener&&Ya.opener!==Ya&&this.windowId&&(this.parentWindowDriverLink=new Qs(Ya))},Da.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},Da.prototype._getDriverRole=function(){return s(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return this.windowId?[4,y.browser.getActiveWindowId(this.browserActiveWindowId,o.createNativeXHR)]:[2,ea];case 1:return[2,t.sent().activeWindowId===this.windowId?ea:na]}})})},Da.prototype._init=function(){this.contextStorage=new po(Ya,this.testRunId,this.windowId),this.nativeDialogsTracker=new Qr(this.contextStorage,this.dialogHandler),this.statusBar=new n.StatusBar(this.userAgent,this.fixtureName,this.testName,this.contextStorage),this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,y.disableRealEventsPreventing),this.speed=this.initialSpeed,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&go(new so(this.windowId),Ya.opener.top,wo,Tn)},Da.prototype._doFirstPageLoadSetup=function(){return s(this,void 0,void 0,function(){return l(this,function(t){return this.isFirstPageLoad&&this.canUseDefaultWindowActions,[2]})})},Da.prototype.start=function(){return s(this,void 0,void 0,function(){var e;return l(this,function(t){switch(t.label){case 0:return this._init(),[4,this._doFirstPageLoadSetup()];case 1:return t.sent(),[4,this._restoreChildWindowLinks()];case 2:return t.sent(),[4,this._getDriverRole()];case 3:return e=t.sent(),this.role===ea||e===ea&&this._startInternal(),[2]}})})},Da);function Da(t,e,n,r){var i=ta.call(this)||this;return i.COMMAND_EXECUTING_FLAG="testcafe|driver|command-executing-flag",i.EXECUTING_IN_IFRAME_FLAG="testcafe|driver|executing-in-iframe-flag",i.PENDING_WINDOW_SWITCHING_FLAG="testcafe|driver|pending-window-switching-flag",i.WINDOW_COMMAND_API_CALL_FLAG="testcafe|driver|window-command-api-flag",i.testRunId=t,i.heartbeatUrl=e.heartbeat,i.browserStatusUrl=e.status,i.browserStatusDoneUrl=e.statusDone,i.browserActiveWindowId=e.activeWindowId,i.userAgent=n.userAgent,i.fixtureName=n.fixtureName,i.testName=n.testName,i.selectorTimeout=r.selectorTimeout,i.pageLoadTimeout=r.pageLoadTimeout,i.childWindowReadyTimeout=r.childWindowReadyTimeout,i.initialSpeed=r.speed,i.skipJsErrors=r.skipJsErrors,i.dialogHandler=r.dialogHandler,i.canUseDefaultWindowActions=r.canUseDefaultWindowActions,i.isFirstPageLoad=ra.get().isFirstPageLoad,i.customCommandHandlers={},i.contextStorage=null,i.nativeDialogsTracker=null,i.childIframeDriverLinks=[],i.activeChildIframeDriverLink=null,i.childWindowDriverLinks=[],i.parentWindowDriverLink=null,i.statusBar=null,i.windowId=i._getCurrentWindowId(),i.role=na,i.setAsMasterInProgress=!1,i.checkClosedChildWindowIntervalId=null,i.pageInitialRequestBarrier=new y.RequestBarrier,i.readyPromise=i._getReadyPromise(),i._initChildDriverListening(),y.pageUnloadBarrier.init(),y.preventRealEvents(),o.on(o.EVENTS.uncaughtJsError,function(t){return i._onJsError(t)}),o.on(o.EVENTS.unhandledRejection,function(t){return i._onJsError(t)}),o.on(o.EVENTS.consoleMethCalled,function(t){return i._onConsoleMessage(t)}),o.on(o.EVENTS.beforeFormSubmit,function(t){return i._onFormSubmit(t)}),o.on(o.EVENTS.windowOpened,function(t){return i._onChildWindowOpened(t)}),i.setCustomCommandHandlers(f.unlockPage,function(){return i._unlockPageAfterTestIsDone()}),ua.addInternalEventBeforeListener(Ya,["beforeunload"],function(){i._sendStartToRestoreCommand()}),i}var Aa=(Ra.prototype.establishConnection=function(){return go(new vi,this.driverWindow,5e3,nn).then(function(t){return t.result.id})},Ra.prototype.sendConfirmationMessage=function(t){vo({requestMsgId:t,window:this.driverWindow})},Ra.prototype.onCommandExecuted=function(t){var e=new Li(t);c.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},Ra);function Ra(t){this.driverWindow=t}var Pa,Ma=o.eventSandbox.message,Na=(i(ka,Pa=Qr),ka.prototype._defaultDialogHandler=function(t){Ma.sendServiceMsg({type:Vr,dialogType:t,url:Qr._getPageUrl()},Ya.top)},ka.prototype._addAppearedDialogs=function(t,e){Ma.sendServiceMsg({type:Br,dialogType:t,text:e,url:Qr._getPageUrl()},Ya.top)},ka.prototype._onHandlerError=function(t,e){Ma.sendServiceMsg({type:zr,dialogType:t,message:e,url:Qr._getPageUrl()},Ya.top)},ka);function ka(t){return Pa.call(this,null,t)||this}var La,Fa=c.eventSandbox.message,Oa=(i(Ua,La=xa),Ua.prototype._onJsError=function(){},Ua.prototype._onConsoleMessage=function(){},Ua.prototype._onChildWindowOpened=function(){Fa.sendServiceMsg(new lo,Ya.top)},Ua.prototype._initParentDriverListening=function(){var n=this;c.eventSandbox.message.on(c.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;y.pageUnloadBarrier.wait(0).then(function(){if(e.type===li){if(n.lastParentDriverMessageId===e.id)return;n.lastParentDriverMessageId=e.id,n.readyPromise.then(function(){n.speed=e.testSpeed,n.parentDriverLink.sendConfirmationMessage(e.id),n._onCommand(e.command)})}e.type===di&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},Ua.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},Ua.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},Ua.prototype.start=function(){var e=this;this.nativeDialogsTracker=new Na(this.dialogHandler),this.statusBar=new n.IframeStatusBar;var t=this.parentDriverLink.establishConnection().then(function(t){e.contextStorage=new po(Ya,t,e.windowId),e._failIfClientCodeExecutionIsInterrupted()||(e.contextStorage.getItem(e.COMMAND_EXECUTING_FLAG)||e.contextStorage.getItem(e.EXECUTING_IN_IFRAME_FLAG))&&(e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!1),e._onReady(new cr({isCommandResult:!0})))});this.readyPromise=c.Promise.all([this.readyPromise,t])},Ua);function Ua(t,e){var n=La.call(this,t,{},{},e)||this;return n.lastParentDriverMessageId=null,n.parentDriverLink=new Aa(Ya.parent),n._initParentDriverListening(),n}var Ga={NodeSnapshot:_r,ElementSnapshot:br,SelectorExecutor:jo},Ha="%testCafeDriver%",Ba="%testCafeIframeDriver%",Va="%ScriptExecutionBarrier%",za="%testCafeEmbeddingUtils%",ja=o.nativeMethods,Xa=o.EVENTS.evalIframeScript;ja.objectDefineProperty(Ya,Ha,{configurable:!0,value:xa}),ja.objectDefineProperty(Ya,Ba,{configurable:!0,value:Oa}),ja.objectDefineProperty(Ya,Va,{configurable:!0,value:Eo}),ja.objectDefineProperty(Ya,za,{configurable:!0,value:Ga}),o.on(Xa,function(t){return qa(ja.contentWindowGetter.call(t.iframe))})}(Ya["%hammerhead%"],Ya["%hammerhead%"].Promise,Ya["%testCafeCore%"],Ya["%testCafeAutomation%"],Ya["%testCafeUI%"])}(window);
|
|
1
|
+
window["%hammerhead%"].utils.removeInjectedScript(),function Dc(Rc){var Nc=Rc.document;!function(l,e,y,_,n){var o="default"in l?l.default:l;e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var t="default"in y?y.default:y,i="default"in n?n.default:n,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function c(t,s,a,l){return new(a=a||e)(function(n,e){function r(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((l=l.apply(t,s||[])).next())})}function u(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var a,d,h=Math.floor(399);(d=a=a||{}).ready="ready",d.readyForBrowserManipulation="ready-for-browser-manipulation",d.waitForFileDownload="wait-for-file-download";var f=a,m={dispatchEvent:"dispatch-event",click:"click",rightClick:"right-click",doubleClick:"double-click",drag:"drag",dragToElement:"drag-to-element",hover:"hover",scroll:"scroll",scrollBy:"scroll-by",scrollIntoView:"scroll-into-view",typeText:"type-text",selectText:"select-text",selectTextAreaContent:"select-text-area-content",selectEditableContent:"select-editable-content",pressKey:"press-key",wait:"wait",navigateTo:"navigate-to",setFilesToUpload:"set-files-to-upload",clearUpload:"clear-upload",executeClientFunction:"execute-client-function",executeSelector:"execute-selector",takeScreenshot:"take-screenshot",takeElementScreenshot:"take-element-screenshot",takeScreenshotOnFail:"take-screenshot-on-fail",prepareBrowserManipulation:"prepare-browser-manipulation",showAssertionRetriesStatus:"show-assertion-retries-status",hideAssertionRetriesStatus:"hide-assertion-retries-status",setBreakpoint:"set-breakpoint",resizeWindow:"resize-window",resizeWindowToFitDevice:"resize-window-to-fit-device",maximizeWindow:"maximize-window",switchToIframe:"switch-to-iframe",switchToMainWindow:"switch-to-main-window",openWindow:"open-window",closeWindow:"close-window",getCurrentWindow:"get-current-window",getCurrentWindows:"get-current-windows",switchToWindow:"switch-to-window",switchToWindowByPredicate:"switch-to-window-by-predicate",switchToParentWindow:"switch-to-parent-window",switchToPreviousWindow:"switch-to-previous-window",setNativeDialogHandler:"set-native-dialog-handler",getNativeDialogHistory:"get-native-dialog-history",getBrowserConsoleMessages:"get-browser-console-messages",getActiveElement:"get-active-element",setTestSpeed:"set-test-speed",setPageLoadTimeout:"set-page-load-timeout",debug:"debug",assertion:"assertion",useRole:"useRole",testDone:"test-done",backupStorages:"backup-storages",executeExpression:"execute-expression",executeAsyncExpression:"execute-async-expression",unlockPage:"unlock-page",recorder:"recorder"},p="E1",g="E4",v="E5",w="E9",E="E10",C="E11",S="E12",I="E24",T="E26",x="E27",b="E28",W="E29",M="E30",P="E31",A="E32",D="E33",R="E34",N="E35",k="E36",F="E37",L="E39",U="E40",O="E41",B="E42",H="E43",G="E44",V="E45",X="E46",Y="E49",z="E50",j="E51",q="E52",K="E57",J="E64",$="E65",Q="E68",Z="E69",tt="E70",et="E71",nt="E72",rt="E73",it="E74",ot="E76",st="E77",at="E78",lt="E82",ct="E83";function ut(t){return!(function(t){return t.type===m.executeClientFunction||t.type===m.executeSelector}(r=t)||r.type===m.wait||r.type===m.assertion||r.type===m.executeExpression||ht(t)||(n=t).type===m.testDone||n.type===m.showAssertionRetriesStatus||n.type===m.hideAssertionRetriesStatus||n.type===m.setBreakpoint||n.type===m.takeScreenshotOnFail||n.type===m.recorder)||dt(t)&&!((e=t).type===m.switchToIframe||e.type===m.switchToMainWindow);var e,n,r}function dt(t){return t.type===m.resizeWindow||t.type===m.resizeWindowToFitDevice||t.type===m.maximizeWindow}function ht(t){return(e=t).type===m.takeScreenshot||e.type===m.takeElementScreenshot||e.type===m.takeScreenshotOnFail||dt(t);var e}function ft(t){this.code=t,this.isTestCafeError=!0,this.callsite=null}var mt,pt=(s(gt,mt=ft),gt);function gt(t,e,n){var r=mt.call(this,t)||this;return r.optionName=e,r.actualValue=n,r}var vt,wt=(s(yt,vt=ft),yt);function yt(t){var e=vt.call(this,Y)||this;return e.instantiationCallsiteName=t,e}var _t,Et=(s(Ct,_t=ft),Ct);function Ct(t){var e=_t.call(this,z)||this;return e.instantiationCallsiteName=t,e}var St,It=(s(Tt,St=ft),Tt);function Tt(t,e){var n=e.apiFnChain,r=e.apiFnIndex,i=St.call(this,t)||this;return i.apiFnChain=n,i.apiFnIndex=r,i}var xt,bt=(s(Wt,xt=ft),Wt);function Wt(){return xt.call(this,j)||this}var Mt,Pt=(s(At,Mt=It),At);function At(t,e){var n=Mt.call(this,q,e)||this;return n.callsite=t,n}var Dt,Rt=(s(Nt,Dt=ft),Nt);function Nt(t,e){var n=Dt.call(this,p)||this;return n.errStack=t,n.pageDestUrl=e,n}var kt,Ft=(s(Lt,kt=ft),Lt);function Lt(t,e){var n=kt.call(this,g)||this;return n.errMsg=String(e),n.instantiationCallsiteName=t,n}var Ut,Ot=(s(Bt,Ut=ft),Bt);function Bt(t,e,n){var r=Ut.call(this,v,e,n)||this;return r.errMsg=String(e),r.property=n,r.instantiationCallsiteName=t,r}var Ht,Gt=(s(Vt,Ht=ft),Vt);function Vt(t){var e=Ht.call(this,J)||this;return e.errMsg=String(t),e}var Xt,Yt=(s(zt,Xt=ft),zt);function zt(t,e){var n=Xt.call(this,$)||this;return n.errMsg=String(t),n.moduleName=e,n}var jt,qt=(s(Kt,jt=pt),Kt);function Kt(t,e){return jt.call(this,w,t,e)||this}var Jt,$t=(s(Qt,Jt=pt),Qt);function Qt(t,e){return Jt.call(this,E,t,e)||this}var Zt,te=(s(ee,Zt=pt),ee);function ee(t,e){return Zt.call(this,C,t,e)||this}var ne,re=(s(ie,ne=pt),ie);function ie(t,e){return ne.call(this,S,t,e)||this}var oe,se=(s(ae,oe=It),ae);function ae(t){return oe.call(this,I,t)||this}var le,ce=(s(ue,le=ft),ue);function ue(){return le.call(this,T)||this}var de,he=(s(fe,de=ft),fe);function fe(t){var e=de.call(this,x)||this;return e.nodeDescription=t,e}var me,pe=(s(ge,me=It),ge);function ge(t,e){var n=me.call(this,b,e)||this;return n.argumentName=t,n}var ve,we=(s(ye,ve=ft),ye);function ye(t){var e=ve.call(this,W)||this;return e.argumentName=t,e}var _e,Ee=(s(Ce,_e=ft),Ce);function Ce(t,e){var n=_e.call(this,M)||this;return n.argumentName=t,n.nodeDescription=e,n}var Se,Ie=(s(Te,Se=ft),Te);function Te(){return Se.call(this,P)||this}var xe,be=(s(We,xe=ft),We);function We(){return xe.call(this,A)||this}var Me,Pe=(s(Ae,Me=ft),Ae);function Ae(t){var e=Me.call(this,D)||this;return e.argumentName=t,e}var De,Re=(s(Ne,De=ft),Ne);function Ne(){return De.call(this,N)||this}var ke,Fe=(s(Le,ke=ft),Le);function Le(t){var e=ke.call(this,k)||this;return e.argumentName=t,e}var Ue,Oe=(s(Be,Ue=ft),Be);function Be(t,e){var n=Ue.call(this,F)||this;return n.filePaths=t,n.scannedFilePaths=e,n}var He,Ge=(s(Ve,He=ft),Ve);function Ve(){return He.call(this,R)||this}var Xe,Ye=(s(ze,Xe=ft),ze);function ze(t,e){var n=Xe.call(this,O)||this;return n.properties=t?"scrollTargetY property":e?"scrollTargetX property":"scrollTargetX and scrollTargetY properties",n}var je,qe=(s(Ke,je=ft),Ke);function Ke(t,e){var n=je.call(this,K)||this;return t<=0?e<=0?(n.verb="are",n.dimensions="width and height"):(n.verb="is",n.dimensions="width"):(n.verb="is",n.dimensions="height"),n}var Je,$e=(s(Qe,Je=ft),Qe);function Qe(){return Je.call(this,U)||this}var Ze,tn=(s(en,Ze=ft),en);function en(){return Ze.call(this,L)||this}var nn,rn=(s(on,nn=ft),on);function on(){return nn.call(this,B)||this}var sn,an=(s(ln,sn=ft),ln);function ln(){return sn.call(this,Z)||this}var cn,un=(s(dn,cn=ft),dn);function dn(){return cn.call(this,Q)||this}var hn,fn=(s(mn,hn=ft),mn);function mn(){return hn.call(this,tt)||this}var pn,gn=(s(vn,pn=ft),vn);function vn(){return pn.call(this,et)||this}var wn,yn=(s(_n,wn=ft),_n);function _n(){return wn.call(this,rt)||this}var En,Cn,Sn=(s(In,En=ft),In);function In(){return En.call(this,lt)||this}function Tn(t){var e=Cn.call(this,at)||this;return e.errMsg=t,e}s(Tn,Cn=ft);var xn,bn=(s(Wn,xn=ft),Wn);function Wn(){return xn.call(this,it)||this}var Mn,Pn=(s(An,Mn=ft),An);function An(){return Mn.call(this,ot)||this}var Dn,Rn=(s(Nn,Dn=ft),Nn);function Nn(){return Dn.call(this,st)||this}var kn,Fn=(s(Ln,kn=ft),Ln);function Ln(){return kn.call(this,nt)||this}var Un,On=(s(Bn,Un=ft),Bn);function Bn(){return Un.call(this,ct)||this}var Hn,Gn=(s(Vn,Hn=ft),Vn);function Vn(){return Hn.call(this,H)||this}var Xn,Yn=(s(zn,Xn=ft),zn);function zn(){return Xn.call(this,G)||this}var jn,qn=(s(Kn,jn=ft),Kn);function Kn(t,e){var n=jn.call(this,V)||this;return n.dialogType=t,n.pageUrl=e,n}var Jn,$n=(s(Qn,Jn=ft),Qn);function Qn(t,e,n){var r=Jn.call(this,X)||this;return r.dialogType=t,r.errMsg=e,r.pageUrl=n,r}var Zn="_nativeMethods",tr=(er.prototype._ensureNativeMethods=function(t){return t||{objectKeys:Object.keys,arrayForEach:Array.prototype.forEach,arrayConcat:Array.prototype.concat,arraySlice:Array.prototype.slice,objectDefineProperty:Object.defineProperty}},er.prototype._getWindowIds=function(t){return this[Zn].objectKeys(t)},er.prototype._copyArray=function(t){return this[Zn].arraySlice.call(t)},er.prototype._concatArrays=function(t,e){return this[Zn].arrayConcat.call(t,e)},er.prototype.ensureMessageContainer=function(t){this[t]||(this[t]={log:[],info:[],warn:[],error:[]})},er.prototype.concat=function(e){var n=this;if(!e)return this;var t=this._getWindowIds(e);return this[Zn].arrayForEach.call(t,function(t){n.ensureMessageContainer(t),n[t].log=n._concatArrays(n[t].log,e[t].log),n[t].info=n._concatArrays(n[t].info,e[t].info),n[t].warn=n._concatArrays(n[t].warn,e[t].warn),n[t].error=n._concatArrays(n[t].error,e[t].error)}),this},er.prototype.addMessage=function(t,e,n){this.ensureMessageContainer(n),this[n][t].push(e)},er.prototype.getCopy=function(){var e=this,n={},t=this._getWindowIds(this);return this[Zn].arrayForEach.call(t,function(t){n[t]={log:e._copyArray(e[t].log),info:e._copyArray(e[t].info),warn:e._copyArray(e[t].warn),error:e._copyArray(e[t].error)}}),n},er);function er(t,e){var n=this._ensureNativeMethods(e);n.objectDefineProperty(this,Zn,{value:n}),this.concat(t)}var nr,rr=(s(ir,nr=tr),ir);function ir(t){return nr.call(this,t,l.nativeMethods)||this}var or=(sr.prototype._getAssignableProperties=function(){throw new Error("Not implemented")},sr.prototype._assignFrom=function(t,e,n){if(void 0===n&&(n={}),t)for(var r=this._getAssignableProperties(),i=0;i<r.length;i++){for(var o,s=r[i],a=s.name,l=s.type,c=s.required,u=s.init,d=s.defaultValue,h=a.split("."),f=h.length-1,m=h[f],p=t,g=this,v=0;v<f&&p&&g;v++)p=p[h[v]],g=g[h[v]];g&&"defaultValue"in r[i]&&(g[a]=d),p&&g&&(void 0===(o=p[m])&&!c||(e&&l&&l(a,o),g[m]=u?u(a,o,n):o))}},sr);function sr(){}function ar(){return l.nativeMethods.performanceNow().toString()}var lr,cr=(s(ur,lr=or),ur.prototype._getAssignableProperties=function(){return[{name:"isCommandResult"},{name:"executionError"},{name:"pageError"},{name:"result"},{name:"consoleMessages"},{name:"isPendingWindowSwitching"},{name:"isFirstRequestAfterWindowSwitching"}]},ur);function ur(t){var e=lr.call(this,t)||this;return e.id=ar(),e.isCommandResult=!1,e.executionError=null,e.pageError=null,e.resent=!1,e.result=null,e.consoleMessages=null,e.isPendingWindowSwitching=!1,e.isFirstRequestAfterWindowSwitching=!1,e._assignFrom(t,!0),e}var dr,hr=(function(t){function r(t,e){this.references=t,this.transforms=e,this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}var o=/^#*@(t|r)$/,i=(0,eval)("this"),n="function"==typeof ArrayBuffer,s="function"==typeof Map,a="function"==typeof Set,l=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],c=Array.prototype.slice,e={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}};function u(t,e){this.references=t,this.transformMap=e,this.activeTransformsStack=[],this.visitedRefs=Object.create(null)}r._createRefMark=function(t){var e=Object.create(null);return e["@r"]=t,e},r.prototype._createCircularCandidate=function(t,e,n){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:e,key:n,refIdx:-1})},r.prototype._applyTransform=function(t,e,n,r){var i=Object.create(null),o=r.toSerializable(t);return"object"==typeof o&&this._createCircularCandidate(t,e,n),i["@t"]=r.type,i.data=this._handleValue(o,e,n),i},r.prototype._handleArray=function(t){for(var e=[],n=0;n<t.length;n++)e[n]=this._handleValue(t[n],e,n);return e},r.prototype._handlePlainObject=function(n){var r=this,i=Object.create(null);return Object.getOwnPropertyNames(n).forEach(function(t){var e=o.test(t)?"#"+t:t;i[e]=r._handleValue(n[t],i,e)}),i},r.prototype._handleObject=function(t,e,n){return this._createCircularCandidate(t,e,n),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},r.prototype._ensureCircularReference=function(t){var e=this.circularCandidates.indexOf(t);if(-1<e){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),r._createRefMark(n.refIdx)}return null},r.prototype._handleValue=function(t,e,n){var r=typeof t,i="object"==r&&null!==t;if(i){var o=this._ensureCircularReference(t);if(o)return o}for(var s=0;s<this.transforms.length;s++){var a=this.transforms[s];if(a.shouldTransform(r,t))return this._applyTransform(t,e,n,a)}return i?this._handleObject(t,e,n):t},r.prototype.transform=function(){for(var t=[this._handleValue(this.references,null,null)],e=0;e<this.circularCandidatesDescrs.length;e++){var n=this.circularCandidatesDescrs[e];0<n.refIdx&&(t[n.refIdx]=n.parent[n.key],n.parent[n.key]=r._createRefMark(n.refIdx))}return t},u.prototype._handlePlainObject=function(e){var t,n=this,r=Object.create(null),i=Object.getOwnPropertyNames(e);for(t in i.forEach(function(t){n._handleValue(e[t],e,t),o.test(t)&&(r[t.substring(1)]=e[t],delete e[t])}),r)e[t]=r[t]},u.prototype._handleTransformedObject=function(t,e,n){var r=t["@t"],i=this.transformMap[r];if(!i)throw new Error("Can't find transform for \""+r+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=i.fromSerializable(t.data)},u.prototype._handleCircularSelfRefDuringTransform=function(t,e,n){var r=this.references,i=void 0;Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return void 0===i&&(i=r[t]),i},set:function(t){return i=t}})},u.prototype._handleCircularRef=function(t,e,n){-1<this.activeTransformsStack.indexOf(this.references[t])?this._handleCircularSelfRefDuringTransform(t,e,n):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),e[n]=this.references[t])},u.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var r=t["@r"];if(void 0!==r)this._handleCircularRef(r,e,n);else if(t["@t"])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var i=0;i<t.length;i++)this._handleValue(t[i],t,i);else this._handlePlainObject(t)}},u.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]};var d=[{type:"[[NaN]]",shouldTransform:function(t,e){return"number"===t&&isNaN(e)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",shouldTransform:function(t,e){return e instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var e=new Date;return e.setTime(t),e}},{type:"[[RegExp]]",shouldTransform:function(t,e){return e instanceof RegExp},toSerializable:function(t){var e={src:t.source,flags:""};return t.global&&(e.flags+="g"),t.ignoreCase&&(e.flags+="i"),t.multiline&&(e.flags+="m"),e},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",shouldTransform:function(t,e){return e instanceof Error},toSerializable:function(t){return{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var e=new(i[t.name]||Error)(t.message);return e.stack=t.stack,e}},{type:"[[ArrayBuffer]]",shouldTransform:function(t,e){return n&&e instanceof ArrayBuffer},toSerializable:function(t){var e=new Int8Array(t);return c.call(e)},fromSerializable:function(t){if(n){var e=new ArrayBuffer(t.length);return new Int8Array(e).set(t),e}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,e){for(var n=0;n<l.length;n++){var r=l[n];if("function"==typeof i[r]&&e instanceof i[r])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:c.call(t)}},fromSerializable:function(t){return"function"==typeof i[t.ctorName]?new i[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",shouldTransform:function(t,e){return s&&e instanceof Map},toSerializable:function(t){var n=[];return t.forEach(function(t,e){n.push(e),n.push(t)}),n},fromSerializable:function(t){if(s){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var r=[],i=0;i<t.length;i+=2)r.push([t[n],t[n+1]]);return r}},{type:"[[Set]]",shouldTransform:function(t,e){return a&&e instanceof Set},toSerializable:function(t){var e=[];return t.forEach(function(t){e.push(t)}),e},fromSerializable:function(t){if(a){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}}],h=t.exports=function(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||e,this.addTransforms(d)};h.prototype.addTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},h.prototype.removeTransforms=function(t){t=Array.isArray(t)?t:[t];for(var e=0;e<t.length;e++){var n=t[e],r=this.transforms.indexOf(n);-1<r&&this.transforms.splice(r,1),delete this.transformsMap[n.type]}return this},h.prototype.encode=function(t){var e=new r(t,this.transforms).transform();return this.serializer.serialize(e)},h.prototype.decode=function(t){var e=this.serializer.deserialize(t);return new u(e,this.transformsMap).transform()}}(dr={exports:{}}),dr.exports);function fr(t,e){return new l.nativeMethods.Function("fnCode","__dependencies$","Promise","RegExp",'"use strict"; return eval(fnCode)')(t,e,l.Promise,RegExp)}var mr=["nodeType","textContent","childNodeCount","hasChildNodes","childElementCount","hasChildElements"],pr=["tagName","attributes"],gr=["tagName","visible","focused","attributes","boundingClientRect","classNames","style","innerText","namespaceURI","id","value","checked","selected","selectedIndex","scrollWidth","scrollHeight","scrollLeft","scrollTop","offsetWidth","offsetHeight","offsetLeft","offsetTop","clientWidth","clientHeight","clientLeft","clientTop"],vr={textContent:function(t){return t.textContent},childNodeCount:function(t){return t.childNodes.length},hasChildNodes:function(t){return!!vr.childNodeCount(t)},childElementCount:function(t){var e=t.children;if(e)return e.length;for(var n=0,r=t.childNodes.length,i=0;i<r;i++)1===t.childNodes[i].nodeType&&n++;return n},hasChildElements:function(t){return!!vr.childElementCount(t)}},wr=(yr.prototype._initializeProperties=function(t,e,n){for(var r=0;r<e.length;r++){var i=e[r],o=n[i];this[i]=o?o(t):t[i]}},yr);function yr(){}var _r,Er=(s(Cr,_r=wr),Cr);function Cr(t){var e=_r.call(this)||this;return e._initializeProperties(t,mr,vr),e}var Sr,Ir={tagName:function(t){return t.tagName.toLowerCase()},visible:y.positionUtils.isElementVisible,focused:function(t){return y.domUtils.getActiveElement()===t},attributes:function(t){for(var e=t.attributes,n={},r=e.length-1;0<=r;r--)n[e[r].name]=e[r].value;return n},boundingClientRect:function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width,height:e.height}},classNames:function(t){var e=t.className;return(e="string"==typeof e.animVal?e.animVal:e).replace(/^\s+|\s+$/g,"").split(/\s+/g)},style:function(t){for(var e={},n=Rc.getComputedStyle(t),r=0;r<n.length;r++){var i=n[r];e[i]=n[i]}return e},innerText:function(t){return t.innerText}},Tr=(s(xr,Sr=wr),xr);function xr(t){var e=Sr.call(this,t)||this;return e._initializeProperties(t,pr,Ir),e}var br,Wr=(s(Mr,br=Er),Mr);function Mr(t){var e=br.call(this,t)||this;return e._initializeProperties(t,gr,Ir),e}var Pr=Rc.Node,Ar=function(t){return t};function Dr(t){return new hr({serialize:Ar,deserialize:Ar}).addTransforms(t)}var Rr=(Nr.prototype.shouldTransform=function(t){return"function"===t},Nr.prototype.toSerializable=function(){return""},Nr.prototype.fromSerializable=function(t){return fr(t.fnCode,t.dependencies)},Nr);function Nr(){this.type="Function"}var kr=(Fr.prototype.shouldTransform=function(t,e){return e instanceof Pr},Fr.prototype.toSerializable=function(t){return new Tr(t)},Fr);function Fr(){this.type="Node"}var Lr=(Ur.prototype._extend=function(t,n){var r=this;o.nativeMethods.objectKeys.call(Rc.Object,this.customDOMProperties).forEach(function(e){try{t[e]=r.customDOMProperties[e](n)}catch(t){throw new Ot(r.instantiationCallsiteName,t,e)}})},Ur.prototype.shouldTransform=function(t,e){return e instanceof Pr},Ur.prototype.toSerializable=function(t){var e=new(1===t.nodeType?Wr:Er)(t);return this._extend(e,t),e},Ur);function Ur(t){this.type="Node",this.customDOMProperties=t||{}}var Or=(Br.prototype.shouldTransform=function(t,e){if(e instanceof Pr)throw new Et(this.instantiationCallsiteName)},Br);function Br(t){this.type="Node",this.instantiationCallsiteName=t}var Hr=(Gr.prototype.getResult=function(){var e=this;return l.Promise.resolve().then(function(){var t=e.replicator.decode(e.command.args);return e._executeFn(t)}).catch(function(t){throw t.isTestCafeError||(t=new Ft(e.command.instantiationCallsiteName,t)),t})},Gr.prototype.getResultDriverStatus=function(){var e=this;return this.getResult().then(function(t){return new cr({isCommandResult:!0,result:e.replicator.encode(t)})}).catch(function(t){return new cr({isCommandResult:!0,executionError:t})})},Gr.prototype._createReplicator=function(){return Dr([new Or(this.command.instantiationCallsiteName),new Rr])},Gr.prototype._executeFn=function(t){return this.fn.apply(Rc,t)},Gr);function Gr(t){this.command=t,this.replicator=this._createReplicator(),this.dependencies=this.replicator.decode(this.command.dependencies),this.fn=fr(this.command.fnCode,this.dependencies)}var Vr="appeared-dialog",Xr="unexpected-dialog",Yr="handler-error",zr=o.eventSandbox.message,jr=o.processScript,qr=o.nativeMethods,Kr="testcafe|native-dialog-tracker|appeared-dialogs",Jr="testcafe|native-dialog-tracker|unexpected-dialog",$r="testcafe|native-dialog-tracker|error-in-handler",Qr=jr("window.location.href"),Zr=(Object.defineProperty(ti.prototype,"appearedDialogs",{get:function(){var t=this.contextStorage.getItem(Kr);return t||(t=[],this.appearedDialogs=t),t},set:function(t){this.contextStorage.setItem(Kr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"unexpectedDialog",{get:function(){return this.contextStorage.getItem(Jr)},set:function(t){this.contextStorage.setItem(Jr,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ti.prototype,"handlerError",{get:function(){return this.contextStorage.getItem($r)},set:function(t){this.contextStorage.setItem($r,t)},enumerable:!1,configurable:!0}),ti._getPageUrl=function(){return qr.eval(Qr)},ti.prototype._initListening=function(){var n=this;zr.on(zr.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;e.type===Vr?n._addAppearedDialogs(e.dialogType,e.text,e.url):e.type!==Xr||n.unexpectedDialog?e.type!==Yr||n.handlerError||n._onHandlerError(e.dialogType,e.message,e.url):n.unexpectedDialog={type:e.dialogType,url:e.url}})},ti.prototype._init=function(){var e=this;o.on(o.EVENTS.beforeUnload,function(t){t.prevented&&!t.isFakeIEEvent&&(e.dialogHandler?e._createDialogHandler("beforeunload")(t.returnValue||""):e._defaultDialogHandler("beforeunload")),e.contextStorage&&e.contextStorage.save()}),Rc.alert=function(){return e._defaultDialogHandler("alert")},Rc.confirm=function(){return e._defaultDialogHandler("confirm")},Rc.prompt=function(){return e._defaultDialogHandler("prompt")}},ti.prototype._createDialogHandler=function(i){var o=this;return function(t){var e=ti._getPageUrl();o._addAppearedDialogs(i,t,e);var n=new Hr(o.dialogHandler),r=null;try{r=n.fn.apply(Rc,[i,t,e])}catch(t){o._onHandlerError(i,t.message||String(t),e)}return r}},ti.prototype._defaultDialogHandler=function(t){var e=ti._getPageUrl();this.unexpectedDialog=this.unexpectedDialog||{type:t,url:e}},ti.prototype._addAppearedDialogs=function(t,e,n){this.appearedDialogs.splice(0,0,{type:t,text:e,url:n})},ti.prototype._onHandlerError=function(t,e,n){this.handlerError=this.handlerError||{type:t,message:e,url:n}},ti.prototype.setHandler=function(t){var e=this;this.dialogHandler=t,["alert","confirm","prompt"].forEach(function(t){Rc[t]=e.dialogHandler?e._createDialogHandler(t):function(){return e._defaultDialogHandler(t)}})},ti.prototype.getUnexpectedDialogError=function(){var t=this.unexpectedDialog,e=this.handlerError;return this.unexpectedDialog=null,this.handlerError=null,t?new qn(t.type,t.url):e?new $n(e.type,e.message,e.url):null},ti);function ti(t,e){this.contextStorage=t,this.dialogHandler=e,this._init(),this._initListening(),this.dialogHandler&&this.setHandler(e)}function ei(t){this.type=t,this.id=ar()}var ni,ri="driver|establish-connection",ii="driver|switch-to-window",oi="driver|close-window",si="driver|close-window-validation",ai="driver|switch-to-window-validation",li="driver|get-windows",ci="driver|command-executed",ui="driver|execute-command",di="driver|confirmation",hi="driver|set-native-dialog-handler",fi="driver|set-as-master",mi="driver|close-all-child-windows",pi="driver|start-to-restore-child-link",gi="driver|restore-child-link",vi="driver|child-window-is-loaded-in-iframe",wi="driver|child-window-is-opened-in-iframe",yi=(s(_i,ni=ei),_i);function _i(){return ni.call(this,ri)||this}var Ei,Ci=(s(Si,Ei=ei),Si);function Si(t){var e=t.windowId,n=Ei.call(this,si)||this;return n.windowId=e,n}var Ii,Ti=(s(xi,Ii=ei),xi);function xi(t){var e=t.windowId,n=t.fn,r=Ii.call(this,ai)||this;return r.windowId=e,r.fn=n,r}var bi,Wi=(s(Mi,bi=ei),Mi);function Mi(){return bi.call(this,li)||this}var Pi,Ai=(s(Di,Pi=ei),Di);function Di(t){var e=t.windowId,n=t.isCurrentWindow,r=Pi.call(this,oi)||this;return r.windowId=e,r.isCurrentWindow=n,r}var Ri,Ni=(s(ki,Ri=ei),ki);function ki(t){var e=t.windowId,n=t.fn,r=Ri.call(this,ii)||this;return r.windowId=e,r.fn=n,r}var Fi,Li=(s(Ui,Fi=ei),Ui);function Ui(t){var e=Fi.call(this,ci)||this;return e.driverStatus=t,e}var Oi,Bi=(s(Hi,Oi=ei),Hi);function Hi(t,e){var n=Oi.call(this,ui)||this;return n.command=t,n.testSpeed=e,n}var Gi,Vi=(s(Xi,Gi=ei),Xi);function Xi(t,e){var n=Gi.call(this,di)||this;return n.requestMessageId=t,n.result=e,n}var Yi,zi=(s(ji,Yi=ei),ji);function ji(t){var e=Yi.call(this,hi)||this;return e.dialogHandler=t,e}var qi,Ki=(s(Ji,qi=ei),Ji);function Ji(t){var e=qi.call(this,fi)||this;return e.finalizePendingCommand=t,e}var $i,Qi=(s(Zi,$i=ei),Zi);function Zi(){return $i.call(this,mi)||this}var to,eo=(s(no,to=ei),no);function no(){return to.call(this,pi)||this}var ro,io=(s(oo,ro=ei),oo);function oo(t){var e=ro.call(this,gi)||this;return e.windowId=t,e}var so,ao=(s(lo,so=ei),lo);function lo(t){var e=so.call(this,vi)||this;return e.windowId=t,e}var co,uo=(s(ho,co=ei),ho);function ho(){return co.call(this,wi)||this}var fo=o.json,mo=o.nativeMethods,po=(go.prototype._createStorageKey=function(t,e){var n="testcafe|driver|"+t;return e?n+"|"+e:n},go.prototype._loadFromStorage=function(){var t=mo.storageGetItem.call(this.storage,this.storageKey);t&&(this.data=fo.parse(t),mo.storageRemoveItem.call(this.storage,this.storageKey))},go.prototype.save=function(){mo.storageSetItem.call(this.storage,this.storageKey,fo.stringify(this.data))},go.prototype.setItem=function(t,e){this.data[t]=e,this.save()},go.prototype.getItem=function(t){return this.data[t]},go.prototype.dispose=function(){mo.storageRemoveItem.call(this.storage,this.storageKey)},go);function go(t,e,n){this.storage=mo.winSessionStorageGetter.call(t),this.storageKey=this._createStorageKey(e,n),this.data={},this._loadFromStorage()}function vo(n,t,e,r){var i=null,o=null,s=null;return e=Math.max(e||0,2500),l.Promise.race([y.delay(e),new l.Promise(function(e){s=function(t){t.message.type===di&&t.message.requestMessageId===n.id&&e(t.message)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),i=l.nativeMethods.setInterval.call(Rc,function(){return l.eventSandbox.message.sendServiceMsg(n,t)},1e3),l.eventSandbox.message.sendServiceMsg(n,t)})]).then(function(t){if(l.nativeMethods.clearInterval.call(Rc,i),l.nativeMethods.clearTimeout.call(Rc,o),l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,s),!t)throw new r;return t})}var wo=2e4;function yo(t){var e=t.requestMsgId,n=t.result,r=t.window,i=new Vi(e,n);l.eventSandbox.message.sendServiceMsg(i,r)}var _o=(Object.defineProperty(Eo.prototype,"availabilityTimeout",{set:function(t){this.iframeAvailabilityTimeout=t},enumerable:!1,configurable:!0}),Eo.prototype._ensureIframe=function(){var t=this;return y.domUtils.isElementInDocument(this.driverIframe)?y.waitFor(function(){return y.positionUtils.isElementVisible(t.driverIframe)?t.driverIframe:null},200,this.iframeAvailabilityTimeout).catch(function(){throw new Yn}):l.Promise.reject(new Gn)},Eo.prototype._waitForIframeRemovedOrHidden=function(){var e=this;return new l.Promise(function(t){e.checkIframeInterval=l.nativeMethods.setInterval.call(Rc,function(){e._ensureIframe().catch(function(){return y.delay(500).then(function(){return t(new cr({isCommandResult:!0}))})})},1e3)})},Eo.prototype._waitForCommandResult=function(){var e=this,n=null;return l.Promise.race([this._waitForIframeRemovedOrHidden(),new l.Promise(function(e){n=function(t){t.message.type===ci&&e(t.message.driverStatus)},l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n)})]).then(function(t){return l.eventSandbox.message.off(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,n),l.nativeMethods.clearInterval.call(Rc,e.checkIframeInterval),t})},Eo.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,result:{id:this.driverId},window:this.driverWindow})},Eo.prototype.executeCommand=function(e,n){var r=this;return this._ensureIframe().then(function(){var t=new Bi(e,n);return l.Promise.all([vo(t,r.driverWindow,r.iframeAvailabilityTimeout,rn),r._waitForCommandResult()])}).then(function(t){return t[1]})},Eo);function Eo(t,e){this.driverWindow=t,this.driverIframe=y.domUtils.findIframeByWindow(t),this.driverId=e,this.iframeAvailabilityTimeout=0}var Co=o.Promise,So=o.nativeMethods,Io=(To.prototype._onScriptElementAdded=function(t){var e,n,r=this,i=So.scriptSrcGetter.call(t);void 0!==i&&""!==i&&(this.scriptsCount++,e=null,n=function(){So.removeEventListener.call(t,"load",n),So.removeEventListener.call(t,"error",n),So.clearTimeout.call(Rc,e),r._onScriptLoadedOrFailed()},So.addEventListener.call(t,"load",n),So.addEventListener.call(t,"error",n),e=So.setTimeout.call(Rc,n,this.SCRIPT_LOADING_TIMEOUT))},To.prototype._onScriptLoadedOrFailed=function(){var t=this;this.scriptsCount--,this.scriptsCount||y.delay(25).then(function(){t.resolveWaitingPromise&&(t.scriptsCount||t.resolveWaitingPromise())})},To.prototype.wait=function(){var n=this;return new Co(function(t){function e(){So.clearTimeout.call(Rc,n.watchdog),o.off(o.EVENTS.scriptElementAdded,n.scriptElementAddedHandler),n.watchdog=null,n.resolveWaitingPromise=null,t()}n.scriptsCount?(n.watchdog=So.setTimeout.call(Rc,e,n.BARRIER_TIMEOUT),n.resolveWaitingPromise=e):e()})},To);function To(){var e=this;this.watchdog=null,this.SCRIPT_LOADING_TIMEOUT=2e3,this.BARRIER_TIMEOUT=3e3,this.scriptsCount=0,this.resolveWaitingPromise=null,this.scriptElementAddedHandler=function(t){return e._onScriptElementAdded(t.el)},o.on(o.EVENTS.scriptElementAdded,this.scriptElementAddedHandler)}function xo(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=new y.RequestBarrier,i=new Io;y.pageUnloadBarrier.watchForPageNavigationTriggers();var o=null,s=t.apply(void 0,e),a=s.then(function(t){return o=t,l.Promise.all([r.wait().then(function(){return i.wait()}),y.pageUnloadBarrier.wait()])}).then(function(){return o});return{actionPromise:s,barriersPromise:a}}var bo,Wo=Array.isArray,Mo=Rc.Node,Po=Rc.HTMLCollection,Ao=Rc.NodeList;function Do(t){return!!t}function Ro(t){return!(!y.domUtils.isDomElement(t)&&!y.domUtils.isTextNode(t))&&(y.domUtils.isOptionElement(t)||"optgroup"===y.domUtils.getTagName(t)?n.selectElement.isOptionElementVisible(t):y.positionUtils.isElementVisible(t))}function No(t){return t instanceof Po||t instanceof Ao||function(t){if(Wo(t)){for(var e=0;e<t.length;e++)if(!(t[e]instanceof Mo))return;return 1}}(t)}var ko=t.arrayUtils,Fo=o.utils.types,Lo=o.nativeMethods,Uo=1,Oo=2,Bo=3,Ho=((bo={})[Uo]=/^\.filterVisible\(\)$/,bo[Oo]=/^\.filterHidden\(\)$/,bo[Bo]=/^\.nth\(\d+\)$/,bo),Go=(Object.defineProperty(Vo.prototype,"error",{get:function(){return this.err},set:function(t){null===this.err&&(this.err=t)},enumerable:!1,configurable:!0}),Vo.prototype.filter=function(t,e,n){var r,i=ko.filter(t,Do);return e.filterVisible&&(i=i.filter(Ro),this.assertFilterError(i,n,Uo)),e.filterHidden&&(i=i.filter(function(t){return!Ro(t)}),this.assertFilterError(i,n,Oo)),e.counterMode?i=null!==e.index?this.getNodeByIndex(i,e.index)?1:0:i.length:(e.collectionMode?null!==e.index&&(i=(r=this.getNodeByIndex(i,e.index))?[r]:[]):i=this.getNodeByIndex(i,e.index||0),"number"==typeof e.index&&this.assertFilterError(i,n,Bo)),i},Vo.prototype.cast=function(t){var e=null;if(Fo.isNullOrUndefined(t))e=[];else if(t instanceof Node)e=[t];else{if(!No(t))throw new bt;e=t}return e},Vo.prototype.assertFilterError=function(t,e,n){t&&0!==t.length||(this.error=this.getErrorItem(e,n))},Vo.prototype.getErrorItem=function(t,e){var n=t.apiFnChain,r=t.apiFnID;if(e)for(var i=r;i<n.length;i++)if(Ho[e].test(n[i]))return i;return null},Vo.prototype.getNodeByIndex=function(t,e){return e<0?t[t.length+e]:t[e]},Vo);function Vo(){this.err=null}Lo.objectDefineProperty.call(Rc,Rc,"%testCafeSelectorFilter%",{value:new Go,configurable:!0});var Xo,Yo=l.nativeMethods.date,zo=(s(jo,Xo=Hr),jo.prototype._createReplicator=function(){return Dr([new Rr])},jo.prototype._getTimeoutErrorParams=function(){var t=Rc["%testCafeSelectorFilter%"].error,e=this.command.apiFnChain;return void 0!==t?{apiFnIndex:t,apiFnChain:e}:null},jo.prototype._getTimeoutError=function(t){return t?this.createIsInvisibleError:this.createNotFoundError},jo.prototype._validateElement=function(o,s){var a=this;return l.Promise.resolve().then(function(){return a.fn.apply(Rc,o)}).then(function(t){var e=!!t,n=!a.command.visibilityCheck||Ro(t),r=new Yo-s>=a.timeout;if(e&&(n||y.domUtils.isShadowRoot(t)))return t;if(!r)return y.delay(200).then(function(){return a._validateElement(o,s)});var i=a.getVisibleValueMode?null:a._getTimeoutError(e);if(i)throw i(a._getTimeoutErrorParams());return null})},jo.prototype._executeFn=function(t){if(this.counterMode)return Xo.prototype._executeFn.call(this,t);var e=new Yo,n=null,r=null;return this._validateElement(t,e).catch(function(t){n=t}).then(function(t){if(n)throw n;r=t}).then(function(){return r})},jo);function jo(t,e,n,r,i){var o,s=Xo.call(this,t)||this;s.createNotFoundError=r,s.createIsInvisibleError=i,s.timeout="number"==typeof t.timeout?t.timeout:e,s.counterMode=s.dependencies.filterOptions.counterMode,s.getVisibleValueMode=s.dependencies.filterOptions.getVisibleValueMode,n&&(o=new Yo-n,s.timeout=Math.max(s.timeout-o,0));var a=s.dependencies&&s.dependencies.customDOMProperties;return s.replicator.addTransforms([new Lr(a)]),s}var qo=l.nativeMethods.date,Ko=(Jo.prototype._ensureElement=function(t){var e=this,n=t.selector,r=t.createNotFoundError,i=t.createIsInvisibleError,o=t.createHasWrongNodeTypeError;this.ensureElementsPromise=this.ensureElementsPromise.then(function(){return new zo(n,e.globalSelectorTimeout,e.ensureElementsStartTime,r,i).getResult()}).then(function(t){if(!y.domUtils.isDomElement(t))throw o(y.NODE_TYPE_DESCRIPTIONS[t.nodeType]);e.elements.push(t)})},Jo.prototype.getElements=function(){var t=this;return this.ensureElementsPromise.then(function(){return t.elements})},Jo);function Jo(t,e){var n=this;this.elements=[],this.globalSelectorTimeout=e,this.ensureElementsPromise=l.Promise.resolve(),this.ensureElementsStartTime=new qo,t.forEach(function(t){return n._ensureElement(t)})}function $o(t,e){return new Ko(t,e).getElements()}function Qo(t){return{selector:t,createNotFoundError:function(t){return new se(t)},createIsInvisibleError:function(){return new ce},createHasWrongNodeTypeError:function(t){return new he(t)}}}function Zo(t,e){return{selector:t,createNotFoundError:function(t){return new pe(e,t)},createIsInvisibleError:function(){return new we(e)},createHasWrongNodeTypeError:function(t){return new Ee(e,t)}}}var ts=o.utils.browser;function es(t,e,n){var r=ts.isFirefox?Math.ceil:Math.round,i=y.positionUtils.getOffsetPosition(t,r);return{x:(t===Nc.documentElement?0:i.left)+e,y:(t===Nc.documentElement?0:i.top)+n}}function ns(t){if(!t)return null;var e=Rc.screenLeft||Rc.screenX,n=Rc.screenTop||Rc.screenY;return{x:e+t.x,y:n+t.y}}function rs(t){var e=t/2;return e<1?0:Math.round(e)}function is(t,e,n){var r,i,o=(r=t,{offsetX:rs((i=y.positionUtils.getElementRectangle(r)).width),offsetY:rs(i.height)});if(e="number"==typeof e?Math.round(e):o.offsetX,n="number"==typeof n?Math.round(n):o.offsetY,0<e&&0<n)return{offsetX:e,offsetY:n};var s=y.positionUtils.getClientDimensions(t),a=Math.round(Math.max(t.scrollWidth,s.width)),l=Math.round(Math.max(t.scrollHeight,s.height)),c=s.scrollbar.right+s.border.left+s.border.right+a,u=s.scrollbar.bottom+s.border.top+s.border.bottom+l;return{offsetX:e<0?c+e:e,offsetY:n<0?u+n:n}}function os(t){return t.top!==t}var ss=t.domUtils,as=os(Rc)?i.iframeCursorUI:i.cursorUI,ls={x:-1,y:-1,currentActiveWindow:Rc.top,_ensureActiveWindow:function(){var t;this.currentActiveWindow!==Rc&&this.currentActiveWindow!==Rc.parent&&((t=ss.findIframeByWindow(this.currentActiveWindow))&&ss.isElementInDocument(t)||(this.currentActiveWindow=Rc))},get active(){return this._ensureActiveWindow(),this.currentActiveWindow===Rc},set activeWindow(t){this.currentActiveWindow=t},get activeWindow(){return this._ensureActiveWindow(),this.currentActiveWindow},get position(){return{x:this.x,y:this.y}},get visible(){return!os(Rc)&&as.isVisible()},move:function(t,e){return this.x=t,this.y=e,as.move(this.x,this.y)},hide:function(){this.visible&&as.hide()},show:function(){os(Rc)||as.show()},leftButtonDown:function(){return as.leftButtonDown()},rightButtonDown:function(){return as.rightButtonDown()},buttonUp:function(){return as.buttonUp()}},cs=o.utils.browser,us=o.Promise,ds=o.nativeMethods,hs=t.positionUtils,fs=t.domUtils;function ms(t,e,n){var r=null;return i.hide(n).then(function(){return r=hs.getElementFromPoint(t,e),i.show(n)}).then(function(){return r})}function ps(t,e,n){var r=hs.getElementFromPoint(t,e),i=fs.containsElement(n,r)&&ds.nodeTextContentGetter.call(r).length;return r&&r===n||i?r:null}function gs(t,e){if(!e||!fs.isDomElement(e)||!t||t===e)return t;if("tref"===fs.getTagName(e))return e;var n,r,i,o="area"===fs.getTagName(e)&&fs.isImgElement(t);if(cs.isFirefox&&o)return n=t,r=e,(i=fs.closest(r,"map"))&&i.name===n.useMap.substring(1)?r:n;var s=fs.isAnchorElement(e)||fs.getParents(e,"a").length,a=s&&fs.containsElement(e,t)&&ds.nodeTextContentGetter.call(t).length;if(!s||a||!ds.nodeTextContentGetter.call(e).length)return t;var l=e.getBoundingClientRect();return ps(l.right-1,l.top+1,e)||ps(l.left+1,l.bottom-1,e)||t}function vs(n,r,i){var o=null;return ms(n,r).then(function(t){o=t;var e=us.resolve(t);return!o&&os(Rc)&&0<n&&0<r&&(e=e.then(function(){return ms(n,r,!0)}).then(function(t){return o=t})),e.then(function(t){return gs(t,i)}).then(function(t){return{element:t,corrected:t!==o}})})}function ws(){var t=ls.position;return vs(t.x,t.y).then(function(t){return t.element})}var ys="elementIsInvisibleError",_s="foundElementIsNotTarget",Es=(Object.defineProperty(Cs.prototype,"mouseActionStepDelay",{get:function(){return 1===this.speedFactor?10:400*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"keyActionStepDelay",{get:function(){return 1===this.speedFactor?10:200*(1-this.speedFactor)},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"cursorSpeed",{get:function(){return Math.pow(400,this.speedFactor)/4},enumerable:!1,configurable:!0}),Object.defineProperty(Cs.prototype,"draggingSpeed",{get:function(){return Math.pow(16,this.speedFactor)/4},enumerable:!1,configurable:!0}),Cs);function Cs(t){this.speedFactor=t||1}var Ss=o.Promise,Is=o.eventSandbox.message,Ts="automation|scroll|request",xs="automation|scroll|response";Is.on(Is.SERVICE_MSG_RECEIVED_EVENT,function(t){var e,n,r,i,o,s;t.message.cmd===Ts&&(n=(e=t.message).offsetX,r=e.offsetY,i=e.maxScrollMargin,o=y.domUtils.findIframeByWindow(t.source),(s=new bs(o,{offsetX:n,offsetY:r})).maxScrollMargin=i,s.run().then(function(){return Is.sendServiceMsg({cmd:xs},t.source)}))});var bs=(Ws.prototype._isScrollValuesChanged=function(t,e){return y.styleUtils.getScrollLeft(t)!==e.left||y.styleUtils.getScrollTop(t)!==e.top},Ws.prototype._setScroll=function(t,e){var n=this,r=e.left,i=e.top,o=y.domUtils.isHtmlElement(t)?y.domUtils.findDocument(t):t,s={left:y.styleUtils.getScrollLeft(o),top:y.styleUtils.getScrollTop(o)},r=Math.max(r,0),i=Math.max(i,0),a=y.scrollController.waitForScroll(o);return y.styleUtils.setScrollLeft(o,r),y.styleUtils.setScrollTop(o,i),this._isScrollValuesChanged(o,s)?a=a.then(function(){n.scrollWasPerformed=n.scrollWasPerformed||n._isScrollValuesChanged(o,s)}):(a.cancel(),Ss.resolve())},Ws.prototype._getScrollToPoint=function(t,e,n){var r=e.x,i=e.y,o=Math.floor(t.width/2),s=Math.floor(Math.floor(t.height/2)),a=this.scrollToCenter?o:Math.min(n.left,o),l=this.scrollToCenter?s:Math.min(n.top,s),c=r>=t.scroll.left+t.width-a,u=r<=t.scroll.left+a,d=i>=t.scroll.top+t.height-l,h=i<=t.scroll.top+l,f=t.scroll.left,m=t.scroll.top;return c?f=r-t.width+a:u&&(f=r-a),d?m=i-t.height+l:h&&(m=i-l),{left:f,top:m}},Ws.prototype._getScrollToFullChildView=function(t,e,n){var r,i,o,s,a=null,l=null,c=t.width>=e.width,u=t.height>=e.height,d=y.positionUtils.calcRelativePosition(e,t);return c&&(r=t.width-e.width,i=Math.min(n.left,r),this.scrollToCenter&&(i=r/2),d.left<i?a=Math.round(t.scroll.left+d.left-i):d.right<i&&(a=Math.round(t.scroll.left+Math.min(d.left,-d.right)+i))),u&&(o=t.height-e.height,s=Math.min(n.top,o),this.scrollToCenter&&(s=o/2),d.top<s?l=Math.round(t.scroll.top+d.top-s):d.bottom<s&&(l=Math.round(t.scroll.top+Math.min(d.top,-d.bottom)+s))),{left:a,top:l}},Ws._getChildPoint=function(t,e,n){return{x:e.left-t.left+t.scroll.left+e.border.left+n.x,y:e.top-t.top+t.scroll.top+e.border.top+n.y}},Ws.prototype._getScrollPosition=function(t,e,n,r){var i=Ws._getChildPoint(t,e,n),o=this._getScrollToPoint(t,i,r),s=this._getScrollToFullChildView(t,e,r);return{left:Math.max(null===s.left?o.left:s.left,0),top:Math.max(null===s.top?o.top:s.top,0)}},Ws._getChildPointAfterScroll=function(t,e,n,r){return{x:Math.round(e.left+t.scroll.left-n.left+r.x),y:Math.round(e.top+t.scroll.top-n.top+r.y)}},Ws.prototype._isChildFullyVisible=function(t,e,n){var r=Ws._getChildPointAfterScroll(t,e,t.scroll,n),i=r.x,o=r.y,s=this._getScrollPosition(t,e,n,{left:0,top:0}),a=s.left,l=s.top;return!this._isTargetElementObscuredInPoint(i,o)&&a===t.scroll.left&&l===t.scroll.top},Ws.prototype._scrollToChild=function(t,e,n){for(var r=y.positionUtils.getClientDimensions(t),i=y.positionUtils.getClientDimensions(e),o=y.styleUtils.getInnerWidth(Rc),s=y.styleUtils.getInnerHeight(Rc),a=r.scroll,l=!this._isChildFullyVisible(r,i,n);l;){a=this._getScrollPosition(r,i,n,this.maxScrollMargin);var c=Ws._getChildPointAfterScroll(r,i,a,n),u=c.x,d=c.y,h=this._isTargetElementObscuredInPoint(u,d);this.maxScrollMargin.left+=20,this.maxScrollMargin.left>=o&&(this.maxScrollMargin.left=50,this.maxScrollMargin.top+=20),l=h&&this.maxScrollMargin.top<s}return this.maxScrollMargin={left:50,top:50},this._setScroll(t,a)},Ws.prototype._scrollElement=function(){if(!y.styleUtils.hasScroll(this.element))return Ss.resolve();var t=y.positionUtils.getClientDimensions(this.element),e=this._getScrollToPoint(t,{x:this.offsetX,y:this.offsetY},this.maxScrollMargin);return this._setScroll(this.element,e)},Ws.prototype._scrollParents=function(){var e,n,r=this,i=y.styleUtils.getScrollableParents(this.element),o=this.element,s=this.offsetX-Math.round(y.styleUtils.getScrollLeft(o)),a=this.offsetY-Math.round(y.styleUtils.getScrollTop(o));return y.promiseUtils.times(i.length,function(t){return r._scrollToChild(i[t],o,{x:s,y:a}).then(function(){e=y.positionUtils.getClientDimensions(o),n=y.positionUtils.getClientDimensions(i[t]),s+=e.left-n.left+n.border.left,a+=e.top-n.top+n.border.top,o=i[t]})}).then(function(){return os(Rc)&&!r.skipParentFrames?y.sendRequestToFrame({cmd:Ts,offsetX:s,offsetY:a,maxScrollMargin:r.maxScrollMargin},xs,Rc.parent):Ss.resolve()})},Ws._getFixedAncestorOrSelf=function(t){return y.domUtils.findParent(t,!0,y.styleUtils.isFixedElement)},Ws.prototype._isTargetElementObscuredInPoint=function(t,e){var n=y.positionUtils.getElementFromPoint(t,e);if(!n)return!1;var r=Ws._getFixedAncestorOrSelf(n);return r&&!r.contains(this.element)},Ws.prototype.run=function(){var t=this;return this._scrollElement().then(function(){return t._scrollParents()}).then(function(){return t.scrollWasPerformed})},Ws);function Ws(t,e){this.element=t,this.offsetX=e.offsetX,this.offsetY=e.offsetY,this.scrollToCenter=e.scrollToCenter,this.skipParentFrames=e.skipParentFrames,this.raiseEvents=e.raiseEvents,this.maxScrollMargin={left:50,top:50},this.scrollWasPerformed=!1}function Ms(r){return function(t,e){var n=typeof e;if("number"!=n)throw new r(t,n);if(isNaN(e)||!isFinite(e)||e!==Math.floor(e))throw new r(t,e)}}var Ps,As,Ds,Rs,Ns,ks=Ms(qt),Fs=(As=Ms(Ps=$t),function(t,e){if(As(t,e),e<0)throw new Ps(t,e)}),Ls=(Ds=te,function(t,e){var n=typeof e;if("boolean"!=n)throw new Ds(t,n)}),Us=(Rs=re,function(t,e){var n=typeof e;if("number"!=n)throw new Rs(t,n);if(isNaN(e)||e<.01||1<e)throw new Rs(t,e)}),Os=(s(Bs,Ns=or),Bs.prototype._getAssignableProperties=function(){return[{name:"speed",type:Us}]},Bs);function Bs(t,e){var n=Ns.call(this)||this;return n.speed=null,n._assignFrom(t,e),n}var Hs,Gs=(s(Vs,Hs=Os),Vs.prototype._getAssignableProperties=function(){return Hs.prototype._getAssignableProperties.call(this).concat([{name:"offsetX",type:ks},{name:"offsetY",type:ks}])},Vs);function Vs(t,e){var n=Hs.call(this)||this;return n.offsetX=null,n.offsetY=null,n._assignFrom(t,e),n}var Xs,Ys=(s(zs,Xs=Gs),zs.prototype._getAssignableProperties=function(){return Xs.prototype._getAssignableProperties.call(this).concat([{name:"scrollToCenter",type:Ls},{name:"skipParentFrames",type:Ls}])},zs);function zs(t,e){var n=Xs.call(this)||this;return n.scrollToCenter=!1,n.skipParentFrames=!1,n._assignFrom(t,e),n}var js,qs=(s(Ks,js=Os),Ks.prototype._getAssignableProperties=function(){return js.prototype._getAssignableProperties.call(this).concat([{name:"scrollTargetX",type:ks},{name:"scrollTargetY",type:ks},{name:"crop.left",type:ks},{name:"crop.right",type:ks},{name:"crop.top",type:ks},{name:"crop.bottom",type:ks},{name:"includeMargins",type:Ls},{name:"includeBorders",type:Ls},{name:"includePaddings",type:Ls}])},Ks);function Ks(t,e){var n=js.call(this)||this;return n.scrollTargetX=null,n.scrollTargetY=null,n.includeMargins=!1,n.includeBorders=!0,n.includePaddings=!0,n.crop={left:null,right:null,top:null,bottom:null},n._assignFrom(t,e),n}var Js,$s=(s(Qs,Js=Gs),Qs.prototype._getAssignableProperties=function(){return Js.prototype._getAssignableProperties.call(this).concat([{name:"modifiers.ctrl",type:Ls},{name:"modifiers.alt",type:Ls},{name:"modifiers.shift",type:Ls},{name:"modifiers.meta",type:Ls}])},Qs);function Qs(t,e){var n=Js.call(this)||this;return n.modifiers={ctrl:!1,alt:!1,shift:!1,meta:!1},n._assignFrom(t,e),n}var Zs,ta=(s(ea,Zs=$s),ea.prototype._getAssignableProperties=function(){return Zs.prototype._getAssignableProperties.call(this).concat([{name:"caretPos",type:Fs}])},ea);function ea(t,e){var n=Zs.call(this)||this;return n.caretPos=null,n._assignFrom(t,e),n}var na,ra,ia,oa,sa,aa,la=(s(ca,na=$s),ca.prototype._getAssignableProperties=function(){return na.prototype._getAssignableProperties.call(this).concat([{name:"speed"},{name:"minMovingTime"},{name:"holdLeftButton"},{name:"skipScrolling",type:Ls},{name:"skipDefaultDragBehavior",type:Ls}])},ca);function ca(t,e){var n=na.call(this)||this;return n.speed=null,n.minMovingTime=null,n.holdLeftButton=!1,n.skipScrolling=!1,n.skipDefaultDragBehavior=!1,n._assignFrom(t,e),n}function ua(t,e){var n=ra.call(this)||this;return n.replace=!1,n.paste=!1,n.confidential=void 0,n._assignFrom(t,e),n}function da(t,e){var n=ia.call(this,t,e)||this;return n.destinationOffsetX=null,n.destinationOffsetY=null,n._assignFrom(t,e),n}function ha(t,e){var n=oa.call(this)||this;return n.portraitOrientation=!1,n._assignFrom(t,e),n}function fa(t,e){var n=sa.call(this)||this;return n.timeout=void 0,n.allowUnawaitedPromise=!1,n._assignFrom(t,e),n}function ma(t,e){var n=aa.call(this)||this;return n.confidential=void 0,n._assignFrom(t,e),n}function pa(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ga(t,e,n){for(var r,i=[],o=[{x1:n.left,y1:n.top,x2:n.left,y2:n.bottom,isHorizontal:!1},{x1:n.right,y1:n.top,x2:n.right,y2:n.bottom,isHorizontal:!1},{x1:n.left,y1:n.top,x2:n.right,y2:n.top,isHorizontal:!0},{x1:n.left,y1:n.bottom,x2:n.right,y2:n.bottom,isHorizontal:!0}],s=0;s<o.length;s++)(r=function(t,e,n){var r;if(n.isHorizontal)return(r=y.positionUtils.getLineXByYCoord(t,e,n.y1))&&r>=n.x1&&r<=n.x2?{x:r,y:n.y1}:null;var i=y.positionUtils.getLineYByXCoord(t,e,n.x1);return i&&i>=n.y1&&i<=n.y2?{x:n.x1,y:i}:null}(t,e,o[s]))&&i.push(r);return i.length?1===i.length||pa(t,i[0])<pa(t,i[1])?i[0]:i[1]:null}s(ua,ra=ta),ua.prototype._getAssignableProperties=function(){return ra.prototype._getAssignableProperties.call(this).concat([{name:"replace",type:Ls},{name:"paste",type:Ls},{name:"confidential",type:Ls}])},s(da,ia=$s),da.prototype._getAssignableProperties=function(){return ia.prototype._getAssignableProperties.call(this).concat([{name:"destinationOffsetX",type:ks},{name:"destinationOffsetY",type:ks}])},s(ha,oa=or),ha.prototype._getAssignableProperties=function(){return[{name:"portraitOrientation",type:Ls}]},s(fa,sa=or),fa.prototype._getAssignableProperties=function(){return[{name:"timeout",type:Fs},{name:"allowUnawaitedPromise",type:Ls}]},s(ma,aa=Os),ma.prototype._getAssignableProperties=function(){return aa.prototype._getAssignableProperties.call(this).concat([{name:"confidential",type:Ls}])};var va=o.Promise,wa=o.nativeMethods;function ya(){return new va(function(t){return wa.setTimeout.call(Rc,t,0)})}var _a=function(){this.enabled=!1,this.dropAllowed=!1,this.element=null,this.dataTransfer=null,this.dataStore=null},Ea=o.utils.browser,Ca=(Sa.prototype.setup=function(){this.dragAndDropMode=!1,this.dropAllowed=!1},Sa.prototype.leaveElement=function(){},Sa.prototype.move=function(){},Sa.prototype.enterElement=function(){},Sa.prototype.dragAndDrop=function(){},Sa.prototype.teardown=function(){},Sa.prototype.run=function(t,e,n,r,i){var o=e&&y.domUtils.isElementInDocument(e),s=e&&y.domUtils.isElementInIframe(e)&&!y.domUtils.getIframeByElement(e);o&&!s||(e=null);var a=t!==e,l=a?y.domUtils.getCommonAncestor(t,e):null;this.setup(),a&&e&&this.leaveElement(t,e,l,n),Ea.isIE&&this.move(t,n),a&&y.domUtils.isElementInDocument(t)&&this.enterElement(t,e,l,n),Ea.isIE||this.move(t,n),this.dragAndDrop(r,t,e,n,i),this.teardown(t,n,e);var c=this.dragAndDropMode,u=this.dropAllowed;return this.dragAndDropMode=!1,this.dropAllowed=!1,{dragAndDropMode:c,dropAllowed:u}},Sa);function Sa(t){var e=t.moveEvent;this.dragAndDropMode=!1,this.dropAllowed=!1,this.moveEvent=e}var Ia=o.eventSandbox.eventSimulator,Ta=o.utils.extend,xa=o.nativeMethods,ba=(Wa.leaveElement=function(t,e,n,r){Ia.mouseout(e,Ta({relatedTarget:t},r));for(var i=e;i&&i!==n;)Ia.mouseleave(i,Ta({relatedTarget:t},r)),i=xa.nodeParentNodeGetter.call(i)},Wa.enterElement=function(t,e,n,r){Ia.mouseover(t,Ta({relatedTarget:e},r));for(var i=t,o=[];i&&i!==n;)o.push(i),i=y.domUtils.getParentExceptShadowRoot(i);for(var s=o.length-1;-1<s;s--)Ia.mouseenter(o[s],Ta({relatedTarget:e},r))},Wa.move=function(t,e,n){Ia[t](e,n)},Wa);function Wa(){}var Ma=(Pa.dragAndDrop=function(t,e,n,r){return Ia.drag(t,r),e!==n&&(y.domUtils.isElementInDocument(e)&&(r.relatedTarget=n,Ia.dragenter(e,r)),n&&(r.relatedTarget=e,Ia.dragleave(n,r))),!Ia.dragover(e,r)},Pa);function Pa(){}var Aa,Da=o.eventSandbox.eventSimulator,Ra=(s(Na,Aa=Ca),Na.prototype.leaveElement=function(t,e,n,r){ba.leaveElement(t,e,n,r)},Na.prototype.enterElement=function(t,e,n,r){ba.enterElement(t,e,n,r)},Na.prototype.move=function(t,e){this._needEmulateMoveEvent()&&ba.move(this.moveEvent,t,e)},Na.prototype.teardown=function(t,e,n){this._needEmulateMoveEvent()&&y.domUtils.isElementInDocument(t)&&t!==n&&Da[this.moveEvent](t,e)},Na.prototype._needEmulateMoveEvent=function(){return"touchmove"!==this.moveEvent||this.holdLeftButton},Na);function Na(t){var e=Aa.call(this,t)||this;return e.holdLeftButton=t.holdLeftButton,e}var ka,Fa=(s(La,ka=Ca),La.prototype.setup=function(){ka.prototype.setup.call(this),this.dragAndDropMode=!0},La.prototype.dragAndDrop=function(t,e,n,r){this.dropAllowed=Ma.dragAndDrop(t,e,n,r)},La);function La(){return null!==ka&&ka.apply(this,arguments)||this}var Ua,Oa=o.eventSandbox.eventSimulator,Ba=(s(Ha,Ua=Ca),Ha.prototype.setup=function(){Ua.prototype.setup.call(this),this.dragAndDropMode=!0},Ha.prototype.leaveElement=function(t,e,n,r){ba.leaveElement(t,e,n,r)},Ha.prototype.move=function(t,e){ba.move(this.moveEvent,t,e)},Ha.prototype.enterElement=function(t,e,n,r){ba.enterElement(t,e,n,r)},Ha.prototype.dragAndDrop=function(t,e,n,r,i){var o=Oa.dragstart(t,r);i.setReadOnlyMode(),o?this.dropAllowed=Ma.dragAndDrop(t,e,n,r):this.dragAndDropMode=!1},Ha.prototype.run=function(t,e,n,r,i){return Ua.prototype.run.call(this,t,null,n,r,i)},Ha);function Ha(){return null!==Ua&&Ua.apply(this,arguments)||this}var Ga=null,Va=function(){return Ga},Xa=function(t){Ga=t},Ya=o.Promise,za=o.nativeMethods,ja=o.utils.featureDetection,qa=o.utils.html,Ka=o.utils.url,Ja=o.eventSandbox.eventSimulator,$a=o.eventSandbox.message,Qa=o.eventSandbox.DataTransfer,Za=o.eventSandbox.DragDataStore,tl=t.positionUtils,el=t.domUtils,nl=t.styleUtils,rl=t.eventUtils,il=t.promiseUtils,ol=t.sendRequestToFrame,sl="automation|move|request",al="automation|move|response";$a.on($a.SERVICE_MSG_RECEIVED_EVENT,function(t){t.message.cmd===sl&&(t.source.parent===Rc?ll.onMoveToIframeRequest(t):(o.on(o.EVENTS.beforeUnload,function(){return $a.sendServiceMsg({cmd:al},t.source)}),ll.onMoveOutRequest(t)))});var ll=(cl.getTarget=function(t,e,n){var r=!tl.containsOffset(t,e,n),i=r?es(t,e,n):{x:e,y:n};return{element:r?Nc.documentElement:t,offsetX:i.x,offsetY:i.y}},cl.onMoveToIframeRequest=function(t){var e={x:t.message.endX,y:t.message.endY},n=t.source,r=el.findIframeByWindow(n),i=nl.getBordersWidth(r),o=nl.getElementPadding(r),s=tl.getIframeClientCoordinates(r),a=tl.getIframePointRelativeToParentFrame(e,n),l=ls.position,c=tl.isInRectangle(l,s)?l:ga(l,a,s),u={x:c.x-s.left,y:c.y-s.top},d=new cl(r,new la({modifiers:t.message.modifiers,offsetX:u.x+i.left+o.left,offsetY:u.y+i.top+o.top,speed:t.message.speed,skipScrolling:!0},!1)),h={cmd:al,x:u.x,y:u.y};ls.activeWindow!==n?d.run().then(function(){ls.activeWindow=n,$a.sendServiceMsg(h,n)}):$a.sendServiceMsg(h,n)},cl.onMoveOutRequest=function(t){var e=t.source,n={left:t.message.left,right:t.message.right,top:t.message.top,bottom:t.message.bottom};if(!t.message.iframeUnderCursor){var r=t.message,i=r.startX,o=r.startY,s=i-n.left,a=o-n.top,l=Va();return l&&(Ja.mouseout(l,{clientX:s,clientY:a,relatedTarget:null}),Ja.mouseleave(l,{clientX:s,clientY:a,relatedTarget:null})),void $a.sendServiceMsg({cmd:al},e)}var c,u=ls.position,d=ga({x:n.left+u.x,y:n.top+u.y},{x:t.message.endX,y:t.message.endY},n);d?(c=new la({modifiers:t.message.modifiers,offsetX:d.x-n.left,offsetY:d.y-n.top,speed:t.message.speed,skipScrolling:!0},!1),new cl(Nc.documentElement,c).run().then(function(){var t={cmd:al,x:d.x,y:d.y};ls.activeWindow=e,$a.sendServiceMsg(t,e)})):$a.sendServiceMsg({cmd:al,x:n.left,y:n.top},e)},cl.prototype._getTargetClientPoint=function(){var t=nl.getElementScroll(this.element);if(el.isHtmlElement(this.element))return{x:Math.floor(this.offsetX-t.left),y:Math.floor(this.offsetY-t.top)};var e=tl.getClientPosition(this.element),n=this.element.tagName&&el.isBodyElement(this.element);return{x:Math.floor(n?e.x+this.offsetX:e.x+this.offsetX-t.left),y:Math.floor(n?e.y+this.offsetY:e.y+this.offsetY-t.top)}},cl.prototype._emulateEvents=function(t){var e,n,r=this.holdLeftButton?rl.BUTTONS_PARAMETER.leftButton:rl.BUTTONS_PARAMETER.noButton,i=ns({x:this.x,y:this.y}),o={clientX:this.x,clientY:this.y,screenX:i.x,screenY:i.y,buttons:r,ctrl:this.modifiers.ctrl,alt:this.modifiers.alt,shift:this.modifiers.shift,meta:this.modifiers.meta,dataTransfer:this.dragAndDropState.dataTransfer},s={moveEvent:this.moveEvent,holdLeftButton:this.holdLeftButton},a=(e=this.dragAndDropState.enabled,n=this.firstMovingStepOccured,new(e?n?Fa:Ba:Ra)(s).run(t,Va(),o,this.dragElement,this.dragAndDropState.dataStore)),l=a.dragAndDropMode,c=a.dropAllowed;this.firstMovingStepOccured=!0,this.dragAndDropState.enabled=l,this.dragAndDropState.dropAllowed=c,Xa(t)},cl.prototype._movingStep=function(){var t,n=this;return this.touchMode&&!this.holdLeftButton?(this.x=this.endPoint.x,this.y=this.endPoint.y):this.startTime?(t=(Math.min(za.dateNow(),this.endTime)-this.startTime)/(this.endTime-this.startTime),this.x=Math.floor(this.startPoint.x+this.distanceX*t),this.y=Math.floor(this.startPoint.y+this.distanceY*t)):(this.startTime=za.dateNow(),this.endTime=this.startTime+this.movingTime,this.x+=0<this.distanceX?1:-1,this.y+=0<this.distanceY?1:-1),ls.move(this.x,this.y).then(ws).then(function(t){var e=n.holdLeftButton&&n.touchMode?n.dragElement:t;return e?n._emulateEvents(e):null}).then(ya)},cl.prototype._isMovingFinished=function(){return this.x===this.endPoint.x&&this.y===this.endPoint.y},cl.prototype._move=function(){var t=this;return this.startPoint=ls.position,this.x=this.startPoint.x,this.y=this.startPoint.y,this.distanceX=this.endPoint.x-this.startPoint.x,this.distanceY=this.endPoint.y-this.startPoint.y,this.movingTime=Math.max(Math.abs(this.distanceX),Math.abs(this.distanceY))/this.cursorSpeed,this.minMovingTime&&(this.movingTime=Math.max(this.movingTime,this.minMovingTime)),il.whilst(function(){return!t._isMovingFinished()},function(){return t._movingStep()})},cl.prototype._scroll=function(){if(this.skipScrolling)return Ya.resolve();var t=new Ys({offsetX:this.offsetX,offsetY:this.offsetY},!1);return new bs(this.element,t).run()},cl.prototype._moveToCurrentFrame=function(){if(ls.active)return Ya.resolve();var t,e=ls.position,n=e.x,r=e.y,i=ls.activeWindow,o=null,s=null,a={cmd:sl,startX:n,startY:r,endX:this.endPoint.x,endY:this.endPoint.y,modifiers:this.modifiers,speed:this.speed};return i.parent===Rc&&(o=el.findIframeByWindow(i),t=tl.getIframeClientCoordinates(o),a.left=t.left,a.top=t.top,a.right=t.right,a.bottom=t.bottom),ws().then(function(t){return s=t===o,i.parent===Rc&&(a.iframeUnderCursor=s),ol(a,al,i)}).then(function(t){return ls.activeWindow=Rc,s||os(Rc)?ls.move(t.x,t.y):null})},cl.prototype.run=function(){var a=this;return ws().then(function(t){a.dragElement=a.holdLeftButton?t:null;var e,n,r,i,o,s=function(t){for(var e=t;e;){if(e.draggable)return e;e=za.nodeParentNodeGetter.call(e)}return null}(a.dragElement);return s&&ja.hasDataTransfer&&!a.skipDefaultDragBehavior&&(a.dragAndDropState.enabled=!0,a.dragElement=s,a.dragAndDropState.element=a.dragElement,a.dragAndDropState.dataStore=new Za,a.dragAndDropState.dataTransfer=new Qa(a.dragAndDropState.dataStore),((e=el.isAnchorElement(a.dragElement))||el.isImgElement(a.dragElement))&&(n=e?"href":"src",i=(r=Ka.parseProxyUrl(a.dragElement[n]))?r.destUrl:a.dragElement[n],o=qa.cleanUpHtml(za.elementOuterHTMLGetter.call(a.dragElement)),a.dragAndDropState.dataTransfer.setData("text/plain",i),a.dragAndDropState.dataTransfer.setData("text/uri-list",i),a.dragAndDropState.dataTransfer.setData("text/html",o))),a._scroll()}).then(function(){var t=a._getTargetClientPoint(),e=t.x,n=t.y,r=nl.getWidth(Rc),i=nl.getHeight(Rc);return 0<=e&&e<=r&&0<=n&&n<=i?(a.endPoint={x:e,y:n},a._moveToCurrentFrame().then(function(){return a._move()})):null}).then(function(){return a.dragAndDropState})},cl);function cl(t,e){this.touchMode=ja.isTouchDevice,this.moveEvent=this.touchMode?"touchmove":"mousemove",this.holdLeftButton=e.holdLeftButton,this.dragElement=null,this.dragAndDropState=new _a,this.automationSettings=new Es(e.speed);var n=cl.getTarget(t,e.offsetX,e.offsetY);this.element=n.element,this.offsetX=n.offsetX,this.offsetY=n.offsetY,this.speed=e.speed,this.cursorSpeed=this.holdLeftButton?this.automationSettings.draggingSpeed:this.automationSettings.cursorSpeed,this.minMovingTime=e.minMovingTime||null,this.modifiers=e.modifiers||{},this.skipScrolling=e.skipScrolling,this.skipDefaultDragBehavior=e.skipDefaultDragBehavior,this.endPoint=null,this.movingTime=null,this.x=null,this.y=null,this.startTime=null,this.endTime=null,this.distanceX=null,this.distanceY=null,this.firstMovingStepOccured=!1}var ul,dl=o.utils.extend,hl=function(t){var e=t.element,n=void 0===e?null:e,r=t.clientPoint,i=void 0===r?null:r,o=t.screenPoint,s=void 0===o?null:o,a=t.isTarget,l=void 0!==a&&a,c=t.inMoving,u=void 0!==c&&c;this.element=n,this.clientPoint=i,this.screenPoint=s,this.isTarget=l,this.inMoving=u,this.devicePoint=ns(i)},fl=(s(ml,ul=y.serviceUtils.EventEmitter),ml.prototype._getElementForEvent=function(t){var e=t.point;return vs(e.x,e.y,y.positionUtils.containsOffset(this.element,this.options.offsetX,this.options.offsetY)?this.element:null).then(function(t){return t.element})},ml.prototype._moveToElement=function(){var t=this,e=new la(dl({skipScrolling:!0},this.options),!1);return new ll(this.element,e).run().then(function(){return y.delay(t.automationSettings.mouseActionStepDelay)})},ml.prototype._scrollToElement=function(){var s=this,t=new Ys(this.options),e=new bs(this.element,t),a=!1;return e.run().then(function(t){return a=t,y.delay(s.automationSettings.mouseActionStepDelay)}).then(ws).then(function(t){if(!t||!y.domUtils.contains(s.element,t)||!a)return null;var e=Va(),n=y.domUtils.getCommonAncestor(t,e),r=y.positionUtils.getClientPosition(t),i=ns({x:r.x,y:r.y}),o={clientX:r.x,clientY:r.y,screenX:i.x,screenY:i.y,ctrl:!1,alt:!1,shift:!1,meta:!1,buttons:y.eventUtils.BUTTONS_PARAMETER.leftButton};return ba.leaveElement(t,e,n,o),ba.enterElement(t,e,n,o),Xa(t),a})},ml.prototype._getElementOffset=function(){var t=is(this.element),e=this.options,n=e.offsetX,r=e.offsetY;return{offsetX:n=n||0===n?n:t.offsetX,offsetY:r=r||0===r?r:t.offsetY}},ml.prototype._wrapAction=function(t){var d=this,e=this._getElementOffset(),r=e.offsetX,i=e.offsetY,h=es(this.element,r,i),f=y.positionUtils.getClientPosition(this.element);return t().then(function(){var t,e,n,a=es(d.element,r,i),l=y.positionUtils.getClientPosition(d.element),c=(t=d.element,e=a,n=y.styleUtils.getElementScroll(t),!/html/i.test(t.tagName)&&y.styleUtils.hasScroll(t)&&(e.x-=n.left,e.y-=n.top),y.positionUtils.offsetToClientCoords(e)),u=y.positionUtils.containsOffset(d.element,r,i)?d.element:null;return vs(c.x,c.y,u).then(function(t){var e=t.element,n=t.corrected,r=e;if(!r)return new hl({});var i=(i=!u||n||r===d.element)||-1<y.arrayUtils.indexOf(y.domUtils.getParents(r),d.element),o=h.x!==a.x||h.y!==a.y,s=f.x!==l.x||f.y!==l.y;return new hl({element:e,clientPoint:c,screenPoint:a,isTarget:i,inMoving:o&&s})})})},ml._checkElementState=function(t,e){if(!t.element)throw new Error(ys);if(e&&(!t.isTarget||t.inMoving))throw new Error(_s);return t},ml.prototype._ensureElement=function(e,n,r){var i=this;return this._wrapAction(function(){return i._scrollToElement()}).then(function(t){return ml._checkElementState(t,e)}).then(function(t){return r?t:i._wrapAction(function(){return i._moveToElement()})}).then(function(t){return n||ml._checkElementState(t,e),t}).then(function(t){return i.emit(i.TARGET_ELEMENT_FOUND_EVENT,{element:t.element}),{element:t.element,clientPoint:t.clientPoint,screenPoint:t.screenPoint,devicePoint:t.devicePoint}})},ml);function ml(t,e){var n=ul.call(this)||this;return n.TARGET_ELEMENT_FOUND_EVENT="automation|target-element-found-event",n.element=t,n.options=e,n.automationSettings=new Es(e.speed),n}var pl,gl=o.Promise,vl=(s(wl,pl=fl),wl.prototype.run=function(t){var e=this,n=gl.resolve();return this.element!==Nc.scrollingElement&&this.element!==Nc.documentElement&&(n=this._ensureElement(t,!0,!0)),n.then(function(){e.element.scrollLeft=e.scrollLeft,e.element.scrollTop=e.scrollTop})},wl);function wl(t,e,n){var r,i,o,s,a,l=e.x,c=e.y,u=e.position,d=e.byX,h=e.byY,f=pl.call(this,t,n)||this;return u&&(i=t,o=u,s=Math.floor(i.scrollWidth/2-i.clientWidth/2),a=Math.floor(i.scrollHeight/2-i.clientHeight/2),l=(r={top:[s,0],right:[i.scrollWidth,a],bottom:[s,i.scrollHeight],left:[0,a],topRight:[i.scrollWidth,0],topLeft:[0,0],bottomRight:[i.scrollWidth,i.scrollHeight],bottomLeft:[0,i.scrollHeight],center:[s,a]}[o])[0],c=r[1]),f.scrollLeft="number"==typeof l?l:t.scrollLeft,f.scrollTop="number"==typeof c?c:t.scrollTop,d&&(f.scrollLeft+=d),h&&(f.scrollTop+=h),f}var yl,_l=(s(El,yl=fl),El.prototype.run=function(t){return this._ensureElement(t,!0,!0)},El);function El(t,e){return yl.call(this,t,e)||this}function Cl(t,e){if(!y.domUtils.isContentEditableElement(t))throw new Pe(e)}var Sl=l.nativeMethods.date,Il=(Tl.prototype._getSpecificTimeout=function(){return this.command.selector&&"number"==typeof this.command.selector.timeout?this.command.selector.timeout:this.globalSelectorTimeout},Tl.prototype._delayAfterExecution=function(){return this.command.options&&1!==this.command.options.speed?y.delay(2e3*(1-this.command.options.speed)):l.Promise.resolve()},Tl.prototype._isExecutionTimeoutExpired=function(){return l.nativeMethods.dateNow()-this.executionStartTime>=this.commandSelectorTimeout},Tl.prototype._ensureCommandArguments=function(){if(this.command.type===m.pressKey&&y.parseKeySequence(this.command.keys).error)throw new Fe("keys")},Tl.prototype._ensureCommandElements=function(){var e=this,t=[];return this.command.selector&&t.push(Qo(this.command.selector)),this.command.type===m.dragToElement?t.push(Zo(this.command.destinationSelector,"destinationSelector")):this.command.type===m.selectEditableContent?(t.push(Zo(this.command.startSelector,"startSelector")),t.push(Zo(this.command.endSelector||this.command.startSelector,"endSelector"))):this.command.type===m.dispatchEvent&&this.command.relatedTarget&&t.push(Zo(this.command.relatedTarget,"relatedTarget")),$o(t,this.globalSelectorTimeout).then(function(t){e.elements=t})},Tl.prototype._ensureCommandElementsProperties=function(){this.command.type===m.selectText?function(t){if(!y.domUtils.isEditableElement(t))throw new Ie}(this.elements[0]):this.command.type===m.selectTextAreaContent?function(t){if(!y.domUtils.isTextAreaElement(t))throw new be}(this.elements[0]):this.command.type===m.selectEditableContent?(Cl(this.elements[0],"startSelector"),Cl(this.elements[1],"endSelector"),function(t){if(!y.contentEditable.getNearestCommonAncestor(t[0],t[1]))throw new Re}(this.elements)):this.command.type!==m.setFilesToUpload&&this.command.type!==m.clearUpload||function(t){if(!y.domUtils.isFileInput(t))throw new Ge}(this.elements[0])},Tl.prototype._ensureCommandOptions=function(){var t,e,n,r,i;this.elements.length&&this.command.options&&"offsetX"in this.command.options&&"offsetY"in this.command.options&&(t=this.elements[0],e=this.command.options,n=_.getOffsetOptions(t,e.offsetX,e.offsetY),r=n.offsetX,i=n.offsetY,e.offsetX=r,e.offsetY=i)},Tl.prototype._createAutomation=function(){var t;switch(this.command.type){case m.dispatchEvent:return this.elements[1]&&(this.command.options.relatedTarget=this.elements[1]),new _.DispatchEvent(this.elements[0],this.command.eventName,this.command.options);case m.click:return/option|optgroup/.test(y.domUtils.getTagName(this.elements[0]))?new _.SelectChildClick(this.elements[0],this.command.options):new _.Click(this.elements[0],this.command.options);case m.rightClick:return new _.RClick(this.elements[0],this.command.options);case m.doubleClick:return new _.DblClick(this.elements[0],this.command.options);case m.hover:return new _.Hover(this.elements[0],this.command.options);case m.drag:return new _.DragToOffset(this.elements[0],this.command.dragOffsetX,this.command.dragOffsetY,this.command.options);case m.dragToElement:return new _.DragToElement(this.elements[0],this.elements[1],this.command.options);case m.scroll:var e=this.command,n=e.x,r=e.y,i=e.position,o=e.options;return new vl(this.elements[0],{x:n,y:r,position:i},o);case m.scrollBy:var s=this.command,a=s.byX,l=s.byY,o=s.options;return new vl(this.elements[0],{byX:a,byY:l},o);case m.scrollIntoView:return new _l(this.elements[0],this.command.options);case m.typeText:return new _.Type(this.elements[0],this.command.text,this.command.options);case m.selectText:case m.selectTextAreaContent:return t=_.calculateSelectTextArguments(this.elements[0],this.command),new _.SelectText(this.elements[0],t.startPos,t.endPos,this.command.options);case m.selectEditableContent:return new _.SelectEditableContent(this.elements[0],this.elements[1],this.command.options);case m.pressKey:return new _.Press(y.parseKeySequence(this.command.keys).combinations,this.command.options);case m.setFilesToUpload:return new _.Upload(this.elements[0],this.command.filePath,function(t,e){return new Oe(t,e)});case m.clearUpload:return new _.Upload(this.elements[0])}return null},Tl.prototype._runAction=function(e){var n=this;return this._ensureCommandElements().then(function(){return n._ensureCommandElementsProperties()}).then(function(){n._ensureCommandOptions();var t=n._createAutomation();return t.TARGET_ELEMENT_FOUND_EVENT?t.on(t.TARGET_ELEMENT_FOUND_EVENT,function(t){n.targetElement=t.element,n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()}):(n.statusBar.hideWaitingElementStatus(!0),n.executionStartedHandler()),t.run(e)})},Tl.prototype._runRecursively=function(){var e=this,t=!1,n=!0;return y.promiseUtils.whilst(function(){return!t},function(){return e._runAction(n).then(function(){t=!0}).catch(function(t){if(e._isExecutionTimeoutExpired()){if(t.message===_.ERROR_TYPES.foundElementIsNotTarget)return n=!1,l.Promise.resolve();throw t.message===_.ERROR_TYPES.elementIsInvisibleError?new ce:t}return y.delay(250)})})},Tl.prototype.execute=function(){var i=this;return this.command.options&&!this.command.options.speed&&(this.command.options.speed=this.testSpeed),{startPromise:new l.Promise(function(t){i.executionStartedHandler=t}),completionPromise:new l.Promise(function(n){i.executionStartTime=new Sl;try{i._ensureCommandArguments()}catch(t){return void n(new cr({isCommandResult:!0,executionError:t}))}i.commandSelectorTimeout=i._getSpecificTimeout(),i.statusBar.showWaitingElementStatus(i.commandSelectorTimeout);var t=xo(function(){return i._runRecursively()}),e=t.actionPromise,r=t.barriersPromise;e.then(function(){return l.Promise.all([i._delayAfterExecution(),r])}).then(function(){var t={isCommandResult:!0},e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}(i.elements);i.targetElement&&(e[0]=i.targetElement),t.result=Dr(new kr).encode(e),n(new cr(t))}).catch(function(t){return i.statusBar.hideWaitingElementStatus(!1).then(function(){return n(new cr({isCommandResult:!0,executionError:t}))})})})}},Tl);function Tl(t,e,n,r){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.testSpeed=r,this.targetElement=null,this.elements=[],this.ensureElementsPromise=null,this.ensureElementsStartTime=null,this.executionStartTime=null,this.executionStartedHandler=null,this.commandSelectorTimeout=null}function xl(t,e,n){return Math.min(Math.max(e,t),n)}function bl(t,e){var n="number"==typeof t.min,r="number"==typeof t.max,i="number"==typeof t.length;return i&&(t.length=xl(t.length,0,e)),n&&t.min<0&&(t.min+=e),r&&t.max<0&&(t.max+=e),n||(t.min=r&&i?t.max-t.length:0),r||(t.max=i?t.min+t.length:e),t.min=xl(t.min,0,e),t.max=xl(t.max,0,e),t.length=t.max-t.min,t}function Wl(t,e,n){return Math.round(t+xl(e-t,0,n)/2)}var Ml=l.eventSandbox.message,Pl="driver|browser-manipulation|request",Al="driver|browser-manipulation|response";Ml.on(Ml.SERVICE_MSG_RECEIVED_EVENT,function(e){var t,n,r,i,o;e.message.cmd===Pl&&(t=y.domUtils.findIframeByWindow(e.source),r=(n=e.message).command,(i=n.cropDimensions)&&(r.options=new qs({crop:i,includePaddings:!1})),(o=new Dl(r)).element=t,o.execute().then(function(t){return Ml.sendServiceMsg({cmd:Al,result:t},e.source)}))});var Dl=(Rl.prototype._getAbsoluteCropValues=function(){var t=this.element.getBoundingClientRect(),e=t.top,n=t.left;n+=this.command.options.originOffset.x,e+=this.command.options.originOffset.y;var r=n+this.command.options.crop.right,i=e+this.command.options.crop.bottom;return{top:e+=this.command.options.crop.top,left:n+=this.command.options.crop.left,bottom:i,right:r}},Rl.prototype._createManipulationReadyMessage=function(){var t=Rc.devicePixelRatio||1,e={cmd:f.readyForBrowserManipulation,pageDimensions:{dpr:t,innerWidth:Rc.innerWidth,innerHeight:Rc.innerHeight,documentWidth:Nc.documentElement.clientWidth,documentHeight:Nc.documentElement.clientHeight,bodyWidth:Nc.body.clientWidth,bodyHeight:Nc.body.clientHeight},disableResending:!0};return this.command.type===m.takeElementScreenshot&&(e.cropDimensions=this._getAbsoluteCropValues()),e},Rl.prototype._runScrollBeforeScreenshot=function(){var i=this;return l.Promise.resolve().then(function(){if(i.element||!i.command.selector)return l.Promise.resolve();var t=i.command.selector.timeout,e="number"==typeof t?t:i.globalSelectorTimeout;return i.statusBar.showWaitingElementStatus(e),$o([Qo(i.command.selector)],i.globalSelectorTimeout).then(function(t){i.statusBar.hideWaitingElementStatus(),i.element=t[0]}).catch(function(t){throw i.statusBar.hideWaitingElementStatus(),t})}).then(function(){!function(t,e){var n=t.getBoundingClientRect(),r={left:n.left,right:n.right,top:n.top,bottom:n.bottom},i=y.styleUtils.getElementMargin(t),o=y.styleUtils.getElementPadding(t),s=y.styleUtils.getBordersWidth(t);e.originOffset={x:0,y:0};var a=r.left+t.scrollWidth+s.left+s.right,l=r.top+t.scrollHeight+s.top+s.bottom;r.right=Math.max(r.right,a),r.bottom=Math.max(r.bottom,l),e.includeBorders&&e.includePaddings?e.includeMargins&&(e.originOffset.x-=i.left,e.originOffset.y-=i.top,r.left-=i.left,r.top-=i.top,r.right+=i.right,r.bottom+=i.bottom):(e.originOffset.x+=s.left,e.originOffset.y+=s.top,r.left+=s.left,r.top+=s.top,r.right-=s.right,r.bottom-=s.bottom,e.includePaddings||(e.originOffset.x+=o.left,e.originOffset.y+=o.top,r.left+=o.left,r.top+=o.top,r.right-=o.right,r.bottom-=o.bottom)),r.width=r.right-r.left,r.height=r.bottom-r.top;var c=bl({min:e.crop.left,max:e.crop.right,length:e.crop.width},r.width),u=bl({min:e.crop.top,max:e.crop.bottom,length:e.crop.height},r.height);if(e.crop.left=c.min,e.crop.right=c.max,e.crop.width=c.length,e.crop.top=u.min,e.crop.bottom=u.max,e.crop.height=u.length,e.crop.width<=0||e.crop.height<=0)throw new qe(e.crop.width,e.crop.height);var d=y.styleUtils.getViewportDimensions();(r.width>d.width||r.height>d.height)&&(e.scrollToCenter=!0);var h="number"==typeof e.scrollTargetX,f="number"==typeof e.scrollTargetY;h||(e.scrollTargetX=Wl(e.crop.left,e.crop.right,d.width)),f||(e.scrollTargetY=Wl(e.crop.top,e.crop.bottom,d.height));var m=_.getOffsetOptions(t,e.scrollTargetX,e.scrollTargetY),p=m.offsetX,g=m.offsetY;e.scrollTargetX=p,e.scrollTargetY=g;var v=!h||e.scrollTargetX>=e.crop.left&&e.scrollTargetX<=e.crop.right,w=!f||e.scrollTargetY>=e.crop.top&&e.scrollTargetY<=e.crop.bottom;if(!v||!w)throw new Ye(v,w)}(i.element,i.command.options);var t=i.command.options,e=t.scrollTargetX,n=t.scrollTargetY,r=t.scrollToCenter;return new _.Scroll(i.element,new Ys({offsetX:e,offsetY:n,scrollToCenter:r,skipParentFrames:!0})).run()})},Rl.prototype._hideUI=function(){return n.hide(),this.command.markData&&n.showScreenshotMark(this.command.markData),y.delay(500)},Rl.prototype._showUI=function(){this.command.markData&&n.hideScreenshotMark(),n.show()},Rl.prototype._requestManipulation=function(){if(!os(Rc))return l.transport.queuedAsyncServiceMsg(this._createManipulationReadyMessage());var t=this._getAbsoluteCropValues();return y.sendRequestToFrame({cmd:Pl,command:this.command,cropDimensions:t},Al,Rc.parent).then(function(t){if(!t.result)return{result:null};var e=t.result,n=e.result,r=e.executionError;if(r)throw r;return{result:n}})},Rl.prototype._runManipulation=function(){var r=this,i=null;return l.Promise.resolve().then(function(){return r.command.type!==m.takeElementScreenshot?l.Promise.resolve():(y.scrollController.stopPropagation(),r._runScrollBeforeScreenshot())}).then(function(){return os(Rc)?l.Promise.resolve():r._hideUI()}).then(function(){return r._requestManipulation()}).then(function(t){var e=t.result,n=t.error;if(n)throw n;return y.scrollController.enablePropagation(),i=e,os(Rc)||r._showUI(),y.delay(200)}).then(function(){return new cr({isCommandResult:!0,result:i})}).catch(function(t){return y.scrollController.enablePropagation(),new cr({isCommandResult:!0,executionError:t})})},Rl.prototype.execute=function(){var t=this;return xo(function(){return t._runManipulation()}).barriersPromise},Rl);function Rl(t,e,n){this.command=t,this.globalSelectorTimeout=e,this.statusBar=n,this.element=null}var Nl=o.Promise,kl=(Fl.prototype.setAsMaster=function(t){return vo(new Ki(t),this.driverWindow,wo,fn)},Fl.prototype.closeAllChildWindows=function(){return vo(new Qi,this.driverWindow,wo,gn)},Fl.prototype.findChildWindows=function(t,e){return vo(new e(t),this.driverWindow,wo,fn)},Fl.prototype.startToRestore=function(){return vo(new eo,this.driverWindow,wo,fn)},Fl);function Fl(t,e){this.driverWindow=t,this.windowId=e}var Ll=(Ul.prototype._getTopOpenedWindow=function(t){for(var e=t;e.opener;)e=e.opener;return e.top},Ul.prototype._setAsMaster=function(t,e){return vo(new Ki(e),t,wo,fn)},Ul.prototype.getTopOpenedWindow=function(){return this._getTopOpenedWindow(this.currentDriverWindow)},Ul.prototype.setTopOpenedWindowAsMaster=function(){var t=this._getTopOpenedWindow(this.currentDriverWindow);return this._setAsMaster(t)},Ul.prototype.setParentWindowAsMaster=function(t){void 0===t&&(t={});var e=this.currentDriverWindow.opener;return this._setAsMaster(e,t.finalizePendingCommand)},Ul.prototype.restoreChild=function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){return e=new io(r),n=this.currentDriverWindow.opener,vo(e,n,wo,fn),[2]})})},Ul);function Ul(t){this.currentDriverWindow=t}var Ol,Bl="master",Hl="replica",Gl=o.settings,Vl=o.transport,Xl=o.Promise,Yl=o.eventSandbox.message,zl=o.storages,jl=o.nativeMethods,ql=jl.date,Kl=o.eventSandbox.listeners,Jl="testcafe|driver|test-done-sent-flag",$l="testcafe|driver|pending-status",Ql="testcafe|driver|executing-client-function-descriptor",Zl="testcafe|driver|selector-execution-start-time",tc="testcafe|driver|pending-page-error",ec="testcafe|driver|active-iframe-selector",nc="testcafe|driver|test-speed",rc="testcafe|driver|assertion-retries-timeout",ic="testcafe|driver|assertion-retries-start-time",oc="testcafe|driver|console-messages",sc="testcafe|driver|pending-child-window-count",ac={NotLoadedError:tn,NotFoundError:se,IsInvisibleError:ce},lc={NotLoadedError:rn,NotFoundError:Gn,IsInvisibleError:Yn},cc=Math.pow(2,31)-1,uc="status-with-command-result-event",dc="empty-command-event",hc="child-window-closed",fc=(s(mc,Ol=y.serviceUtils.EventEmitter),mc.prototype._isOpenedInIframe=function(){var t=Rc.opener;return t&&t.top&&t.top!==t},Object.defineProperty(mc.prototype,"speed",{get:function(){return this.contextStorage.getItem(nc)},set:function(t){this.contextStorage.setItem(nc,t)},enumerable:!1,configurable:!0}),Object.defineProperty(mc.prototype,"consoleMessages",{get:function(){return new rr(this.contextStorage.getItem(oc))},set:function(t){return this.contextStorage.setItem(oc,t?t.getCopy():null)},enumerable:!1,configurable:!0}),mc.prototype._getReadyPromise=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,y.eventUtils.documentReady(this.pageLoadTimeout)];case 1:return t.sent(),[4,this.pageInitialRequestBarrier.wait(!0)];case 2:return t.sent(),[2]}})})},mc.prototype._hasPendingActionFlags=function(t){return t.getItem(this.COMMAND_EXECUTING_FLAG)||t.getItem(this.EXECUTING_IN_IFRAME_FLAG)},mc.prototype._getCurrentWindowId=function(){var t=Rc.location.toString(),e=o.utils.url.parseProxyUrl(t);return e&&e.windowId||null},mc.prototype._onJsError=function(t){if(this.skipJsErrors||this.contextStorage.getItem(Jl))return Xl.resolve();var e=new Rt(t.stack,t.pageUrl);return this.contextStorage.getItem(tc)||this.contextStorage.setItem(tc,e),null},mc.prototype._unlockPageAfterTestIsDone=function(){return y.disableRealEventsPreventing(),Xl.resolve()},mc.prototype._getActiveElement=function(){return c(this,void 0,void 0,function(){var e;return u(this,function(t){return e=y.domUtils.getActiveElement(),[2,this.replicator.encode(e)]})})},mc.prototype._failIfClientCodeExecutionIsInterrupted=function(){var t=this.contextStorage.getItem(Ql);return!!t&&(this._onReady(new cr({isCommandResult:!0,executionError:new wt(t.instantiationCallsiteName)})),!0)},mc.prototype.onCustomClientScriptError=function(t,e){var n=e?new Yt(t,e):new Gt(t);this.contextStorage.getItem(tc)||this.contextStorage.setItem(tc,n)},mc.prototype._addChildWindowDriverLink=function(t){var e=new kl(t.window,t.windowId);this.childWindowDriverLinks.push(e),this._ensureClosedChildWindowWatcher()},mc.prototype._ensureClosedChildWindowWatcher=function(){var e=this;this.checkClosedChildWindowIntervalId||(this.checkClosedChildWindowIntervalId=jl.setInterval.call(Rc,function(){var t=y.arrayUtils.find(e.childWindowDriverLinks,function(t){return t.driverWindow.closed});t&&(e.emit(hc),y.arrayUtils.remove(e.childWindowDriverLinks,t),t.ignoreMasterSwitching||e._setCurrentWindowAsMaster(),e.childWindowDriverLinks.length||(jl.clearInterval.call(Rc,e.checkClosedChildWindowIntervalId),delete e.checkClosedChildWindowIntervalId))},200))},mc.prototype._setAsMasterInProgressOrCompleted=function(){return this.setAsMasterInProgress||this.role===Bl},mc.prototype._setCurrentWindowAsMaster=function(){var t=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,this._clearActiveChildIframeInfo(),Xl.resolve().then(function(){return y.browser.setActiveWindowId(t.browserActiveWindowId,o.createNativeXHR,t.windowId)}).then(function(){t._startInternal({finalizePendingCommand:!0,isFirstRequestAfterWindowSwitching:!0}),t.setAsMasterInProgress=!1}).catch(function(){t._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},mc.prototype._onChildWindowOpened=function(t){this._addChildWindowDriverLink(t),this._switchToChildWindow(t.windowId)},mc.prototype._sendStartToRestoreCommand=function(){if(this.contextStorage){this._stopRespondToChildren=!0,this.contextStorage.setItem(sc,this.childWindowDriverLinks.length);for(var t=0,e=this.childWindowDriverLinks;t<e.length;t++)e[t].startToRestore()}},mc.prototype._onFormSubmit=function(t){this.contextStorage&&this.contextStorage.getItem(Jl)&&(t.preventSubmit=!0)},mc.prototype._onConsoleMessage=function(t){var e=t.meth,n=t.line,r=this.consoleMessages;r.addMessage(e,n,this.windowId),this.consoleMessages=r},mc.prototype._addPendingErrorToStatus=function(t){var e=this.contextStorage.getItem(tc);e&&(this.contextStorage.setItem(tc,null),t.pageError=e)},mc.prototype._addUnexpectedDialogErrorToStatus=function(t){var e=this.nativeDialogsTracker.getUnexpectedDialogError();t.pageError=t.pageError||e},mc.prototype._addConsoleMessagesToStatus=function(t){t.consoleMessages=this.consoleMessages,this.consoleMessages=null},mc.prototype._addPendingWindowSwitchingStateToStatus=function(t){t.isPendingWindowSwitching=!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._sendStatusRequest=function(t){function e(){return y.getTimeLimitedPromise(Vl.asyncServiceMsg(r),5e3)}function n(){return y.delay(300).then(e)}for(var r={cmd:f.ready,status:t,disableResending:!0,allowRejecting:!0},i=e(),o=0;o<h;o++)i=i.catch(n);return i},mc.prototype._sendStatus=function(t){var e=this;t.resent||(this._addPendingErrorToStatus(t),this._addUnexpectedDialogErrorToStatus(t),this._addConsoleMessagesToStatus(t),this._addPendingWindowSwitchingStateToStatus(t)),this.contextStorage.setItem($l,t);var n=null;return y.pageUnloadBarrier.wait(0).then(function(){return e._sendStatusRequest(t)}).then(function(t){return n=t,y.pageUnloadBarrier.wait(0)}).then(function(){return e.contextStorage.setItem($l,null),n})},mc.prototype._addChildIframeDriverLink=function(t,e){var n,r=this._getChildIframeDriverLinkByWindow(e);r||(n=this.testRunId+"-"+ar(),r=new _o(e,n),this.childIframeDriverLinks.push(r)),r.sendConfirmationMessage(t)},mc.prototype._getTargetWindowNotFoundResult=function(t,e){return Xl.resolve({success:!1,errCode:t,errMsg:e})},mc.prototype._getChildWindowValidateResult=function(t){var e=t.find(function(t){return t.result.success});if(e)return e.result;var n=t.find(function(t){return t.result.errCode===rt||t.result.errCode===lt});return(n=n||t.find(function(t){return!!t.result.errCode}))?{errCode:n.result.errCode}:void 0},mc.prototype._handleWindowValidation=function(n,r,i,o){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._validateWindow(n,r,i,o)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},mc.prototype._getWindowInfo=function(){var t=o.utils.url.parseProxyUrl(Rc.location.toString());return{id:this.windowId,title:Nc.title,url:t.destUrl}},mc.prototype._isTargetWindow=function(t){return t.windowId===this.windowId},mc.prototype._validateWindow=function(r,t,i,o){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return this._isTargetWindow(r)?[2,i()]:this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(r,o)}),[4,Xl.all(e)]):[2,this._getTargetWindowNotFoundResult(it)];case 1:return n=t.sent(),[2,this._getChildWindowValidateResult(n)]}})})},mc._createWindowValidationError=function(t){var e=t.errCode;return new(e===rt?yn:e===lt?Sn:bn)},mc.prototype._getCloseWindowFoundResult=function(){return this.parentWindowDriverLink?this.childWindowDriverLinks.length?Xl.resolve({success:!1,errCode:rt}):Xl.resolve({success:!0}):Xl.resolve({success:!1,errCode:lt})},mc.prototype._handleCloseWindowValidation=function(t,e){var n=this;return this._handleWindowValidation(t,e,function(){return n._getCloseWindowFoundResult()},Ci)},mc.prototype._handleSwitchToWindowValidation=function(t,e){return this._handleWindowValidation(t,e,function(){return Xl.resolve({success:!0})},Ti)},mc.prototype._handleCloseWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._closeWindow(e,n)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},mc.prototype._closeWindowAndWait=function(t,e){var n=this._createWaitForEventPromise(hc,2e3);return t.ignoreMasterSwitching=!e.isCurrentWindow,t.driverWindow.close(),n},mc.prototype._closeWindow=function(e){if(!this.childWindowDriverLinks.length)return Xl.resolve();var t=this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId});if(t)return this._closeWindowAndWait(t,e);var n=this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Ai)});return Xl.all(n)},mc.prototype._getWindows=function(){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(this,function(t){switch(t.label){case 0:return this.childWindowDriverLinks.length?(e=this.childWindowDriverLinks.map(function(t){return t.findChildWindows({},Wi)}),[4,Xl.all(e)]):[2,[this._getWindowInfo()]];case 1:for(n=t.sent(),r=[this._getWindowInfo()],i=0,o=n;i<o.length;i++)s=o[i],Array.isArray(s.result)&&(r=r.concat(s.result));return[2,r]}})})},mc.prototype._handleGetWindows=function(n,r){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this._getWindows(n,r)];case 1:return e=t.sent(),yo({requestMsgId:n.id,window:r,result:e}),[2]}})})},mc.prototype._handleSwitchToWindow=function(e,n){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this._switchToWindow(e)];case 1:return t.sent(),yo({requestMsgId:e.id,window:n}),[2]}})})},mc.prototype._switchToWindow=function(e){var t=this;return this._isTargetWindow(e)?Xl.resolve().then(function(){t._setCurrentWindowAsMaster()}):this.childWindowDriverLinks.length?Xl.all(this.childWindowDriverLinks.map(function(t){return t.findChildWindows(e,Ni)})):Xl.resolve()},mc.prototype._handleSetAsMasterMessage=function(t,e){var n=this;this._setAsMasterInProgressOrCompleted()||(this.setAsMasterInProgress=!0,yo({requestMsgId:t.id,window:e}),Xl.resolve().then(function(){return y.browser.setActiveWindowId(n.browserActiveWindowId,o.createNativeXHR,n.windowId)}).then(function(){n._startInternal({finalizePendingCommand:t.finalizePendingCommand,result:{id:n.windowId}}),n.setAsMasterInProgress=!1}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new fn}))}))},mc.prototype._handleCloseAllWindowsMessage=function(t,e){var n=this;this._closeAllChildWindows().then(function(){yo({requestMsgId:t.id,window:e})}).catch(function(){n._onReady(new cr({isCommandResult:!0,executionError:new gn}))})},mc.prototype._handleStartToRestoreChildLinkMessage=function(){this.parentWindowDriverLink.restoreChild(this._getCurrentWindowId())},mc.prototype._handleRestoreChildLink=function(t,e){this._stopRespondToChildren||(this._addChildWindowDriverLink({window:e,windowId:t.windowId}),this.childWindowDriverLinks.length===this.contextStorage.getItem(sc)&&this._restoreChildWindowsPromiseResolver&&(this._restoreChildWindowsPromiseResolver(),delete this._restoreChildWindowsPromiseResolver,this.contextStorage.setItem(sc,0)),yo({requestMsgId:t.id,window:e}))},mc.prototype._handleChildWindowIsOpenedInIFrame=function(){var e=this;this._pendingChildWindowInIFrame=new Xl(function(t){e._resolvePendingChildWindowInIframe=t})},mc.prototype._handleChildWindowIsLoadedInIFrame=function(e,t){yo({requestMsgId:e.id,window:t}),this._resolvePendingChildWindowInIframe(),this.childWindowDriverLinks.find(function(t){return t.windowId===e.windowId})||this._onChildWindowOpened({window:t,windowId:e.windowId})},mc.prototype._initChildDriverListening=function(){var r=this;Yl.on(Yl.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message,n=t.source;switch(e.type){case ri:r._addChildIframeDriverLink(e.id,n);break;case wi:r._handleChildWindowIsOpenedInIFrame(e,n);break;case vi:r._handleChildWindowIsLoadedInIFrame(e,n);break;case fi:r._handleSetAsMasterMessage(e,n);break;case ii:r._handleSwitchToWindow(e,n);break;case oi:r._handleCloseWindow(e,n);break;case ai:r._handleSwitchToWindowValidation(e,n);break;case si:r._handleCloseWindowValidation(e,n);break;case li:r._handleGetWindows(e,n);break;case mi:r._handleCloseAllWindowsMessage(e,n);break;case pi:r._handleStartToRestoreChildLinkMessage();break;case gi:r._handleRestoreChildLink(e,n)}})},mc.prototype._getChildIframeDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childIframeDriverLinks,function(t){return t.driverWindow===e})},mc.prototype._getChildWindowDriverLinkByWindow=function(e){return y.arrayUtils.find(this.childWindowDriverLinks,function(t){return t.driverWindow===e})},mc.prototype._runInActiveIframe=function(t){var e=this,n=Xl.resolve(),r=this.contextStorage.getItem(ec);!this.activeChildIframeDriverLink&&r&&(n=this._switchToIframe(r,lc)),n.then(function(){return e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!0),e.activeChildIframeDriverLink.executeCommand(t,e.speed)}).then(function(t){return e._onCommandExecutedInIframe(t)}).catch(function(t){return e._onCommandExecutedInIframe(new cr({isCommandResult:!0,executionError:t}))})},mc.prototype._onCommandExecutedInIframe=function(t){var e=this;this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1);var n=Xl.resolve();this._pendingChildWindowInIFrame&&(n=this._pendingChildWindowInIFrame),n.then(function(){e._onReady(t)})},mc.prototype._ensureChildIframeDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildIframeDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},mc.prototype._ensureChildWindowDriverLink=function(t,e,n){var r=this;return y.waitFor(function(){return r._getChildWindowDriverLinkByWindow(t)},500,n).catch(function(){throw new e})},mc.prototype._switchToIframe=function(e,n){var t,r,i,o,s,a,l,c=this,u="number"==typeof e.timeout?e.timeout:this.selectorTimeout;return t=e,r=u,i=null,o=function(t){return new n.NotFoundError(t)},s=function(){return new n.IsInvisibleError},a=this.statusBar,l=new zo(t,r,i,o,s),a.showWaitingElementStatus(l.timeout),l.getResult().then(function(t){return a.hideWaitingElementStatus(!!t).then(function(){return t})}).catch(function(t){return a.hideWaitingElementStatus(!1).then(function(){throw t})}).then(function(t){if(!y.domUtils.isIframeElement(t))throw new $e;return c._ensureChildIframeDriverLink(jl.contentWindowGetter.call(t),n.NotLoadedError,u)}).then(function(t){t.availabilityTimeout=u,c.activeChildIframeDriverLink=t,c.contextStorage.setItem(ec,e)})},mc.prototype._createWaitForEventPromise=function(e,n){var r=this,i=null,t=new Xl(function(t){jl.setTimeout.call(Rc,function(){r.off(e,i),t()},n)}),o=new Xl(function(t){i=function(){this.off(e,i),t()},r.on(e,i)});return Xl.race([t,o])},mc.prototype._waitForCurrentCommandCompletion=function(){return this.contextStorage.getItem(this.COMMAND_EXECUTING_FLAG)?this._createWaitForEventPromise(uc,cc):Xl.resolve()},mc.prototype._waitForEmptyCommand=function(){return this._createWaitForEventPromise(dc,3e4)},mc.prototype._abortSwitchingToChildWindowIfItClosed=function(){if(this.activeChildWindowDriverLink.driverWindow.closed)throw y.arrayUtils.remove(this.childWindowDriverLinks,this.activeChildWindowDriverLink),this.activeChildWindowDriverLink=null,new Fn},mc.prototype._switchToChildWindow=function(t){var e=this;this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0);var n=this.contextStorage.getItem(this.WINDOW_COMMAND_API_CALL_FLAG);return function(e,t){if("string"!=typeof e)return Nl.resolve(null);var n=y.arrayUtils.find(t,function(t){return t.windowId===e});if(n)return Nl.resolve(n);var r=new an;return Nl.reject(r)}(t,this.childWindowDriverLinks).then(function(t){return e._ensureChildWindowDriverLink(t.driverWindow,un,e.childWindowReadyTimeout)}).then(function(t){return e.activeChildWindowDriverLink=t,e._waitForCurrentCommandCompletion()}).then(function(){return n?void 0:e._waitForEmptyCommand()}).then(function(){return e._abortSwitchingToChildWindowIfItClosed(),e._stopInternal(),e.activeChildWindowDriverLink.setAsMaster(n)}).then(function(){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(t){e.contextStorage.setItem(e.PENDING_WINDOW_SWITCHING_FLAG,!1),t instanceof Fn?e._onReady(new cr):e._onReady(new cr({isCommandResult:!0,executionError:new fn}))})},mc.prototype._switchToTopParentWindow=function(){var t=this.parentWindowDriverLink.setTopOpenedWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(t)},mc.prototype._switchToParentWindow=function(t){void 0===t&&(t={});var e=this.parentWindowDriverLink.setParentWindowAsMaster.bind(this.parentWindowDriverLink);this._switchToParentWindowInternal(e,t)},mc.prototype._switchToParentWindowInternal=function(t,e){var n=this;return void 0===e&&(e={}),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!0),Xl.resolve().then(function(){return n._stopInternal(),t(e)}).then(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1)}).catch(function(){n.contextStorage.setItem(n.PENDING_WINDOW_SWITCHING_FLAG,!1),n._onReady(new cr({isCommandResult:!0,executionError:new fn}))})},mc.prototype._switchToMainWindow=function(t){this.activeChildIframeDriverLink&&this.activeChildIframeDriverLink.executeCommand(t),this._clearActiveChildIframeInfo()},mc.prototype._clearActiveChildIframeInfo=function(){this.contextStorage.setItem(ec,null),this.activeChildIframeDriverLink=null},mc.prototype._setNativeDialogHandlerInIframes=function(t){for(var e=new zi(t),n=0;n<this.childIframeDriverLinks.length;n++)Yl.sendServiceMsg(e,this.childIframeDriverLinks[n].driverWindow)},mc.prototype._onActionCommand=function(t){var e,n,r,i,o=this,s=(e=t,n=this.selectorTimeout,r=this.statusBar,i=this.speed,new Il(e,n,r,i).execute()),a=s.startPromise,l=s.completionPromise;a.then(function(){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!0)}),l.then(function(t){return o.contextStorage.setItem(o.COMMAND_EXECUTING_FLAG,!1),o._onReady(t)})},mc.prototype._onSetNativeDialogHandlerCommand=function(t){this.nativeDialogsTracker.setHandler(t.dialogHandler),this._setNativeDialogHandlerInIframes(t.dialogHandler),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onGetNativeDialogHistoryCommand=function(){this._onReady(new cr({isCommandResult:!0,result:this.nativeDialogsTracker.appearedDialogs}))},mc.prototype._onGetBrowserConsoleMessagesCommand=function(){this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onNavigateToCommand=function(t){var e=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),function(r){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new y.RequestBarrier,l.navigateTo(r.url,r.forceReload),[4,l.Promise.all([e.wait(),y.pageUnloadBarrier.wait()])];case 1:return t.sent(),[2,new cr({isCommandResult:!0})];case 2:return n=t.sent(),[2,new cr({isCommandResult:!0,executionError:n})];case 3:return[2]}})})}(t).then(function(t){return e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e._onReady(t)})},mc.prototype._onExecuteClientFunctionCommand=function(t){var e=this;this.contextStorage.setItem(Ql,{instantiationCallsiteName:t.instantiationCallsiteName}),new Hr(t).getResultDriverStatus().then(function(t){e.contextStorage.setItem(Ql,null),e._onReady(t)})},mc.prototype._onExecuteSelectorCommand=function(t){var e,n,r,i,o,s,a,l=this,c=this.contextStorage.getItem(Zl)||new ql,u=t.needError?function(t){return new Pt(null,t)}:null;e=t,n=this.selectorTimeout,r=c,o=i=u,s=this.statusBar,a=new zo(e,n,r,i,o),s.showWaitingElementStatus(a.timeout),a.getResultDriverStatus().then(function(t){return s.hideWaitingElementStatus(!!t.result).then(function(){return t})}).then(function(t){l.contextStorage.setItem(Zl,null),l._onReady(t)})},mc.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onSwitchToIframeCommand=function(t){var e=this;this._switchToIframe(t.selector,ac).then(function(){return e._onReady(new cr({isCommandResult:!0}))}).catch(function(t){return e._onReady(new cr({isCommandResult:!0,executionError:t}))})},mc.prototype._onWindowOpenCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!0),Rc.open(t.url)},mc.prototype._onWindowCloseCommand=function(a){return c(this,void 0,void 0,function(){var e,n,r,i,o,s;return u(this,function(t){switch(t.label){case 0:e=this._getTopOpenedWindow(),n=a.windowId||this.windowId,r=n===this.windowId,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,this._validateChildWindowCloseCommandExists(n,e)];case 2:if(i=t.sent(),!(o=i.result).success)throw mc._createWindowValidationError(o);return[4,vo(new Ai({windowId:n,isCurrentWindow:r}),e,wo,fn)];case 3:return t.sent(),r||this._onReady(new cr({isCommandResult:!0})),[3,5];case 4:return s=t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:s})),[3,5];case 5:return[2]}})})},mc.prototype._onGetCurrentWindowCommand=function(){this._onReady(new cr({isCommandResult:!0,result:{id:this.windowId}}))},mc.prototype._onGetWindowsCommand=function(){return c(this,void 0,void 0,function(){var e,n;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,vo(new Wi,e,wo,fn)];case 1:return n=t.sent(),this._onReady(new cr({isCommandResult:!0,result:n.result})),[2]}})})},mc.prototype._validateChildWindowCloseCommandExists=function(t,e){return vo(new Ci({windowId:t}),e,wo,fn)},mc.prototype._validateChildWindowSwitchToWindowCommandExists=function(t,e){var n=t.windowId,r=t.fn;return vo(new Ti({windowId:n,fn:r}),e,wo,fn)},mc.prototype._getTopOpenedWindow=function(){var t;return((null===(t=this.parentWindowDriverLink)||void 0===t?void 0:t.getTopOpenedWindow())||Rc).top},mc.prototype._onSwitchToWindow=function(i,o){return c(this,void 0,void 0,function(){var e,n,r;return u(this,function(t){switch(t.label){case 0:return e=this._getTopOpenedWindow(),[4,this._validateChildWindowSwitchToWindowCommandExists({windowId:i.windowId,fn:i.findWindow},e)];case 1:return n=t.sent(),(r=n.result).success?(this._stopInternal(),vo(new Ni({windowId:i.windowId,fn:i.findWindow}),e,wo,fn)):this._onReady(new cr({isCommandResult:!0,executionError:o||mc._createWindowValidationError(r)})),[2]}})})},mc.prototype._restoreChildWindowLinks=function(){return c(this,void 0,void 0,function(){var e,n=this;return u(this,function(t){switch(t.label){case 0:if(!this.contextStorage.getItem(sc))return[2];e=new Xl(function(t){n._restoreChildWindowsPromiseResolver=t}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,y.getTimeLimitedPromise(e,3e4)];case 2:return t.sent(),[3,4];case 3:return t.sent(),this._onReady(new cr({isCommandResult:!0,executionError:new On})),[3,4];case 4:return[2]}})})},mc.prototype._onSwitchToPreviousWindow=function(t){this._onSwitchToWindow(t,new Rn)},mc.prototype._onSwitchToParentWindow=function(){this.parentWindowDriverLink?this._switchToParentWindow({finalizePendingCommand:!0}):this._onReady(new cr({isCommandResult:!0,executionError:new Pn}))},mc.prototype._onBrowserManipulationCommand=function(t){var e,n,r,i=this;this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!0),e=t,n=this.selectorTimeout,r=this.statusBar,new Dl(e,n,r).execute().then(function(t){return i.contextStorage.setItem(i.COMMAND_EXECUTING_FLAG,!1),i._onReady(t)})},mc.prototype._onSetBreakpointCommand=function(t){var e=this;this.statusBar.showDebuggingStatus(t).then(function(t){return e._onReady(new cr({isCommandResult:!0,result:t}))})},mc.prototype._onSetTestSpeedCommand=function(t){this.speed=t.speed,this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onShowAssertionRetriesStatusCommand=function(t){this.contextStorage.setItem(rc,t.timeout),this.contextStorage.setItem(ic,jl.dateNow()),this.statusBar.showWaitingAssertionRetriesStatus(t.timeout),this._onReady(new cr({isCommandResult:!0}))},mc.prototype._onHideAssertionRetriesStatusCommand=function(t){var e=this;this.contextStorage.setItem(rc,null),this.contextStorage.setItem(ic,null),this.statusBar.hideWaitingAssertionRetriesStatus(t.success).then(function(){return e._onReady(new cr({isCommandResult:!0}))})},mc.prototype._checkStatus=function(){var r=this;return y.browser.checkStatus(this.browserStatusDoneUrl,o.createNativeXHR,{manualRedirect:!0}).then(function(t){var e=t.command,n=t.redirecting;n&&e.url.indexOf(r.testRunId)<0?(zl.clear(),zl.lock()):r.contextStorage.setItem(Jl,!1),n?y.browser.redirect(e):r._onReady({isCommandResult:!1})}).catch(function(){return y.delay(1e3)})},mc.prototype._onCustomCommand=function(t){var e=this;(0,this.customCommandHandlers[t.type].handler)(t).then(function(t){e._onReady(new cr({isCommandResult:!0,result:t}))})},mc.prototype._closeAllChildWindows=function(){var t=this;return this.childWindowDriverLinks.length?Xl.all(this.childWindowDriverLinks.map(function(t){return t.closeAllChildWindows()})).then(function(){jl.arrayForEach.call(t.childWindowDriverLinks,function(t){t.driverWindow.close()})}):Xl.resolve()},mc.prototype._onTestDone=function(t){var e=this;this.contextStorage.setItem(Jl,!0),this.parentWindowDriverLink?this._switchToTopParentWindow():this._closeAllChildWindows().then(function(){return e._sendStatus(t)}).then(function(){e._checkStatus()}).catch(function(){e._onReady(new cr({isCommandResult:!0,executionError:gn}))})},mc.prototype._onBackupStoragesCommand=function(){this._onReady(new cr({isCommandResult:!0,result:zl.backup()}))},mc.prototype._isStatusWithCommandResultInPendingWindowSwitchingMode=function(t){return t.isCommandResult&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._isEmptyCommandInPendingWindowSwitchingMode=function(t){return!t&&!!this.contextStorage.getItem(this.PENDING_WINDOW_SWITCHING_FLAG)},mc.prototype._onReady=function(t){var e=this;this._isStatusWithCommandResultInPendingWindowSwitchingMode(t)&&this.emit(uc),this._sendStatus(t).then(function(t){if(t)e._onCommand(t);else{if(e._isEmptyCommandInPendingWindowSwitchingMode(t))return void e.emit(dc);e._onReady(new cr)}})},mc.prototype._executeCommand=function(t){this.contextStorage.setItem(this.WINDOW_COMMAND_API_CALL_FLAG,!1),this.customCommandHandlers[t.type]?this._onCustomCommand(t):t.type===m.testDone?this._onTestDone(new cr({isCommandResult:!0})):t.type===m.setBreakpoint?this._onSetBreakpointCommand(t.isTestError):t.type===m.switchToMainWindow?this._onSwitchToMainWindowCommand(t):t.type===m.switchToIframe?this._onSwitchToIframeCommand(t):t.type===m.openWindow?this._onWindowOpenCommand(t):t.type===m.closeWindow?this._onWindowCloseCommand(t):t.type===m.getCurrentWindow?this._onGetCurrentWindowCommand(t):t.type===m.getCurrentWindows?this._onGetWindowsCommand():t.type===m.switchToWindow?this._onSwitchToWindow(t):t.type===m.switchToPreviousWindow?this._onSwitchToPreviousWindow(t):t.type===m.switchToParentWindow?this._onSwitchToParentWindow():ht(t)?this._onBrowserManipulationCommand(t):t.type===m.executeClientFunction?this._onExecuteClientFunctionCommand(t):t.type===m.executeSelector?this._onExecuteSelectorCommand(t):t.type===m.navigateTo?this._onNavigateToCommand(t):t.type===m.setNativeDialogHandler?this._onSetNativeDialogHandlerCommand(t):t.type===m.getNativeDialogHistory?this._onGetNativeDialogHistoryCommand(t):t.type===m.getBrowserConsoleMessages?this._onGetBrowserConsoleMessagesCommand(t):t.type===m.setTestSpeed?this._onSetTestSpeedCommand(t):t.type===m.showAssertionRetriesStatus?this._onShowAssertionRetriesStatusCommand(t):t.type===m.hideAssertionRetriesStatus?this._onHideAssertionRetriesStatusCommand(t):t.type===m.backupStorages?this._onBackupStoragesCommand():this._onActionCommand(t)},mc.prototype._isExecutableInTopWindowOnly=function(t){if((e=t).type===m.testDone||e.type===m.switchToMainWindow||e.type===m.setNativeDialogHandler||e.type===m.getNativeDialogHistory||e.type===m.setTestSpeed||e.type===m.showAssertionRetriesStatus||e.type===m.hideAssertionRetriesStatus||e.type===m.setBreakpoint||ht(e)&&e.type!==m.takeElementScreenshot)return!0;var e,n=this.customCommandHandlers[t.type];return t.forceExecutionInTopWindowOnly||n&&n.isExecutableInTopWindowOnly},mc.prototype._onCommand=function(n){var r=this;this.readyPromise.then(function(){var t,e=ut(n);r.contextStorage.getItem(tc)&&e?r._onReady(new cr({isCommandResult:!0})):(t=r.activeChildIframeDriverLink||r.contextStorage.getItem(ec),r._isExecutableInTopWindowOnly(n)||!t?r._executeCommand(n):r._runInActiveIframe(n))})},mc.prototype.setCustomCommandHandlers=function(t,e,n){this.customCommandHandlers[t]={isExecutableInTopWindowOnly:n,handler:e}},mc.prototype._startInternal=function(t){this.role=Bl,y.browser.startHeartbeat(this.heartbeatUrl,o.createNativeXHR),this._setupAssertionRetryIndication(),this._startCommandsProcessing(t)},mc.prototype._stopInternal=function(){this.role=Hl,y.browser.stopHeartbeat(),_.cursor.hide()},mc.prototype._setupAssertionRetryIndication=function(){var n=this;this.readyPromise.then(function(){n.statusBar.hidePageLoadingStatus();var t,e=n.contextStorage.getItem(rc);e&&(t=n.contextStorage.getItem(ic),0<e-(new ql-t)&&n.statusBar.showWaitingAssertionRetriesStatus(e,t))})},mc.prototype._startCommandsProcessing=function(t){void 0===t&&(t={finalizePendingCommand:!1,isFirstRequestAfterWindowSwitching:!1,result:void 0});var e,n,r=this.contextStorage.getItem($l);r&&(r.resent=!0),this.contextStorage.getItem(Jl)?r?this._onTestDone(r):this._checkStatus():this._failIfClientCodeExecutionIsInterrupted()||(e=t.finalizePendingCommand||this._hasPendingActionFlags(this.contextStorage),n=r||new cr({isCommandResult:e,isFirstRequestAfterWindowSwitching:t.isFirstRequestAfterWindowSwitching,result:t.result}),this.contextStorage.setItem(this.COMMAND_EXECUTING_FLAG,!1),this.contextStorage.setItem(this.EXECUTING_IN_IFRAME_FLAG,!1),this.contextStorage.setItem(this.PENDING_WINDOW_SWITCHING_FLAG,!1),this._onReady(n))},mc.prototype._initParentWindowLink=function(){Rc.opener&&Rc.opener!==Rc&&this.windowId&&(this.parentWindowDriverLink=new Ll(Rc))},mc.prototype._initConsoleMessages=function(){var t=this.consoleMessages;t.ensureMessageContainer(this.windowId),this.consoleMessages=t},mc.prototype._getDriverRole=function(){return c(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return this.windowId?[4,y.browser.getActiveWindowId(this.browserActiveWindowId,o.createNativeXHR)]:[2,Bl];case 1:return[2,t.sent().activeWindowId===this.windowId?Bl:Hl]}})})},mc.prototype._init=function(){this.contextStorage=new po(Rc,this.testRunId,this.windowId),this.nativeDialogsTracker=new Zr(this.contextStorage,this.dialogHandler),this.statusBar=new n.StatusBar(this.userAgent,this.fixtureName,this.testName,this.contextStorage),this.statusBar.on(this.statusBar.UNLOCK_PAGE_BTN_CLICK,y.disableRealEventsPreventing),this.speed=this.initialSpeed,this._initConsoleMessages(),this._initParentWindowLink(),this._isOpenedInIframe()&&vo(new ao(this.windowId),Rc.opener.top,wo,bn)},mc.prototype._doFirstPageLoadSetup=function(){return c(this,void 0,void 0,function(){return u(this,function(t){return this.isFirstPageLoad&&this.canUseDefaultWindowActions,[2]})})},mc.prototype.start=function(){return c(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return this._init(),[4,this._doFirstPageLoadSetup()];case 1:return t.sent(),[4,this._restoreChildWindowLinks()];case 2:return t.sent(),[4,this._getDriverRole()];case 3:return e=t.sent(),this.role===Bl||e===Bl&&this._startInternal(),[2]}})})},mc);function mc(t,e,n,r){var i=Ol.call(this)||this;return i.COMMAND_EXECUTING_FLAG="testcafe|driver|command-executing-flag",i.EXECUTING_IN_IFRAME_FLAG="testcafe|driver|executing-in-iframe-flag",i.PENDING_WINDOW_SWITCHING_FLAG="testcafe|driver|pending-window-switching-flag",i.WINDOW_COMMAND_API_CALL_FLAG="testcafe|driver|window-command-api-flag",i.testRunId=t,i.heartbeatUrl=e.heartbeat,i.browserStatusUrl=e.status,i.browserStatusDoneUrl=e.statusDone,i.browserActiveWindowId=e.activeWindowId,i.userAgent=n.userAgent,i.fixtureName=n.fixtureName,i.testName=n.testName,i.selectorTimeout=r.selectorTimeout,i.pageLoadTimeout=r.pageLoadTimeout,i.childWindowReadyTimeout=r.childWindowReadyTimeout,i.initialSpeed=r.speed,i.skipJsErrors=r.skipJsErrors,i.dialogHandler=r.dialogHandler,i.canUseDefaultWindowActions=r.canUseDefaultWindowActions,i.isFirstPageLoad=Gl.get().isFirstPageLoad,i.customCommandHandlers={},i.contextStorage=null,i.nativeDialogsTracker=null,i.childIframeDriverLinks=[],i.activeChildIframeDriverLink=null,i.childWindowDriverLinks=[],i.parentWindowDriverLink=null,i.statusBar=null,i.windowId=i._getCurrentWindowId(),i.role=Hl,i.setAsMasterInProgress=!1,i.checkClosedChildWindowIntervalId=null,i.pageInitialRequestBarrier=new y.RequestBarrier,i.readyPromise=i._getReadyPromise(),i._initChildDriverListening(),y.pageUnloadBarrier.init(),y.preventRealEvents(),o.on(o.EVENTS.uncaughtJsError,function(t){return i._onJsError(t)}),o.on(o.EVENTS.unhandledRejection,function(t){return i._onJsError(t)}),o.on(o.EVENTS.consoleMethCalled,function(t){return i._onConsoleMessage(t)}),o.on(o.EVENTS.beforeFormSubmit,function(t){return i._onFormSubmit(t)}),o.on(o.EVENTS.windowOpened,function(t){return i._onChildWindowOpened(t)}),i.setCustomCommandHandlers(m.unlockPage,function(){return i._unlockPageAfterTestIsDone()}),i.setCustomCommandHandlers(m.getActiveElement,function(){return i._getActiveElement()}),Kl.addInternalEventBeforeListener(Rc,["beforeunload"],function(){i._sendStartToRestoreCommand()}),i.replicator=Dr([new Lr]),i}var pc=(gc.prototype.establishConnection=function(){return vo(new yi,this.driverWindow,5e3,rn).then(function(t){return t.result.id})},gc.prototype.sendConfirmationMessage=function(t){yo({requestMsgId:t,window:this.driverWindow})},gc.prototype.onCommandExecuted=function(t){var e=new Li(t);l.eventSandbox.message.sendServiceMsg(e,this.driverWindow)},gc);function gc(t){this.driverWindow=t}var vc,wc=o.eventSandbox.message,yc=(s(_c,vc=Zr),_c.prototype._defaultDialogHandler=function(t){wc.sendServiceMsg({type:Xr,dialogType:t,url:Zr._getPageUrl()},Rc.top)},_c.prototype._addAppearedDialogs=function(t,e){wc.sendServiceMsg({type:Vr,dialogType:t,text:e,url:Zr._getPageUrl()},Rc.top)},_c.prototype._onHandlerError=function(t,e){wc.sendServiceMsg({type:Yr,dialogType:t,message:e,url:Zr._getPageUrl()},Rc.top)},_c);function _c(t){return vc.call(this,null,t)||this}var Ec,Cc=l.eventSandbox.message,Sc=(s(Ic,Ec=fc),Ic.prototype._onJsError=function(){},Ic.prototype._onConsoleMessage=function(){},Ic.prototype._onChildWindowOpened=function(){Cc.sendServiceMsg(new uo,Rc.top)},Ic.prototype._initParentDriverListening=function(){var n=this;l.eventSandbox.message.on(l.eventSandbox.message.SERVICE_MSG_RECEIVED_EVENT,function(t){var e=t.message;y.pageUnloadBarrier.wait(0).then(function(){if(e.type===ui){if(n.lastParentDriverMessageId===e.id)return;n.lastParentDriverMessageId=e.id,n.readyPromise.then(function(){n.speed=e.testSpeed,n.parentDriverLink.sendConfirmationMessage(e.id),n._onCommand(e.command)})}e.type===hi&&(n.nativeDialogsTracker.setHandler(e.dialogHandler),n._setNativeDialogHandlerInIframes(e.dialogHandler))})})},Ic.prototype._onSwitchToMainWindowCommand=function(t){this._switchToMainWindow(t)},Ic.prototype._onReady=function(t){this.parentDriverLink.onCommandExecuted(t)},Ic.prototype.start=function(){var e=this;this.nativeDialogsTracker=new yc(this.dialogHandler),this.statusBar=new n.IframeStatusBar;var t=this.parentDriverLink.establishConnection().then(function(t){e.contextStorage=new po(Rc,t,e.windowId),e._failIfClientCodeExecutionIsInterrupted()||(e.contextStorage.getItem(e.COMMAND_EXECUTING_FLAG)||e.contextStorage.getItem(e.EXECUTING_IN_IFRAME_FLAG))&&(e.contextStorage.setItem(e.COMMAND_EXECUTING_FLAG,!1),e.contextStorage.setItem(e.EXECUTING_IN_IFRAME_FLAG,!1),e._onReady(new cr({isCommandResult:!0})))});this.readyPromise=l.Promise.all([this.readyPromise,t])},Ic);function Ic(t,e){var n=Ec.call(this,t,{},{},e)||this;return n.lastParentDriverMessageId=null,n.parentDriverLink=new pc(Rc.parent),n._initParentDriverListening(),n}var Tc={NodeSnapshot:Er,ElementSnapshot:Wr,SelectorExecutor:zo},xc="%testCafeDriver%",bc="%testCafeIframeDriver%",Wc="%ScriptExecutionBarrier%",Mc="%testCafeEmbeddingUtils%",Pc=o.nativeMethods,Ac=o.EVENTS.evalIframeScript;Pc.objectDefineProperty(Rc,xc,{configurable:!0,value:fc}),Pc.objectDefineProperty(Rc,bc,{configurable:!0,value:Sc}),Pc.objectDefineProperty(Rc,Wc,{configurable:!0,value:Io}),Pc.objectDefineProperty(Rc,Mc,{configurable:!0,value:Tc}),o.on(Ac,function(t){return Dc(Pc.contentWindowGetter.call(t.iframe))})}(Rc["%hammerhead%"],Rc["%hammerhead%"].Promise,Rc["%testCafeCore%"],Rc["%testCafeAutomation%"],Rc["%testCafeUI%"])}(window);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
testCafeDriver: '%testCafeDriver%',
|
|
5
|
-
testCafeIframeDriver: '%testCafeIframeDriver%',
|
|
6
|
-
scriptExecutionBarrier: '%ScriptExecutionBarrier%',
|
|
7
|
-
testCafeEmbeddingUtils: '%testCafeEmbeddingUtils%',
|
|
8
|
-
testCafeDriverInstance: '%testCafeDriverInstance%'
|
|
9
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
testCafeDriver: '%testCafeDriver%',
|
|
5
|
+
testCafeIframeDriver: '%testCafeIframeDriver%',
|
|
6
|
+
scriptExecutionBarrier: '%ScriptExecutionBarrier%',
|
|
7
|
+
testCafeEmbeddingUtils: '%testCafeEmbeddingUtils%',
|
|
8
|
+
testCafeDriverInstance: '%testCafeDriverInstance%'
|
|
9
|
+
};
|
|
10
10
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJuYWwtcHJvcGVydGllcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGllbnQvZHJpdmVyL2ludGVybmFsLXByb3BlcnRpZXMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxrQkFBZTtJQUNYLGNBQWMsRUFBVSxrQkFBa0I7SUFDMUMsb0JBQW9CLEVBQUksd0JBQXdCO0lBQ2hELHNCQUFzQixFQUFFLDBCQUEwQjtJQUNsRCxzQkFBc0IsRUFBRSwwQkFBMEI7SUFDbEQsc0JBQXNCLEVBQUUsMEJBQTBCO0NBQ3JELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCB7XG4gICAgdGVzdENhZmVEcml2ZXI6ICAgICAgICAgJyV0ZXN0Q2FmZURyaXZlciUnLFxuICAgIHRlc3RDYWZlSWZyYW1lRHJpdmVyOiAgICcldGVzdENhZmVJZnJhbWVEcml2ZXIlJyxcbiAgICBzY3JpcHRFeGVjdXRpb25CYXJyaWVyOiAnJVNjcmlwdEV4ZWN1dGlvbkJhcnJpZXIlJyxcbiAgICB0ZXN0Q2FmZUVtYmVkZGluZ1V0aWxzOiAnJXRlc3RDYWZlRW1iZWRkaW5nVXRpbHMlJyxcbiAgICB0ZXN0Q2FmZURyaXZlckluc3RhbmNlOiAnJXRlc3RDYWZlRHJpdmVySW5zdGFuY2UlJ1xufTtcbiJdfQ==
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
var IframeDriver = window['%testCafeIframeDriver%'];
|
|
3
|
-
var driver = new IframeDriver({{{testRunId}}}, {
|
|
4
|
-
selectorTimeout: {{{selectorTimeout}}},
|
|
5
|
-
pageLoadTimeout: {{{pageLoadTimeout}}},
|
|
6
|
-
dialogHandler: {{{dialogHandler}}},
|
|
7
|
-
retryTestPages: {{{retryTestPages}}},
|
|
8
|
-
speed: {{{speed}}}
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
driver.start();
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(window, '%testCafeDriverInstance%', {
|
|
14
|
-
configurable: true,
|
|
15
|
-
value: driver
|
|
16
|
-
});
|
|
17
|
-
})();
|
|
1
|
+
(function () {
|
|
2
|
+
var IframeDriver = window['%testCafeIframeDriver%'];
|
|
3
|
+
var driver = new IframeDriver({{{testRunId}}}, {
|
|
4
|
+
selectorTimeout: {{{selectorTimeout}}},
|
|
5
|
+
pageLoadTimeout: {{{pageLoadTimeout}}},
|
|
6
|
+
dialogHandler: {{{dialogHandler}}},
|
|
7
|
+
retryTestPages: {{{retryTestPages}}},
|
|
8
|
+
speed: {{{speed}}}
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
driver.start();
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(window, '%testCafeDriverInstance%', {
|
|
14
|
+
configurable: true,
|
|
15
|
+
value: driver
|
|
16
|
+
});
|
|
17
|
+
})();
|