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.
Files changed (336) hide show
  1. package/CHANGELOG.md +88 -10
  2. package/LICENSE +21 -21
  3. package/README.md +52 -48
  4. package/bin/testcafe-with-v8-flag-filter.js +0 -0
  5. package/lib/api/exportable-lib/index.js +50 -50
  6. package/lib/api/request-hooks/assert-type.js +7 -7
  7. package/lib/api/request-hooks/hook-method-names.js +11 -0
  8. package/lib/api/request-hooks/hook.js +33 -39
  9. package/lib/api/request-hooks/interfaces.js +3 -3
  10. package/lib/api/request-hooks/request-logger.js +113 -111
  11. package/lib/api/request-hooks/request-mock/create-request-mock.js +12 -0
  12. package/lib/api/request-hooks/request-mock/index.js +46 -0
  13. package/lib/api/request-hooks/request-mock.js +47 -48
  14. package/lib/api/structure/base-unit.js +11 -11
  15. package/lib/api/structure/fixture.js +75 -75
  16. package/lib/api/structure/interfaces.js +2 -2
  17. package/lib/api/structure/test-file.js +31 -31
  18. package/lib/api/structure/test-timeout.js +9 -9
  19. package/lib/api/structure/test.js +85 -85
  20. package/lib/api/structure/testing-unit.js +89 -89
  21. package/lib/api/structure/unit-type.js +9 -9
  22. package/lib/api/test-controller/assertion.js +88 -88
  23. package/lib/api/test-controller/execution-context.js +82 -82
  24. package/lib/api/test-controller/index.js +359 -319
  25. package/lib/api/test-controller/proxy.js +28 -28
  26. package/lib/api/test-page-url.js +60 -60
  27. package/lib/api/test-run-tracker.js +68 -68
  28. package/lib/api/wrap-test-function.js +49 -49
  29. package/lib/assertions/executor.js +74 -74
  30. package/lib/assertions/get-fn.js +46 -46
  31. package/lib/assertions/type.js +20 -20
  32. package/lib/assets/content-types.js +9 -9
  33. package/lib/assets/injectables.js +18 -18
  34. package/lib/browser/connection/command.js +10 -10
  35. package/lib/browser/connection/error-hints.js +9 -9
  36. package/lib/browser/connection/gateway.js +159 -159
  37. package/lib/browser/connection/get-hints.js +33 -33
  38. package/lib/browser/connection/heartbeat-status.js +8 -8
  39. package/lib/browser/connection/index.js +328 -328
  40. package/lib/browser/connection/remotes-queue.js +46 -46
  41. package/lib/browser/connection/service-routes.js +12 -12
  42. package/lib/browser/connection/status.js +12 -12
  43. package/lib/browser/interfaces.js +2 -2
  44. package/lib/browser/provider/built-in/dedicated/base.js +80 -80
  45. package/lib/browser/provider/built-in/dedicated/chrome/browser-client.js +204 -204
  46. package/lib/browser/provider/built-in/dedicated/chrome/build-chrome-args.js +17 -17
  47. package/lib/browser/provider/built-in/dedicated/chrome/config.js +110 -110
  48. package/lib/browser/provider/built-in/dedicated/chrome/create-temp-profile.js +45 -45
  49. package/lib/browser/provider/built-in/dedicated/chrome/elapsed-upperbounds.js +15 -15
  50. package/lib/browser/provider/built-in/dedicated/chrome/index.js +102 -102
  51. package/lib/browser/provider/built-in/dedicated/chrome/interfaces.js +2 -2
  52. package/lib/browser/provider/built-in/dedicated/chrome/local-chrome.js +24 -24
  53. package/lib/browser/provider/built-in/dedicated/chrome/runtime-info.js +29 -29
  54. package/lib/browser/provider/built-in/dedicated/edge/index.js +10 -10
  55. package/lib/browser/provider/built-in/dedicated/edge/runtime-info.js +29 -29
  56. package/lib/browser/provider/built-in/dedicated/firefox/config.js +33 -33
  57. package/lib/browser/provider/built-in/dedicated/firefox/create-temp-profile.js +78 -78
  58. package/lib/browser/provider/built-in/dedicated/firefox/index.js +73 -73
  59. package/lib/browser/provider/built-in/dedicated/firefox/local-firefox.js +36 -36
  60. package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/commands.js +13 -13
  61. package/lib/browser/provider/built-in/dedicated/firefox/marionette-client/index.js +200 -200
  62. package/lib/browser/provider/built-in/dedicated/firefox/runtime-info.js +17 -17
  63. package/lib/browser/provider/built-in/index.js +21 -21
  64. package/lib/browser/provider/built-in/locally-installed.js +30 -30
  65. package/lib/browser/provider/built-in/path.js +47 -47
  66. package/lib/browser/provider/built-in/remote.js +58 -58
  67. package/lib/browser/provider/index.js +303 -303
  68. package/lib/browser/provider/parse-provider-name.js +16 -16
  69. package/lib/browser/provider/plugin-host.js +121 -121
  70. package/lib/browser/provider/pool.js +115 -115
  71. package/lib/browser/provider/utils/argument-parsing.js +74 -74
  72. package/lib/browser/provider/utils/browser-starter.js +34 -34
  73. package/lib/browser/provider/utils/client-functions.js +24 -24
  74. package/lib/browser/provider/utils/get-maximized-headless-window-size.js +9 -9
  75. package/lib/cli/argument-parser.js +284 -279
  76. package/lib/cli/authentication-helper.js +35 -35
  77. package/lib/cli/cli.js +134 -134
  78. package/lib/cli/correct-browsers-and-sources.js +40 -40
  79. package/lib/cli/index.js +19 -19
  80. package/lib/cli/log.js +43 -43
  81. package/lib/cli/remotes-wizard.js +36 -36
  82. package/lib/cli/termination-handler.js +38 -38
  83. package/lib/client/automation/index.js +144 -46
  84. package/lib/client/automation/index.min.js +1 -1
  85. package/lib/client/browser/idle-page/index.html.mustache +35 -35
  86. package/lib/client/browser/idle-page/logo.svg +86 -86
  87. package/lib/client/browser/service-worker.js +4 -6
  88. package/lib/client/core/index.js +19 -13
  89. package/lib/client/core/index.min.js +1 -1
  90. package/lib/client/driver/index.js +1807 -451
  91. package/lib/client/driver/index.min.js +1 -1
  92. package/lib/client/driver/internal-properties.js +9 -9
  93. package/lib/client/test-run/iframe.js.mustache +17 -17
  94. package/lib/client/test-run/index.js.mustache +51 -51
  95. package/lib/client/ui/index.js +14 -12
  96. package/lib/client/ui/index.min.js +1 -1
  97. package/lib/client/ui/sprite.svg +42 -42
  98. package/lib/client-functions/builder-symbol.js +4 -4
  99. package/lib/client-functions/client-function-builder.js +156 -135
  100. package/lib/client-functions/replicator.js +61 -61
  101. package/lib/client-functions/return-single-prop-mode.js +8 -8
  102. package/lib/client-functions/selector-api-execution-mode.js +22 -0
  103. package/lib/client-functions/selectors/add-api.js +646 -588
  104. package/lib/client-functions/selectors/create-snapshot-methods.js +13 -13
  105. package/lib/client-functions/selectors/prepare-api-args.js +20 -20
  106. package/lib/client-functions/selectors/selector-attribute-filter.js +22 -22
  107. package/lib/client-functions/selectors/selector-builder.js +154 -150
  108. package/lib/client-functions/selectors/selector-text-filter.js +43 -43
  109. package/lib/client-functions/selectors/snapshot-properties.js +48 -48
  110. package/lib/client-functions/types.js +18 -18
  111. package/lib/compiler/babel/format-babel-produced-code.js +10 -10
  112. package/lib/compiler/babel/get-base-babel-options.js +11 -11
  113. package/lib/compiler/babel/load-libs.js +64 -62
  114. package/lib/compiler/babel/preset-stage-2.js +19 -19
  115. package/lib/compiler/compile-client-function.js +73 -73
  116. package/lib/compiler/compilers.js +33 -33
  117. package/lib/compiler/index.js +92 -92
  118. package/lib/compiler/interfaces.js +2 -2
  119. package/lib/compiler/test-file/api-based.js +146 -146
  120. package/lib/compiler/test-file/base.js +36 -36
  121. package/lib/compiler/test-file/exportble-lib-path.js +5 -5
  122. package/lib/compiler/test-file/formats/coffeescript/compiler.js +38 -38
  123. package/lib/compiler/test-file/formats/coffeescript/get-test-list.js +29 -29
  124. package/lib/compiler/test-file/formats/es-next/compiler.js +43 -43
  125. package/lib/compiler/test-file/formats/es-next/get-test-list.js +166 -166
  126. package/lib/compiler/test-file/formats/es-next/is-flow-code.js +7 -7
  127. package/lib/compiler/test-file/formats/raw.js +85 -85
  128. package/lib/compiler/test-file/formats/typescript/compiler.js +135 -135
  129. package/lib/compiler/test-file/formats/typescript/get-test-list.js +185 -185
  130. package/lib/compiler/test-file/test-file-parser-base.js +214 -214
  131. package/lib/configuration/configuration-base.js +165 -165
  132. package/lib/configuration/constants.js +9 -9
  133. package/lib/configuration/customizable-compilers.js +7 -7
  134. package/lib/configuration/default-values.js +51 -51
  135. package/lib/configuration/interfaces.js +3 -3
  136. package/lib/configuration/option-names.js +53 -53
  137. package/lib/configuration/option-source.js +9 -9
  138. package/lib/configuration/option.js +14 -14
  139. package/lib/configuration/quarantine-option-names.js +10 -0
  140. package/lib/configuration/run-option-names.js +26 -26
  141. package/lib/configuration/screenshot-option-names.js +10 -10
  142. package/lib/configuration/testcafe-configuration.js +164 -165
  143. package/lib/configuration/types.js +2 -2
  144. package/lib/configuration/typescript-configuration.js +62 -62
  145. package/lib/custom-client-scripts/assert-type.js +7 -7
  146. package/lib/custom-client-scripts/client-script-init.js +3 -3
  147. package/lib/custom-client-scripts/client-script.js +107 -108
  148. package/lib/custom-client-scripts/get-code.js +11 -11
  149. package/lib/custom-client-scripts/get-url.js +6 -6
  150. package/lib/custom-client-scripts/load.js +15 -15
  151. package/lib/custom-client-scripts/problematic-scripts.js +2 -2
  152. package/lib/custom-client-scripts/routing.js +36 -36
  153. package/lib/custom-client-scripts/utils.js +60 -60
  154. package/lib/embedding-utils.js +83 -83
  155. package/lib/errors/create-stack-filter.js +18 -18
  156. package/lib/errors/error-list.js +26 -26
  157. package/lib/errors/get-callsite.js +31 -31
  158. package/lib/errors/internal-modules-prefix.js +8 -8
  159. package/lib/errors/is-internal-stack-frame.js +46 -46
  160. package/lib/errors/process-test-fn-error.js +37 -37
  161. package/lib/errors/runtime/index.js +123 -123
  162. package/lib/errors/runtime/templates.js +116 -114
  163. package/lib/errors/runtime/type-assertions.js +112 -112
  164. package/lib/errors/stack-cleaning-hook.js +64 -64
  165. package/lib/errors/test-run/formattable-adapter.js +59 -59
  166. package/lib/errors/test-run/index.js +302 -302
  167. package/lib/errors/test-run/render-error-template.js +31 -31
  168. package/lib/errors/test-run/templates.js +93 -95
  169. package/lib/errors/test-run/utils.js +90 -85
  170. package/lib/errors/types.js +157 -155
  171. package/lib/index.js +81 -81
  172. package/lib/live/bootstrapper.js +44 -44
  173. package/lib/live/controller.js +107 -107
  174. package/lib/live/file-watcher/index.js +67 -67
  175. package/lib/live/file-watcher/modules-graph.js +58 -58
  176. package/lib/live/keyboard-observer.js +76 -76
  177. package/lib/live/logger/index.js +64 -64
  178. package/lib/live/test-run-controller.js +96 -96
  179. package/lib/live/test-run-state.js +6 -6
  180. package/lib/live/test-run.js +56 -56
  181. package/lib/live/test-runner.js +168 -168
  182. package/lib/load-assets.js +29 -29
  183. package/lib/notifications/add-rendered-warning.js +16 -16
  184. package/lib/notifications/debug-logger.js +78 -78
  185. package/lib/notifications/deprecated.js +24 -24
  186. package/lib/notifications/information-message.js +12 -12
  187. package/lib/notifications/warning-log.js +32 -31
  188. package/lib/notifications/warning-message.js +48 -48
  189. package/lib/reporter/command/command-formatter.js +120 -109
  190. package/lib/reporter/command/format-command.js +8 -8
  191. package/lib/reporter/command/interfaces.js +2 -2
  192. package/lib/reporter/index.js +319 -314
  193. package/lib/reporter/interfaces.js +2 -2
  194. package/lib/reporter/plugin-host.js +136 -137
  195. package/lib/reporter/plugin-methods.js +12 -12
  196. package/lib/role/index.js +74 -74
  197. package/lib/role/marker-symbol.js +7 -7
  198. package/lib/role/phase.js +9 -9
  199. package/lib/runner/bootstrapper.js +272 -272
  200. package/lib/runner/browser-job-result.js +9 -9
  201. package/lib/runner/browser-job.js +153 -123
  202. package/lib/runner/browser-set.js +114 -114
  203. package/lib/runner/fixture-hook-controller.js +85 -85
  204. package/lib/runner/index.js +450 -442
  205. package/lib/runner/interfaces.js +3 -3
  206. package/lib/runner/reporter-stream-controller.js +28 -28
  207. package/lib/runner/task/index.js +152 -133
  208. package/lib/runner/task/phase.js +9 -9
  209. package/lib/runner/test-run-controller.js +166 -185
  210. package/lib/runner/tested-app.js +73 -72
  211. package/lib/screenshots/capturer.js +141 -141
  212. package/lib/screenshots/constants.js +11 -11
  213. package/lib/screenshots/crop.js +111 -111
  214. package/lib/screenshots/default-extension.js +4 -4
  215. package/lib/screenshots/index.js +67 -67
  216. package/lib/screenshots/utils.js +39 -39
  217. package/lib/services/compiler/host.js +190 -106
  218. package/lib/services/compiler/io.js +9 -9
  219. package/lib/services/compiler/protocol.js +17 -16
  220. package/lib/services/compiler/service.js +225 -106
  221. package/lib/services/compiler/test-run-proxy.js +111 -73
  222. package/lib/services/interfaces.js +3 -0
  223. package/lib/services/process-title.js +8 -8
  224. package/lib/services/serialization/prepare-options.js +17 -17
  225. package/lib/services/serialization/replicator/create-replicator.js +27 -0
  226. package/lib/services/serialization/replicator/custom-error-transform.js +28 -0
  227. package/lib/services/serialization/test-structure.js +93 -77
  228. package/lib/services/utils/ipc/interfaces.js +30 -30
  229. package/lib/services/utils/ipc/io.js +108 -108
  230. package/lib/services/utils/ipc/message.js +76 -73
  231. package/lib/services/utils/ipc/packet.js +55 -55
  232. package/lib/services/utils/ipc/proxy.js +110 -118
  233. package/lib/services/utils/ipc/transport.js +64 -64
  234. package/lib/shared/errors/index.js +382 -382
  235. package/lib/shared/node-modules-folder-name.js +4 -4
  236. package/lib/test-run/bookmark.js +90 -90
  237. package/lib/test-run/browser-console-messages.js +73 -73
  238. package/lib/test-run/browser-manipulation-queue.js +92 -92
  239. package/lib/test-run/client-messages.js +9 -9
  240. package/lib/test-run/commands/actions.js +486 -425
  241. package/lib/test-run/commands/assertion.js +45 -45
  242. package/lib/test-run/commands/base.js +14 -14
  243. package/lib/test-run/commands/browser-manipulation.js +95 -95
  244. package/lib/test-run/commands/from-object.js +82 -82
  245. package/lib/test-run/commands/observation.js +61 -61
  246. package/lib/test-run/commands/options.js +231 -215
  247. package/lib/test-run/commands/service.js +54 -48
  248. package/lib/test-run/commands/type.js +65 -60
  249. package/lib/test-run/commands/utils.js +87 -87
  250. package/lib/test-run/commands/validations/argument.js +90 -90
  251. package/lib/test-run/commands/validations/factories.js +47 -47
  252. package/lib/test-run/commands/validations/initializers.js +44 -44
  253. package/lib/test-run/debug-log.js +32 -32
  254. package/lib/test-run/execute-js-expression.js +74 -74
  255. package/lib/test-run/index.js +823 -752
  256. package/lib/test-run/marker-symbol.js +7 -7
  257. package/lib/test-run/observed-callsites-storage.js +17 -17
  258. package/lib/test-run/phase.js +16 -16
  259. package/lib/test-run/session-controller.js +104 -104
  260. package/lib/testcafe.js +119 -114
  261. package/lib/utils/assignable.js +39 -39
  262. package/lib/utils/async-event-emitter.js +28 -28
  263. package/lib/utils/async-queue.js +14 -14
  264. package/lib/utils/browser-connection-timeouts.js +19 -19
  265. package/lib/utils/callsite.js +17 -17
  266. package/lib/utils/check-file-path.js +31 -31
  267. package/lib/utils/check-url.js +51 -51
  268. package/lib/utils/convert-to-best-fit-type.js +16 -16
  269. package/lib/utils/correct-file-path.js +21 -21
  270. package/lib/utils/define-lazy-property.js +13 -13
  271. package/lib/utils/delay.js +6 -6
  272. package/lib/utils/delegated-api.js +44 -44
  273. package/lib/utils/detect-display.js +6 -6
  274. package/lib/utils/detect-ffmpeg.js +44 -44
  275. package/lib/utils/diff/colors.js +29 -29
  276. package/lib/utils/diff/index.js +53 -53
  277. package/lib/utils/diff/util.js +24 -22
  278. package/lib/utils/diff.js +29 -29
  279. package/lib/utils/escape-user-agent.js +10 -10
  280. package/lib/utils/flag-list.js +17 -17
  281. package/lib/utils/get-any-key.js +8 -8
  282. package/lib/utils/get-browser.js +8 -8
  283. package/lib/utils/get-common-path.js +34 -34
  284. package/lib/utils/get-filter-fn.js +40 -40
  285. package/lib/utils/get-options/base.js +36 -36
  286. package/lib/utils/get-options/compiler.js +33 -33
  287. package/lib/utils/get-options/grep.js +15 -15
  288. package/lib/utils/get-options/index.js +21 -19
  289. package/lib/utils/get-options/meta.js +22 -22
  290. package/lib/utils/get-options/quarantine.js +92 -0
  291. package/lib/utils/get-options/screenshot.js +17 -17
  292. package/lib/utils/get-options/ssl.js +45 -45
  293. package/lib/utils/get-options/video.js +10 -10
  294. package/lib/utils/get-viewport-width.js +18 -18
  295. package/lib/utils/guard-time-execution.js +10 -10
  296. package/lib/utils/handle-errors.js +74 -74
  297. package/lib/utils/handle-tag-args.js +8 -8
  298. package/lib/utils/http.js +30 -30
  299. package/lib/utils/is-localhost.js +11 -11
  300. package/lib/utils/is-password-input.js +11 -0
  301. package/lib/utils/is-repl.js +12 -0
  302. package/lib/utils/is-window-in-iframe.js +6 -6
  303. package/lib/utils/limit-number.js +10 -10
  304. package/lib/utils/make-reg-exp.js +7 -7
  305. package/lib/utils/moment-loader.js +20 -20
  306. package/lib/utils/parse-file-list.js +71 -71
  307. package/lib/utils/parse-user-agent.js +55 -55
  308. package/lib/utils/path-pattern.js +114 -114
  309. package/lib/utils/prepare-reporters.js +30 -30
  310. package/lib/utils/prerender-callsite.js +18 -18
  311. package/lib/utils/process.js +119 -119
  312. package/lib/utils/promisified-functions.js +46 -46
  313. package/lib/utils/re-executable-promise.js +39 -39
  314. package/lib/utils/render-callsite-sync.js +29 -29
  315. package/lib/utils/render-template.js +10 -10
  316. package/lib/utils/reporter.js +30 -30
  317. package/lib/utils/resolve-path-relatively-cwd.js +7 -7
  318. package/lib/utils/string.js +105 -105
  319. package/lib/utils/temp-directory/cleanup-process/commands.js +7 -7
  320. package/lib/utils/temp-directory/cleanup-process/index.js +143 -143
  321. package/lib/utils/temp-directory/cleanup-process/worker.js +58 -58
  322. package/lib/utils/temp-directory/index.js +87 -87
  323. package/lib/utils/temp-directory/lockfile.js +56 -56
  324. package/lib/utils/thennable.js +7 -7
  325. package/lib/utils/timer.js +15 -15
  326. package/lib/utils/to-posix-path.js +8 -8
  327. package/lib/utils/types.js +2 -2
  328. package/lib/video-recorder/interfaces.js +2 -2
  329. package/lib/video-recorder/process.js +126 -126
  330. package/lib/video-recorder/recorder.js +136 -136
  331. package/lib/video-recorder/test-run-video-recorder.js +69 -69
  332. package/lib/video-recorder/videos.js +37 -37
  333. package/package.json +7 -7
  334. package/ts-defs/index.d.ts +109 -17
  335. package/ts-defs/selectors.d.ts +95 -7
  336. package/ts-defs/testcafe-scripts.d.ts +96 -8
@@ -1,7 +1,7 @@
1
- /// <reference types="node" />
2
-
3
- declare module 'testcafe' {
4
- global {
1
+ /// <reference types="node" />
2
+
3
+ declare module 'testcafe' {
4
+ global {
5
5
 
6
6
  interface KeyModifiers {
7
7
  ctrl?: boolean;
@@ -99,7 +99,7 @@ declare module 'testcafe' {
99
99
  scrollTargetY?: number;
100
100
  }
101
101
 
102
- interface MouseActionOptions extends ActionOptions {
102
+ interface OffsetOptions extends ActionOptions {
103
103
  /**
104
104
  * Mouse pointer X coordinate that define a point where the action is performed or started.
105
105
  * If an offset is a positive integer, coordinates are calculated relative to the top-left corner of the target element.
@@ -114,6 +114,10 @@ declare module 'testcafe' {
114
114
  * The default is the center of the target element.
115
115
  */
116
116
  offsetY?: number;
117
+ }
118
+
119
+ interface MouseActionOptions extends OffsetOptions {
120
+
117
121
  /**
118
122
  * Indicate which modifier keys are to be pressed during the mouse action.
119
123
  */
@@ -138,6 +142,17 @@ declare module 'testcafe' {
138
142
  * and false to insert the current text character by character.
139
143
  */
140
144
  paste?: boolean;
145
+ /**
146
+ * `true` to replace the typed text with a placeholder when sending action logs to a reporter.
147
+ */
148
+ confidential?: boolean;
149
+ }
150
+
151
+ interface PressActionOptions extends ActionOptions {
152
+ /**
153
+ * `true` to replace the pressed keys with a placeholder when sending action logs to a reporter.
154
+ */
155
+ confidential?: boolean;
141
156
  }
142
157
 
143
158
  interface DragToElementOptions extends MouseActionOptions {
@@ -834,7 +849,7 @@ declare module 'testcafe' {
834
849
  * @param statusCode - The response status code.
835
850
  * @param headers - Custom headers added to the response in the property-value form.
836
851
  */
837
- respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => any), statusCode?: number, headers?: Record<string, string>): RequestMock;
852
+ respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => Promise<void>), statusCode?: number, headers?: Record<string, string>): RequestMock;
838
853
  }
839
854
 
840
855
  interface RequestMockFactory {
@@ -1690,6 +1705,8 @@ declare module 'testcafe' {
1690
1705
  url: URL;
1691
1706
  }
1692
1707
 
1708
+ type ScrollPosition = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft' | 'center';
1709
+
1693
1710
  interface TestController {
1694
1711
  /**
1695
1712
  * Dictionary that is shared between test hook functions and test code.
@@ -1703,6 +1720,15 @@ declare module 'testcafe' {
1703
1720
  * Returns an object that contains browser information.
1704
1721
  */
1705
1722
  readonly browser: Browser;
1723
+ /**
1724
+ * Dispatches an event over a specified webpage element.
1725
+ *
1726
+ * @param selector - Identifies the EventTarget element.
1727
+ * @param eventName - The name of the event to be dispatched on the DOM element..
1728
+ * @param options - The options which will be passed to EventConstructor.
1729
+ */
1730
+ dispatchEvent(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1731
+ eventName: string, options?: object): TestControllerPromise;
1706
1732
  /**
1707
1733
  * Clicks a webpage element.
1708
1734
  *
@@ -1735,6 +1761,68 @@ declare module 'testcafe' {
1735
1761
  */
1736
1762
  hover(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1737
1763
  options?: MouseActionOptions): TestControllerPromise;
1764
+ /**
1765
+ * Scrolls the document element to the { scrollLeft, scrollTop } position.
1766
+ *
1767
+ * @param scrollLeft - The position along the horizontal axis of the document.
1768
+ * @param scrollTop - The position along the vertical axis of the document.
1769
+ */
1770
+ scroll(posX: number, posY: number): TestControllerPromise;
1771
+
1772
+ /**
1773
+ * Scrolls the document element to the predefined position.
1774
+ *
1775
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1776
+ */
1777
+ scroll(position: ScrollPosition): TestControllerPromise;
1778
+
1779
+ /**
1780
+ * Scrolls the specified element to the { scrollLeft, scrollTop } position.
1781
+ *
1782
+ * @param selector - Identifies the webpage element being hovered over.
1783
+ * @param scrollLeft - The position along the horizontal axis of the document.
1784
+ * @param scrollTop - The position along the vertical axis of the document.
1785
+ * @param options - A set of options that provide additional parameters for the action.
1786
+ */
1787
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1788
+ scrollLeft: number, scrollTop: number, options?: OffsetOptions): TestControllerPromise;
1789
+
1790
+ /**
1791
+ * Scrolls the specified element to the predefined position.
1792
+ *
1793
+ * @param selector - Identifies the webpage element being hovered over.
1794
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1795
+ * @param options - A set of options that provide additional parameters for the action.
1796
+ */
1797
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1798
+ position: ScrollPosition, options?: OffsetOptions): TestControllerPromise;
1799
+
1800
+ /**
1801
+ * Scrolls the document element by the given offset.
1802
+ *
1803
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1804
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1805
+ */
1806
+ scrollBy(x: number, y: number): TestControllerPromise;
1807
+
1808
+ /**
1809
+ * Scrolls the specified element by the given offset.
1810
+ * @param selector - Identifies the webpage element being hovered over.
1811
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1812
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1813
+ * @param options - A set of options that provide additional parameters for the action.
1814
+ */
1815
+ scrollBy(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1816
+ x: number, y: number, options?: OffsetOptions): TestControllerPromise;
1817
+
1818
+ /**
1819
+ * Scrolls the specified element into view.
1820
+ * @param selector - Identifies the webpage element being hovered over.
1821
+ * @param options - A set of options that provide additional parameters for the action.
1822
+ */
1823
+ scrollIntoView(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1824
+ options?: OffsetOptions): TestControllerPromise;
1825
+
1738
1826
  /**
1739
1827
  * Drags an element by an offset.
1740
1828
  *
@@ -1811,7 +1899,7 @@ declare module 'testcafe' {
1811
1899
  * @param keys - The sequence of keys and key combinations to be pressed.
1812
1900
  * @param options - A set of options that provide additional parameters for the action.
1813
1901
  */
1814
- pressKey(keys: string, options?: ActionOptions): TestControllerPromise;
1902
+ pressKey(keys: string, options?: PressActionOptions): TestControllerPromise;
1815
1903
  /**
1816
1904
  * Pauses a test for a specified period of time.
1817
1905
  *
@@ -2309,7 +2397,7 @@ declare module 'testcafe' {
2309
2397
  /**
2310
2398
  * Defines whether to enable the quarantine mode.
2311
2399
  */
2312
- quarantineMode: boolean;
2400
+ quarantineMode: boolean | Record<string, string>;
2313
2401
  /**
2314
2402
  * Specifies if tests run in the debug mode. If this option is enabled, test execution is paused before the first action or assertion allowing you to invoke the developer tools and debug. In the debug mode, you can execute the test step-by-step to reproduce its incorrect behavior. You can also use the Unlock Page switch in the footer to unlock the tested page and interact with its elements.
2315
2403
  */
@@ -2358,6 +2446,10 @@ declare module 'testcafe' {
2358
2446
  * Specifies the timeout in milliseconds to complete the AJAX requests (XHR or fetch)
2359
2447
  */
2360
2448
  ajaxRequestTimeout: number;
2449
+ /**
2450
+ * Prevents TestCafe from taking screenshots. When this option is specified, screenshots are not taken whenever a test fails or when t.takeScreenshot or t.takeElementScreenshot is executed.
2451
+ */
2452
+ disableScreenshots: boolean;
2361
2453
  }
2362
2454
 
2363
2455
  interface TestCafeFactory {
@@ -2372,8 +2464,8 @@ declare module 'testcafe' {
2372
2464
  configFile?: string
2373
2465
  ): Promise<TestCafe>;
2374
2466
  }
2375
- }
2376
-
2467
+ }
2468
+
2377
2469
 
2378
2470
  /**
2379
2471
  * Creates a selector.
@@ -2418,13 +2510,13 @@ declare module 'testcafe' {
2418
2510
  * The test controller used to access test run API.
2419
2511
  */
2420
2512
  export const t: TestController;
2421
-
2422
- const createTestCafe: TestCafeFactory;
2423
-
2424
- export default createTestCafe;
2425
- }
2426
-
2427
-
2513
+
2514
+ const createTestCafe: TestCafeFactory;
2515
+
2516
+ export default createTestCafe;
2517
+ }
2518
+
2519
+
2428
2520
 
2429
2521
  //
2430
2522
 
@@ -1,5 +1,5 @@
1
- declare module 'testcafe' {
2
- global {
1
+ declare module 'testcafe' {
2
+ global {
3
3
 
4
4
  interface KeyModifiers {
5
5
  ctrl?: boolean;
@@ -97,7 +97,7 @@ declare module 'testcafe' {
97
97
  scrollTargetY?: number;
98
98
  }
99
99
 
100
- interface MouseActionOptions extends ActionOptions {
100
+ interface OffsetOptions extends ActionOptions {
101
101
  /**
102
102
  * Mouse pointer X coordinate that define a point where the action is performed or started.
103
103
  * If an offset is a positive integer, coordinates are calculated relative to the top-left corner of the target element.
@@ -112,6 +112,10 @@ declare module 'testcafe' {
112
112
  * The default is the center of the target element.
113
113
  */
114
114
  offsetY?: number;
115
+ }
116
+
117
+ interface MouseActionOptions extends OffsetOptions {
118
+
115
119
  /**
116
120
  * Indicate which modifier keys are to be pressed during the mouse action.
117
121
  */
@@ -136,6 +140,17 @@ declare module 'testcafe' {
136
140
  * and false to insert the current text character by character.
137
141
  */
138
142
  paste?: boolean;
143
+ /**
144
+ * `true` to replace the typed text with a placeholder when sending action logs to a reporter.
145
+ */
146
+ confidential?: boolean;
147
+ }
148
+
149
+ interface PressActionOptions extends ActionOptions {
150
+ /**
151
+ * `true` to replace the pressed keys with a placeholder when sending action logs to a reporter.
152
+ */
153
+ confidential?: boolean;
139
154
  }
140
155
 
141
156
  interface DragToElementOptions extends MouseActionOptions {
@@ -832,7 +847,7 @@ declare module 'testcafe' {
832
847
  * @param statusCode - The response status code.
833
848
  * @param headers - Custom headers added to the response in the property-value form.
834
849
  */
835
- respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => any), statusCode?: number, headers?: Record<string, string>): RequestMock;
850
+ respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => Promise<void>), statusCode?: number, headers?: Record<string, string>): RequestMock;
836
851
  }
837
852
 
838
853
  interface RequestMockFactory {
@@ -1688,6 +1703,8 @@ declare module 'testcafe' {
1688
1703
  url: URL;
1689
1704
  }
1690
1705
 
1706
+ type ScrollPosition = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft' | 'center';
1707
+
1691
1708
  interface TestController {
1692
1709
  /**
1693
1710
  * Dictionary that is shared between test hook functions and test code.
@@ -1701,6 +1718,15 @@ declare module 'testcafe' {
1701
1718
  * Returns an object that contains browser information.
1702
1719
  */
1703
1720
  readonly browser: Browser;
1721
+ /**
1722
+ * Dispatches an event over a specified webpage element.
1723
+ *
1724
+ * @param selector - Identifies the EventTarget element.
1725
+ * @param eventName - The name of the event to be dispatched on the DOM element..
1726
+ * @param options - The options which will be passed to EventConstructor.
1727
+ */
1728
+ dispatchEvent(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1729
+ eventName: string, options?: object): TestControllerPromise;
1704
1730
  /**
1705
1731
  * Clicks a webpage element.
1706
1732
  *
@@ -1733,6 +1759,68 @@ declare module 'testcafe' {
1733
1759
  */
1734
1760
  hover(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1735
1761
  options?: MouseActionOptions): TestControllerPromise;
1762
+ /**
1763
+ * Scrolls the document element to the { scrollLeft, scrollTop } position.
1764
+ *
1765
+ * @param scrollLeft - The position along the horizontal axis of the document.
1766
+ * @param scrollTop - The position along the vertical axis of the document.
1767
+ */
1768
+ scroll(posX: number, posY: number): TestControllerPromise;
1769
+
1770
+ /**
1771
+ * Scrolls the document element to the predefined position.
1772
+ *
1773
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1774
+ */
1775
+ scroll(position: ScrollPosition): TestControllerPromise;
1776
+
1777
+ /**
1778
+ * Scrolls the specified element to the { scrollLeft, scrollTop } position.
1779
+ *
1780
+ * @param selector - Identifies the webpage element being hovered over.
1781
+ * @param scrollLeft - The position along the horizontal axis of the document.
1782
+ * @param scrollTop - The position along the vertical axis of the document.
1783
+ * @param options - A set of options that provide additional parameters for the action.
1784
+ */
1785
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1786
+ scrollLeft: number, scrollTop: number, options?: OffsetOptions): TestControllerPromise;
1787
+
1788
+ /**
1789
+ * Scrolls the specified element to the predefined position.
1790
+ *
1791
+ * @param selector - Identifies the webpage element being hovered over.
1792
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1793
+ * @param options - A set of options that provide additional parameters for the action.
1794
+ */
1795
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1796
+ position: ScrollPosition, options?: OffsetOptions): TestControllerPromise;
1797
+
1798
+ /**
1799
+ * Scrolls the document element by the given offset.
1800
+ *
1801
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1802
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1803
+ */
1804
+ scrollBy(x: number, y: number): TestControllerPromise;
1805
+
1806
+ /**
1807
+ * Scrolls the specified element by the given offset.
1808
+ * @param selector - Identifies the webpage element being hovered over.
1809
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1810
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1811
+ * @param options - A set of options that provide additional parameters for the action.
1812
+ */
1813
+ scrollBy(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1814
+ x: number, y: number, options?: OffsetOptions): TestControllerPromise;
1815
+
1816
+ /**
1817
+ * Scrolls the specified element into view.
1818
+ * @param selector - Identifies the webpage element being hovered over.
1819
+ * @param options - A set of options that provide additional parameters for the action.
1820
+ */
1821
+ scrollIntoView(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1822
+ options?: OffsetOptions): TestControllerPromise;
1823
+
1736
1824
  /**
1737
1825
  * Drags an element by an offset.
1738
1826
  *
@@ -1809,7 +1897,7 @@ declare module 'testcafe' {
1809
1897
  * @param keys - The sequence of keys and key combinations to be pressed.
1810
1898
  * @param options - A set of options that provide additional parameters for the action.
1811
1899
  */
1812
- pressKey(keys: string, options?: ActionOptions): TestControllerPromise;
1900
+ pressKey(keys: string, options?: PressActionOptions): TestControllerPromise;
1813
1901
  /**
1814
1902
  * Pauses a test for a specified period of time.
1815
1903
  *
@@ -2031,5 +2119,5 @@ declare module 'testcafe' {
2031
2119
  * @param options - Function options.
2032
2120
  */
2033
2121
  export const ClientFunction: ClientFunctionFactory;
2034
- }
2035
- }
2122
+ }
2123
+ }
@@ -1,5 +1,5 @@
1
- declare module 'testcafe' {
2
- global {
1
+ declare module 'testcafe' {
2
+ global {
3
3
 
4
4
  interface KeyModifiers {
5
5
  ctrl?: boolean;
@@ -97,7 +97,7 @@ declare module 'testcafe' {
97
97
  scrollTargetY?: number;
98
98
  }
99
99
 
100
- interface MouseActionOptions extends ActionOptions {
100
+ interface OffsetOptions extends ActionOptions {
101
101
  /**
102
102
  * Mouse pointer X coordinate that define a point where the action is performed or started.
103
103
  * If an offset is a positive integer, coordinates are calculated relative to the top-left corner of the target element.
@@ -112,6 +112,10 @@ declare module 'testcafe' {
112
112
  * The default is the center of the target element.
113
113
  */
114
114
  offsetY?: number;
115
+ }
116
+
117
+ interface MouseActionOptions extends OffsetOptions {
118
+
115
119
  /**
116
120
  * Indicate which modifier keys are to be pressed during the mouse action.
117
121
  */
@@ -136,6 +140,17 @@ declare module 'testcafe' {
136
140
  * and false to insert the current text character by character.
137
141
  */
138
142
  paste?: boolean;
143
+ /**
144
+ * `true` to replace the typed text with a placeholder when sending action logs to a reporter.
145
+ */
146
+ confidential?: boolean;
147
+ }
148
+
149
+ interface PressActionOptions extends ActionOptions {
150
+ /**
151
+ * `true` to replace the pressed keys with a placeholder when sending action logs to a reporter.
152
+ */
153
+ confidential?: boolean;
139
154
  }
140
155
 
141
156
  interface DragToElementOptions extends MouseActionOptions {
@@ -832,7 +847,7 @@ declare module 'testcafe' {
832
847
  * @param statusCode - The response status code.
833
848
  * @param headers - Custom headers added to the response in the property-value form.
834
849
  */
835
- respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => any), statusCode?: number, headers?: Record<string, string>): RequestMock;
850
+ respond(body?: object | string | ((req: RequestOptions, res: ResponseMock) => Promise<void>), statusCode?: number, headers?: Record<string, string>): RequestMock;
836
851
  }
837
852
 
838
853
  interface RequestMockFactory {
@@ -1688,6 +1703,8 @@ declare module 'testcafe' {
1688
1703
  url: URL;
1689
1704
  }
1690
1705
 
1706
+ type ScrollPosition = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'topLeft' | 'bottomRight' | 'bottomLeft' | 'center';
1707
+
1691
1708
  interface TestController {
1692
1709
  /**
1693
1710
  * Dictionary that is shared between test hook functions and test code.
@@ -1701,6 +1718,15 @@ declare module 'testcafe' {
1701
1718
  * Returns an object that contains browser information.
1702
1719
  */
1703
1720
  readonly browser: Browser;
1721
+ /**
1722
+ * Dispatches an event over a specified webpage element.
1723
+ *
1724
+ * @param selector - Identifies the EventTarget element.
1725
+ * @param eventName - The name of the event to be dispatched on the DOM element..
1726
+ * @param options - The options which will be passed to EventConstructor.
1727
+ */
1728
+ dispatchEvent(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1729
+ eventName: string, options?: object): TestControllerPromise;
1704
1730
  /**
1705
1731
  * Clicks a webpage element.
1706
1732
  *
@@ -1733,6 +1759,68 @@ declare module 'testcafe' {
1733
1759
  */
1734
1760
  hover(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1735
1761
  options?: MouseActionOptions): TestControllerPromise;
1762
+ /**
1763
+ * Scrolls the document element to the { scrollLeft, scrollTop } position.
1764
+ *
1765
+ * @param scrollLeft - The position along the horizontal axis of the document.
1766
+ * @param scrollTop - The position along the vertical axis of the document.
1767
+ */
1768
+ scroll(posX: number, posY: number): TestControllerPromise;
1769
+
1770
+ /**
1771
+ * Scrolls the document element to the predefined position.
1772
+ *
1773
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1774
+ */
1775
+ scroll(position: ScrollPosition): TestControllerPromise;
1776
+
1777
+ /**
1778
+ * Scrolls the specified element to the { scrollLeft, scrollTop } position.
1779
+ *
1780
+ * @param selector - Identifies the webpage element being hovered over.
1781
+ * @param scrollLeft - The position along the horizontal axis of the document.
1782
+ * @param scrollTop - The position along the vertical axis of the document.
1783
+ * @param options - A set of options that provide additional parameters for the action.
1784
+ */
1785
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1786
+ scrollLeft: number, scrollTop: number, options?: OffsetOptions): TestControllerPromise;
1787
+
1788
+ /**
1789
+ * Scrolls the specified element to the predefined position.
1790
+ *
1791
+ * @param selector - Identifies the webpage element being hovered over.
1792
+ * @param position - The position to scroll the document to. Valid values are topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight
1793
+ * @param options - A set of options that provide additional parameters for the action.
1794
+ */
1795
+ scroll(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1796
+ position: ScrollPosition, options?: OffsetOptions): TestControllerPromise;
1797
+
1798
+ /**
1799
+ * Scrolls the document element by the given offset.
1800
+ *
1801
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1802
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1803
+ */
1804
+ scrollBy(x: number, y: number): TestControllerPromise;
1805
+
1806
+ /**
1807
+ * Scrolls the specified element by the given offset.
1808
+ * @param selector - Identifies the webpage element being hovered over.
1809
+ * @param scrollLeft - The horizontal pixel value that you want to scroll by.
1810
+ * @param scrollTop - The vertical pixel value that you want to scroll by.
1811
+ * @param options - A set of options that provide additional parameters for the action.
1812
+ */
1813
+ scrollBy(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1814
+ x: number, y: number, options?: OffsetOptions): TestControllerPromise;
1815
+
1816
+ /**
1817
+ * Scrolls the specified element into view.
1818
+ * @param selector - Identifies the webpage element being hovered over.
1819
+ * @param options - A set of options that provide additional parameters for the action.
1820
+ */
1821
+ scrollIntoView(selector: string | Selector | NodeSnapshot | SelectorPromise | ((...args: any[]) => Node | Node[] | NodeList | HTMLCollection),
1822
+ options?: OffsetOptions): TestControllerPromise;
1823
+
1736
1824
  /**
1737
1825
  * Drags an element by an offset.
1738
1826
  *
@@ -1809,7 +1897,7 @@ declare module 'testcafe' {
1809
1897
  * @param keys - The sequence of keys and key combinations to be pressed.
1810
1898
  * @param options - A set of options that provide additional parameters for the action.
1811
1899
  */
1812
- pressKey(keys: string, options?: ActionOptions): TestControllerPromise;
1900
+ pressKey(keys: string, options?: PressActionOptions): TestControllerPromise;
1813
1901
  /**
1814
1902
  * Pauses a test for a specified period of time.
1815
1903
  *
@@ -2059,8 +2147,8 @@ declare module 'testcafe' {
2059
2147
  * The test controller used to access test run API.
2060
2148
  */
2061
2149
  export const t: TestController;
2062
- }
2063
-
2150
+ }
2151
+
2064
2152
 
2065
2153
  /**
2066
2154
  * Creates a selector.
@@ -2105,4 +2193,4 @@ declare module 'testcafe' {
2105
2193
  * The test controller used to access test run API.
2106
2194
  */
2107
2195
  export const t: TestController;
2108
- }
2196
+ }