UNPKG

237 kBMarkdownView Raw
1# Changelog
2
3## v1.15.3 (2021-08-19)
4
5### Bug Fixes
6
7* TestCafe throws an error if you use the 'all' alias in the command line to run tests in all installed browsers ([#6456](https://github.com/DevExpress/testcafe/issues/6456)).
8* TestCafe does not check if the configuration file exists ([#6337](https://github.com/DevExpress/testcafe/issues/6337)).
9* TestCafe cannot disable HTTP/2 to avoid compatibility issues ([testcafe-hammerhead/#2681](https://github.com/DevExpress/testcafe-hammerhead/pull/2681)).
10* TestCafe works incorrectly if you use extended Function objects ([testcafe-hammerhead/#2439](https://github.com/DevExpress/testcafe-hammerhead/issues/2439)).
11* TestCafe processes a test application incorrectly if it uses the Immutable.js library ([testcafe-hammerhead/#2669](https://github.com/DevExpress/testcafe-hammerhead/issues/2669)).
12* TestCafe adds an element incorrectly into a nested body element ([PR testcafe-hammerhead/#2682](https://github.com/DevExpress/testcafe-hammerhead/pull/2682)).
13
14## v1.15.2 (2021-08-11)
15
16### Bug Fixes
17
18* TestCafe fails to emulate the `tab` action if a page contains a cross-domain iframe ([#6405](https://github.com/DevExpress/testcafe/issues/6405)).
19* TestCafe ignores the quarantine mode options if you specify the configuration file ([#6420](https://github.com/DevExpress/testcafe/issues/6420)).
20* TestCafe test fails if you specify a custom option as a command line argument ([#6426](https://github.com/DevExpress/testcafe/issues/6426))
21* The [ERR_HTTP2_GOAWAY_SESSION](https://nodejs.org/api/errors.html#errors_err_http2_goaway_session) error occurs randomly when you use HTTP/2 protocol ([testcafe-hammerhead/#2653](https://github.com/DevExpress/testcafe-hammerhead/issues/2653)).
22* TestCafe fails if a page contains overridden getters for target elements ([testcafe-hammerhead/#2662](https://github.com/DevExpress/testcafe-hammerhead/issues/2662)).
23* TestCafe incorrectly processes scripts that destruct empty elements ([testcafe-hammerhead/#2670](https://github.com/DevExpress/testcafe-hammerhead/issues/2670)).
24
25## v1.15.1 (2021-07-28)
26
27### Bug Fixes
28
29* The `Element.getAttribute` method returns an incorrect value ([#5984](https://github.com/DevExpress/testcafe/issues/5984)).
30* TestCafe test fails when you forget to include the `await` keyword before the assertion statement ([#4613](https://github.com/DevExpress/testcafe/issues/4613)).
31* TestCafe fails to focus an element inside a shadow DOM ([#4988](https://github.com/DevExpress/testcafe/issues/4988)).
32* TestCafe fails to focus SVG elements ([#6262](https://github.com/DevExpress/testcafe/issues/6262)).
33* TestCafe raises the blur event when you focus a non-focusable element ([#6236](https://github.com/DevExpress/testcafe/pull/6236)).
34* TestCafe test hangs when you click a link within a cross-domain iframe ([#6331](https://github.com/DevExpress/testcafe/pull/6331)).
35* TestCafe loads the Babel compiler libraries multiple times ([#6310](https://github.com/DevExpress/testcafe/pull/6310)).
36* TestCafe incorrectly parses the meta refresh tags ([#2663](https://github.com/DevExpress/testcafe-hammerhead/pull/2663))
37* TestCafe incorrectly processes iframe elements with the "srcdoc" attribute ([#2647](https://github.com/DevExpress/testcafe-hammerhead/issues/2647)).
38* TestCafe incorrectly specifies the Referer HTTP request header if you use the "navigateTo" action ([#2607](https://github.com/DevExpress/testcafe-hammerhead/issues/2607)).
39* An error related to the [bug in Node.js](https://github.com/nodejs/node/issues/37849) occurs ([#2655](https://github.com/DevExpress/testcafe-hammerhead/pull/2655)).
40
41## v1.15.0 (2021-07-08)
42
43### Enhancements
44
45#### Dispatch DOM events ([PR #6103](https://github.com/DevExpress/testcafe/pull/6103))
46
47```plaintext
48t.dispatchEvent(target, eventName[, options])
49```
50
51The [`t.dispatchEvent`](https://testcafe.io/documentation/402712/reference/test-api/testcontroller/dispatchevent) method lets you interact with the page in ways that TestCafe does not support out of the box. To implement an unsupported user action, break it down into discrete DOM events, and use the `t.dispatchEvent` method to fire them.
52
53>Internet Explorer does [not](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event) support event constructors. As such, TestCafe cannot dispatch DOM events in this browser.
54
55The following example fires a `touchstart` action on an element with the 'button' id:
56
57```js
58await t.dispatchEvent('#button', 'touchstart', { eventConstructor: 'TouchEvent' });
59```
60
61Read the [Custom Actions Guide](https://testcafe.io/documentation/402843/guides/advanced-guides/custom-actions) for more information on DOM events and event constructors.
62
63#### Quarantine mode customization ([PR #6073](https://github.com/DevExpress/testcafe/pull/6073) by @rob4629)
64
65New settings are available in [quarantine mode](https://testcafe.io/documentation/402830/guides/basic-guides/run-tests#quarantine-mode). Quarantine mode repeats failing tests to help users get conclusive test results in sub-optimal conditions. TestCafe v1.15 adds two variables - `successThreshold` and `attemptLimit` - that allow you specify when TestCafe must stop.
66
67The `attemptLimit` variable determines the maximum possible number of test attempts.
68The `successThreshold` variable determines the number of successful attempts necessary for the test to pass.
69
70```js
71testcafe chrome ./tests/ -q attemptLimit=5, successThreshold=2
72```
73
74#### Password obfuscation ([#6014](https://github.com/DevExpress/testcafe/issues/6014))
75
76TestCafe reporters no longer receive the contents of `password` input fields, unless you explicitly specify otherwise. This improves security for users that store their test results online.
77
78#### Support for non-HTML documents ([#1471](https://github.com/DevExpress/testcafe/issues/1471))
79
80TestCafe now has the capability to proxy non-HTML documents such as XML and text files. Tests no longer hang upon redirection to a non-HTML address.
81
82### Bug Fixes
83
84* TestCafe doesn't raise an error if users specify the CDP port but do not enable concurrency ([PR #6268](https://github.com/DevExpress/testcafe/pull/6268)).
85* TestCafe incorrectly processes elements with negative tabIndex values ([#4848](https://github.com/DevExpress/testcafe/issues/4848)).
86* TestCafe incorrectly processes some eventListeners in multi-window mode ([#5621](https://github.com/DevExpress/testcafe/issues/5621)).
87* TestCafe incorrectly processes the \<base\> HTML tag ([testcafe-hammerhead/#1965](https://github.com/DevExpress/testcafe-hammerhead/issues/1965)).
88* TestCafe doesn't intercept `Navigator.prototype` requests ([PR testcafe-hammerhead/#2643](https://github.com/DevExpress/testcafe-hammerhead/pull/2643) by [@michaelficarra](https://github.com/michaelficarra)).
89* TestCafe doesn't intercept `WorkerGlobalScope.importScripts()` arguments ([testcafe-hammerhead/#2521](https://github.com/DevExpress/testcafe-hammerhead/issues/2521)).
90* A website parsing error causes test failure ([testcafe-hammerhead/#2650](https://github.com/DevExpress/testcafe-hammerhead/issues/2650)).
91* TestCafe stops recording test videos after you skip a fixture ([#6163](https://github.com/DevExpress/testcafe/issues/6163)).
92* Links with empty `download` attributes cause TestCafe to hang ([#6132](https://github.com/DevExpress/testcafe/issues/6132)).
93* TestCafe reports incorrect line numbers ([#5642](https://github.com/DevExpress/testcafe/issues/5642)).
94* TestCafe incorrectly processes some for-of statements ([PR testcafe-hammerhead/#2632](https://github.com/DevExpress/testcafe-hammerhead/pull/2632)).
95* TestCafe sometimes directs window location queries to non-window objects ([testcafe-hammerhead/#2611](https://github.com/DevExpress/testcafe-hammerhead/issues/2611)).
96* Performance enhancement: obtaining element attributes ([#6117](https://github.com/DevExpress/testcafe/issues/6117))
97
98## v1.14.2 (2021-05-13)
99
100## Bug Fixes
101
102* Fixed a bug that caused the `The "--quarantine-mode" option value is not a valid key-value pair` error
103
104## v1.14.1 (2021-05-12)
105
106## Bug Fixes
107
108* Fixed a bug that caused TestCafe to hang during the execution of TestCafe Studio tests ([#5207](https://github.com/DevExpress/testcafe/issues/5207))
109* Added a type definition for the `disableScreenshots` Runner option ([#5735](https://github.com/DevExpress/testcafe/issues/5735))
110* Fixed a multi-window mode bug that caused TestCafe to launch an empty browser window and then hang ([#6132](https://github.com/DevExpress/testcafe/issues/6132))
111* Fixed a bug that denied users access to iframes with `srcdoc` attributes ([#6033](https://github.com/DevExpress/testcafe/issues/6033))
112* Fixed a bug that interfered with the loading of Word Online documents in Firefox ([testcafe-hammerhead#2287](https://github.com/DevExpress/testcafe-hammerhead/issues/2287))
113
114## v1.14.0 (2021-4-7)
115
116## Enhancements
117
118### ⚙ Scroll Actions ([PR #6066](https://github.com/DevExpress/testcafe/pull/6066))
119
120When TestCafe interacts with elements on the page, it scrolls the page automatically to reach those elements.
121
122This release introduces actions that allow you to scroll webpage elements manually.
123
124* [t.scroll](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/scroll.html) - scrolls the element to a specified position
125* [t.scrollBy](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/scrollby.html) - scrolls the element by the specified number of pixels
126* [t.scrollIntoView](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/scrollintoview.html) - scrolls the element into view
127
128You can use the `t.scroll` action to scroll an element to a position:
129
130```js
131 import { Selector } from 'testcafe';
132
133 fixture`Scroll Action`
134 .page('http://example.com');
135
136 test('Scroll the container', async t => {
137 const container = Selector('#container');
138
139 await t
140 .scroll(container, 'bottomRight')
141 });
142 ```
143
144 `t.scrollBy` allows you to scroll an element (or the webpage) by a set amount of pixels. The example below scrolls the webpage 200px up and 500px to the right:
145
146 ```js
147 fixture`Scroll Action`
148 .page('http://example.com');
149
150 test('Scroll the webpage', async t => {
151 await t
152 .scrollBy(500, -200)
153 });
154 ```
155
156Use `t.scrollIntoView` to scroll an element into view:
157
158```js
159 import { Selector } from 'testcafe';
160
161 fixture `Scroll Actions`
162 .page `http://www.example.com/`;
163
164 test('Scroll element into view', async t => {
165 const target = Selector('#target')
166
167 await t
168 .scrollIntoView(target)
169 });
170 ```
171
172## Bug Fixes
173
174* Fixed an error that caused [expect.contains](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/expect/contains.html) assertions to display `undefined` instead of a string value in diffs ([#5473](https://github.com/DevExpress/testcafe/issues/5473))
175
176## v1.13.0 (2021-03-22)
177
178This release adds support for custom paths to the configuration file, support for Microsoft Edge on Linux systems, and multiple bugfixes.
179
180### Enhancements
181
182#### :gear: Specify Custom Path to the TestCafe Configuration File ([PR #6035](https://github.com/DevExpress/testcafe/pull/6035) by [@Chris-Greaves](https://github.com/Chris-Greaves))
183
184TestCafe now allows you to specify a custom [configuration file](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html) path.
185
186To set this path, use one of the following options:
187
188* the [--config-file CLI flag](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--config-file-path)
189* the [configFile parameter of the createTestCafe function](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/global/createtestcafe.html#options)
190
191#### Add Support for Microsoft Edge on Linux ([PR testcafe-browser-tools/#210](https://github.com/DevExpress/testcafe-browser-tools/pull/210) by [@dcsaszar](https://github.com/dcsaszar))
192
193If you follow the [Microsoft Edge Insider Channels for Linux](https://www.microsoftedgeinsider.com/en-us/download?platform=linux-deb) and have Microsoft Edge installed on your Linux machine, you can now launch TestCafe tests in this browser.
194
195```sh
196testcafe edge tests/test.js
197```
198
199#### :gear: Deprecated the `t.setPageLoadTimeout` method ([PR #5979](https://github.com/DevExpress/testcafe/pull/5979))
200
201Starting with v1.13.0, the [t.setPageLoadTimeout](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/setpageloadtimeout.html) method is deprecated. To set the page load timeout, use the new [test.timeouts](https://devexpress.github.io/testcafe/documentation/reference/test-api/test/timeouts.html) method.
202
203```js
204fixture`Setting Timeouts`
205 .page`http://devexpress.github.io/testcafe/example`;
206
207test
208 .timeouts({
209 pageLoadTimeout: 2000
210 })
211 ('My test', async t => {
212 //test actions
213 })
214```
215
216You can also use `test.timeouts` to set the [pageRequestTimeout](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#pagerequesttimeout) and [ajaxRequestTimeout](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#ajaxrequesttimeout).
217
218```js
219fixture`Setting Timeouts`
220 .page`http://devexpress.github.io/testcafe/example`;
221
222test
223 .timeouts({
224 pageLoadTimeout: 2000,
225 pageRequestTimeout: 60000,
226 ajaxRequestTimeout: 60000
227 })
228 ('My test', async t => {
229 //test actions
230 })
231```
232
233### Bug Fixes
234
235* Fixed a bug where TestCafe would sometimes be unable to trigger a `hover` event on a `radio` element ([#5916](https://github.com/DevExpress/testcafe/issues/5916))
236* Fixed a bug where TestCafe was unable to register a Service Worker due to the wrong `currentScope` calculation inside a `Window.postMessage` call ([testcafe-hammerhead/#2524](https://github.com/DevExpress/testcafe-hammerhead/issues/2524))
237* `RequestLogger` now shows a correct protocol for WebSocket requests ([testcafe-hammerhead/#2591](https://github.com/DevExpress/testcafe-hammerhead/issues/2591))
238* Test execution now pauses when the browser window is in the background ([testcafe-browser-tools/#158](https://github.com/DevExpress/testcafe-browser-tools/issues/158))
239* TestCafe now appends an extension to screenshot filenames ([#5103](https://github.com/DevExpress/testcafe/issues/5103))
240* Fixed a bug where TestCafe would emit test action events after the end of a test run ([#5650](https://github.com/DevExpress/testcafe/issues/5650))
241* TestCafe now closes if the `No tests to run` error occurs in Live mode ([#4257](https://github.com/DevExpress/testcafe/issues/4257))
242* Fixed a freeze that happened when you run a test suite with skipped tests ([#4967](https://github.com/DevExpress/testcafe/issues/4967))
243* Fixed an error where a `documentElement.transform.translate` call moved the TestCafe UI in the browser window ([#5606](https://github.com/DevExpress/testcafe/issues/5606))
244* TestCafe now emits a warning if you pass an unawaited selector to an assertion ([#5554](https://github.com/DevExpress/testcafe/issues/5554))
245* Fixed a crash that sometimes occurred in Chrome v85 and earlier on pages with scripts ([PR testcafe-hammerhead/#2590](https://github.com/DevExpress/testcafe-hammerhead/pull/2590))
246
247## v1.12.0 (2021-03-03)
248
249### Enhancements
250
251#### :gear: Server-Side Web Assets Caching ([testcafe-hammerhead/#863](https://github.com/DevExpress/testcafe-hammerhead/issues/863))
252
253TestCafe's proxy server can now cache web assets (like images, scripts and videos). When TestCafe revisits a website, it loads assets from this cache to save time on repetetive network requests.
254
255To enable server-side caching, use any of the following:
256
257* [the `--cache` CLI flag](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--cache)
258* [the `cache` configuration file property](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#cache)
259* [the `createTestCafe` function parameter](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/global/createtestcafe.html)
260
261#### Initialize Request Hooks with Async Predicates
262
263The following request hooks now support **asynchronous** predicate functions:
264
265* [RequestHook](https://devexpress.github.io/testcafe/documentation/reference/test-api/requesthook/constructor.html#filter-with-a-predicate)
266* [RequestMock.onRequestTo](https://devexpress.github.io/testcafe/documentation/reference/test-api/requestmock/onrequestto.html#filter-with-a-predicate)
267* [RequestLogger](https://devexpress.github.io/testcafe/documentation/reference/test-api/requestlogger/constructor.html#filter-with-a-predicate)
268
269**Example**
270
271```js
272const logger = RequestLogger(async request => {
273 return await myAsyncFunction();
274});
275```
276
277### Bug Fixes
278
279* Fixed a bug in Multiple Windows mode where TestCafe was sometime unable to switch to the main browser window ([#5930](https://github.com/DevExpress/testcafe/issues/5930))
280* Fixed the `Illegal invocation` error thrown by TestCafe when calling `Storage.prototype` methods on a `StorageWrapper` object ([#2526](https://github.com/DevExpress/testcafe-hammerhead/issues/2526))
281
282## v1.11.0 (2021-03-02)
283
284### Enhancements
285
286#### :gear: Set Request Timeouts ([PR #5692](https://github.com/DevExpress/testcafe/pull/5692))
287
288TestCafe now enables you to set request timeouts. If TestCafe receives no response within the specified period, it throws an error.
289
290*CLI*
291
292* [--ajax-request-timeout](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--ajax-request-timeout-ms) controls the timeout for fetch/XHR requests
293* [--page-request-timeout](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--page-request-timeout-ms) sets the timeout for webpage requests
294
295```sh
296testcafe chrome my-tests --ajax-request-timeout 40000 --page-request-timeout 8000
297```
298
299*Configuration file*
300
301* [ajaxRequestTimeout](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#ajaxrequesttimeout)
302* [pageRequestTimeout](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#pagerequesttimeout)
303
304```json
305{
306 "pageRequestTimeout": 8000,
307 "ajaxRequestTimeout": 40000
308}
309```
310
311*JavaScript API*
312
313These options are available in the [runner.run Method](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/runner/run.html).
314
315```js
316const createTestCafe = require('testcafe');
317
318const testcafe = await createTestCafe('localhost', 1337, 1338);
319
320try {
321 const runner = testcafe.createRunner();
322
323 const failed = await runner.run({
324 pageRequestTimeout: 8000,
325 ajaxRequestTimeout: 40000
326 });
327
328 console.log('Tests failed: ' + failed);
329}
330finally {
331 await testcafe.close();
332}
333```
334
335#### :gear: Set Browser Initialization Timeout ([PR #5720](https://github.com/DevExpress/testcafe/pull/5720))
336
337This release introduces an option to control browser initialization timeout. This timeout controls the time browsers have to connect to TestCafe before an error is thrown. You can control this timeout in one of the following ways:
338
339* [--browser-init-timeout](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--browser-init-timeout-ms) CLI option
340
341```sh
342testcafe chrome my-tests --browser-init-timeout 180000
343```
344
345* [browserInitTimeout](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#browserinittimeout) configuration option
346
347```json
348{
349 "browserInitTimeout": 180000
350}
351```
352
353* [runner.run Method](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/runner/run.html) parameter
354
355```js
356runner.run({ "browserInitTimeout": 180000 })
357```
358
359This setting sets an equal timeout for local and [remote browsers](https://devexpress.github.io/testcafe/documentation/guides/concepts/browsers.html#browsers-on-remote-devices).
360
361#### Improved `Unable To Establish Browser Connection` Error Message ([PR #5720](https://github.com/DevExpress/testcafe/pull/5720))
362
363TestCafe raises this error when at least one local or remote browser was not able to connect. The error message now includes the number of browsers that have not established a connection.
364
365TestCafe raises a warning if low system performance is causing the connectivity issue.
366
367#### :gear: An Option to Retry Requests for the Test Page ([PR #5738](https://github.com/DevExpress/testcafe/pull/5738))
368
369If a tested webpage was not served after the first request, TestCafe can now retry the request.
370
371You can enable this functionality with a command line, API, or configuration file option:
372
373* the [--retry-test-pages](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--retry-test-pages) command line argument
374
375 ```sh
376 testcafe chrome test.js --retry-test-pages
377 ```
378
379* the [createTestCafe](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/global/createtestcafe.html) function parameter
380
381 ```js
382 const createTestCafe = require('testcafe');
383
384 const testcafe = await createTestCafe('localhost', 1337, 1338, retryTestPages)
385 ```
386
387* the [retryTestPages](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#retrytestpages) configuration file property
388
389 ```json
390 {
391 "retryTestPages": true
392 }
393 ```
394
395### Bug Fixes
396
397* Fixed a bug where `Selector.withText` couldn't locate elements inside an `iframe` ([#5886](https://github.com/DevExpress/testcafe/issues/5886))
398* Fixed a bug where TestCafe was sometimes unable to detect when a browser instance closes ([#5857](https://github.com/DevExpress/testcafe/issues/5857))
399* You can now install TestCafe with `Yarn 2` ([PR #5872](https://github.com/DevExpress/testcafe/pull/5872) by [@NiavlysB](https://github.com/NiavlysB))
400* Fixed a bug where the `typeText` action does not always replace existing text ([PR #5942](https://github.com/DevExpress/testcafe/pull/5942) by [@rueyaa332266](https://github.com/rueyaa332266))
401* Fixed a bug where TestCafe was sometimes unable to create a `Web Worker` from an object ([testcafe-hammerhead/#2512](https://github.com/DevExpress/testcafe-hammerhead/issues/2512))
402* Fixed an error thrown by TestCafe proxy when trying to delete an object property that does not exist ([testcafe-hammerhead/#2504](https://github.com/DevExpress/testcafe-hammerhead/issues/2504))
403* Fixed an error thrown by TestCafe proxy when a Service Worker overwrites properties of a `window` object ([testcafe-hammerhead/#2538](https://github.com/DevExpress/testcafe-hammerhead/issues/2538))
404* Fixed a bug where `t.openWindow` method requested a URL twice ([testcafe-hammerhead/#2544](https://github.com/DevExpress/testcafe-hammerhead/issues/2544))
405* Fixed an error (`TypeError: Illegal invocation`) thrown by TestCafe on pages that contain an XMLDocument with an `iframe` ([testcafe-hammerhead/#2554](https://github.com/DevExpress/testcafe-hammerhead/issues/2554))
406* Fixed an error (`SyntaxError: Identifier has already been declared`) thrown by TestCafe on pages with scripts that create nested JavaScript objects ([testcafe-hammerhead/#2506](https://github.com/DevExpress/testcafe-hammerhead/issues/2506))
407* Fixed a bug where TestCafe was unable to focus elements within shadow DOM ([testcafe-hammerhead/#2408](https://github.com/DevExpress/testcafe-hammerhead/issues/2408))
408* TestCafe now throws an error when an entity of type other than `Error` is thrown in a test script ([PR testcafe-hammerhead/#2536](https://github.com/DevExpress/testcafe-hammerhead/pull/2536))
409* Fixed a bug where TestCafe was sometimes unable to resolve relative URLs ([testcafe-hammerhead/#2399](https://github.com/DevExpress/testcafe-hammerhead/issues/2399))
410* Properties of `window.location.constructor` are now shadowed correctly by TestCafe proxy ([testcafe-hammerhead/#2423](https://github.com/DevExpress/testcafe-hammerhead/issues/2423))
411* TestCafe proxy now correctly handles requests that are not permitted by the CORS policy ([testcafe-hammerhead/#1263](https://github.com/DevExpress/testcafe-hammerhead/issues/1263))
412* Improved compatibility with test pages that use `with` statements ([testcafe-hammerhead/#2434](https://github.com/DevExpress/testcafe-hammerhead/issues/2434))
413* TestCafe proxy can now properly parse statements that use a comma operator in `for..of` loops ([testcafe-hammerhead/#2573](https://github.com/DevExpress/testcafe-hammerhead/issues/2573))
414* Fixed a bug where TestCafe would open a new window even if `preventDefault` is present in element's event handler ([testcafe-hammerhead/#2582](https://github.com/DevExpress/testcafe-hammerhead/pull/2582))
415
416### Vulnerability Fix ([PR #5843](https://github.com/DevExpress/testcafe/pull/5843), [PR testcafe-hammerhead#2531](https://github.com/DevExpress/testcafe-hammerhead/pull/2531))
417
418We have fixed a vulnerability found in the [debug](https://www.npmjs.com/package/debug) module we use for debugging.
419The vulnerability was a [ReDos Vulnerability Regression](https://github.com/visionmedia/debug/issues/797) that affected all TestCafe users. TestCafe now uses `debug@4.3.1`, where the issue is fixed.
420
421## v1.10.1 (2020-12-24)
422
423### Bug Fixes
424
425* Fixed an error thrown when TestCafe runs TypeScript tests ([#5808](https://github.com/DevExpress/testcafe/issues/5808))
426* Implemented a Service Worker that allows TestCafe to re-try failed requests to the tested page. This improves test stability ([#5239](https://github.com/DevExpress/testcafe/issues/5239))
427* Fixed an error thrown when you call the `t.getBrowserConsoleMessages` method ([#5600](https://github.com/DevExpress/testcafe/issues/5600))
428
429## v1.10.0 (2020-12-15)
430
431### Enhancements
432
433#### Window Resize and Screenshot Support for Child Windows in Chrome ([PR #5661](https://github.com/DevExpress/testcafe/pull/5661), [PR #5567](https://github.com/DevExpress/testcafe/pull/5567))
434
435You can now use the following actions in Google Chrome when you switch the test context to a [child window](https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/multiple-browser-windows.html):
436
437* [t.maximizeWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/maximize.html)
438* [t.resizeWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/resizewindow.html)
439* [t.resizeWindowToFitDevice](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/resizewindowtofitdevice.html)
440* [t.takeElementScreenshot](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/takeelementscreenshot.html)
441* [t.takeScreenshot](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/takescreenshot.html)
442
443#### New API to Specify Compiler Options ([#5519](https://github.com/DevExpress/testcafe/issues/5519))
444
445In previous versions, you used the following methods to specify TypeScript compiler options:
446
447* the [--ts-config-path](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--ts-config-path-path) command line flag
448
449 ```sh
450 testcafe chrome my-tests --ts-config-path path/to/config.json
451 ```
452
453* the [runner.tsConfigPath](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/runner/tsconfigpath.html) method
454
455 ```js
456 runner.tsConfigPath('path/to/config.json');
457 ```
458
459* the [tsConfigPath](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#tsconfigpath) configuration file property
460
461 ```json
462 {
463 "tsConfigPath": "path/to/config.json"
464 }
465 ```
466
467In v1.10.0, we introduced a new easy-to-use API that allows you to specify the compiler options in the command line, API or TestCafe configuration file, without creating a separate JSON file. The new API is also designed to accept options for more compilers (for instance, Babel) in future releases.
468
469The API consists of the following members:
470
471* the [--compiler-options](https://devexpress.github.io/testcafe/documentation/reference/command-line-interface.html#--compiler-options-options) command line flag
472
473 ```sh
474 testcafe chrome my-tests --compiler-options typescript.experimentalDecorators=true
475 ```
476
477* the [runner.compilerOptions](https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/runner/compileroptions.html) method
478
479 ```js
480 runner.compilerOptions({
481 typescript: {
482 experimentalDecorators: true
483 }
484 });
485 ```
486
487* the [compilerOptions](https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#compileroptions) configuration file property
488
489 ```json
490 {
491 "compilerOptions": {
492 "typescript": {
493 "experimentalDecorators": true
494 }
495 }
496 }
497 ```
498
499If you prefer to keep compiler settings in a configuration file, you can use the new API to specify the path to this file:
500
501```sh
502testcafe chrome my-tests --compiler-options typescript.configPath='path/to/config.json'
503```
504
505In v1.10.0, you can customize TypeScript compiler options only.
506
507For more information, see [TypeScript and CoffeeScript](https://devexpress.github.io/testcafe/documentation/guides/concepts/typescript-and-coffeescript.html).
508
509#### Added a Selector Method to Access Shadow DOM ([PR #5560](https://github.com/DevExpress/testcafe/pull/5560) by [@mostlyfabulous](https://github.com/mostlyfabulous))
510
511This release introduces the [selector.shadowRoot](https://devexpress.github.io/testcafe/documentation/reference/test-api/selector/shadowroot.html) method that allows you to access and interact with the shadow DOM elements. This method returns a shadow DOM root hosted in the selector's matched element.
512
513```js
514import { Selector } from 'testcafe'
515
516fixture `Target Shadow DOM elements`
517 .page('https://devexpress.github.io/testcafe/example')
518
519test('Get text within shadow tree', async t => {
520 const shadowRoot = Selector('div').withAttribute('id', 'shadow-host').shadowRoot();
521 const paragraph = shadowRoot.child('p');
522
523 await t.expect(paragraph.textContent).eql('This paragraph is in the shadow tree');
524});
525```
526
527Note that you should chain other [selector methods](https://devexpress.github.io/testcafe/documentation/guides/basic-guides/select-page-elements.html#member-tables) to [selector.shadowRoot](https://devexpress.github.io/testcafe/documentation/reference/test-api/selector/shadowroot.html) to access elements in the shadow DOM. You cannot interact with the root element (an error occurs if you specify `selector.shadowRoot` as an action's target element).
528
529### Bug Fixes
530
531* Browsers now restart correctly on BrowserStack when the connection is lost ([#5238](https://github.com/DevExpress/testcafe/issues/5238))
532* Fixed an error that occurs if a child window is opened in an `iframe` ([#5033](https://github.com/DevExpress/testcafe/issues/5033))
533* TestCafe can now switch between the child and parent windows after the parent window is reloaded ([#5463](https://github.com/DevExpress/testcafe/issues/5463), [#5597](https://github.com/DevExpress/testcafe/issues/5597))
534* Fixed an issue when touch and mouse events fired on mobile devices even though the mouse event was prevented in page code ([#5380](https://github.com/DevExpress/testcafe/issues/5380))
535* Cross-domain `iframes` are now focused correctly in Safari ([#4793](https://github.com/DevExpress/testcafe/issues/4793))
536* Fixed an excessive warning displayed when an assertion is executed in a loop or against an element returned by a `selector.xxxSibling` method ([#5449](https://github.com/DevExpress/testcafe/issues/5449), [#5389](https://github.com/DevExpress/testcafe/issues/5389))
537* A page error is no longer emitted if the destination server responded with the `304` status ([#5025](https://github.com/DevExpress/testcafe/issues/5025))
538* Fixed an issue when TestCafe could not authenticate websites that use MSAL ([#4834](https://github.com/DevExpress/testcafe/issues/4834))
539* The `srcdoc` attributes for `iframes` are now processed ([testcafe-hammerhead/#1237](https://github.com/DevExpress/testcafe-hammerhead/issues/1237))
540* The `authorization` header is now preserved in response headers of fetch requests ([testcafe-hammerhead/#2334](https://github.com/DevExpress/testcafe-hammerhead/issues/2334))
541* The `document.title` for an `iframe` without `src` can now be correctly obtained in Firefox ([PR testcafe-hammerhead/#2466](https://github.com/DevExpress/testcafe-hammerhead/pull/2466))
542* TestCafe UI is now displayed correctly if the tested page's body content is added dynamically ([PR testcafe-hammerhead/#2454](https://github.com/DevExpress/testcafe-hammerhead/pull/2454))
543* Service Workers now receive `fetch` events ([testcafe-hammerhead/#2412](https://github.com/DevExpress/testcafe-hammerhead/issues/2412))
544* Fixed the case of headers sent to the web app server ([testcafe-hammerhead/#2344](https://github.com/DevExpress/testcafe-hammerhead/issues/2344))
545* `Location` objects in `iframes` without `src` now contain the correct data ([PR testcafe-hammerhead/#2448](https://github.com/DevExpress/testcafe-hammerhead/pull/2448))
546* Native function wrappers are now converted to strings correctly ([testcafe-hammerhead/#2394](https://github.com/DevExpress/testcafe-hammerhead/issues/2394))
547* Values retrieved from the local storage are now converted to strings ([testcafe-hammerhead/#2313](https://github.com/DevExpress/testcafe-hammerhead/issues/2313))
548* Fixed an issue when relative URLs were resolved incorrectly in `iframes` ([testcafe-hammerhead/#2461](https://github.com/DevExpress/testcafe-hammerhead/issues/2461))
549* Fixed an issue when TestCafe took a very long time to process large CSS files ([testcafe-hammerhead/#2475](https://github.com/DevExpress/testcafe-hammerhead/issues/2475))
550* Fixed an issue with client-side JavaScript processing ([testcafe-hammerhead/#2442](https://github.com/DevExpress/testcafe-hammerhead/issues/2442))
551* Fixed an issue that suppressed Adobe Launch Analytics requests ([testcafe-hammerhead/#2453](https://github.com/DevExpress/testcafe-hammerhead/issues/2453))
552* Added support for Web Workers created from Blob URLs ([testcafe-hammerhead/#1221](https://github.com/DevExpress/testcafe-hammerhead/issues/1221))
553* Fixed an issue when network requests were not received by the server ([testcafe-hammerhead/#2467](https://github.com/DevExpress/testcafe-hammerhead/issues/2467))
554* Cross-domain `iframe` source links now have the correct protocol when SSL is used ([PR testcafe-hammerhead/#2478](https://github.com/DevExpress/testcafe-hammerhead/pull/2478))
555
556## v1.9.4 (2020-10-2)
557
558### Bug Fixes
559
560* Fixed an error thrown when TestCafe tested pages that access `document.title` ([#5559](https://github.com/DevExpress/testcafe/issues/5559), [PR testcafe-hammerhead/#2451](https://github.com/DevExpress/testcafe-hammerhead/pull/2451), [PR testcafe-hammerhead/#2446](https://github.com/DevExpress/testcafe-hammerhead/pull/2446))
561* Fixed a crash occurred when `null` was passed to the `createTestCafe()` API function ([#5549](https://github.com/DevExpress/testcafe/issues/5549))
562* Fixed an error thrown when the `content-encoding` header value was in the upper case ([testcafe-hammerhead/#2427](https://github.com/DevExpress/testcafe-hammerhead/issues/2427))
563* Fixed a crash that occurred in IE11 when Web Workers were used ([PR testcafe-hammerhead/#2441](https://github.com/DevExpress/testcafe-hammerhead/pull/2441) by [@danielroe](https://github.com/danielroe))
564* HTML nodes are now ordered correctly on tested web pages with Shadow UI ([PR testcafe-hammerhead/#2447](https://github.com/DevExpress/testcafe-hammerhead/pull/2447))
565
566## v1.9.3 (2020-9-17)
567
568### Bug Fixes
569
570* Fixed the `RequestMock` type definitions to accept any type for the headers ([#5529](https://github.com/DevExpress/testcafe/issues/5529))
571* TestCafe no longer displays a warning about missing `await` when you save a snapshot property to a variable but do not use it later in the test ([#5534](https://github.com/DevExpress/testcafe/issues/5534))
572* Consecutive `document.getElementsByTagName('body')` calls now produce the correct results even if the first call was made before a document body was parsed entirely ([#5322](https://github.com/DevExpress/testcafe/issues/5322))
573
574## v1.9.2 (2020-9-2)
575
576### Bug Fixes
577
578* TestCafe's TypeScript definitions now allow `null` as an expected value in assertions ([PR #5456](https://github.com/DevExpress/testcafe/pull/5456))
579* Added warnings displayed when a user tries to get a snapshot property value and misses `await` ([PR #5383](https://github.com/DevExpress/testcafe/pull/5383), part of [#5087](https://github.com/DevExpress/testcafe/issues/5087))
580* Tested app's standard output and error streams are forwarded to the TestCafe's debug log now ([#5423](https://github.com/DevExpress/testcafe/issues/5423))
581* Tested apps no longer cause buffer overflow errors when they output too much data to standard streams ([#2857](https://github.com/DevExpress/testcafe/issues/2857))
582* TestCafe now correctly waits for elements on tested pages that mock date functions ([#5447](https://github.com/DevExpress/testcafe/issues/5447))
583* HTTP header overflow errors now occur less frequently due to the increased maximum header size. Enhanced the error message with troubleshooting instructions ([testcafe-hammerhead/#2356](https://github.com/DevExpress/testcafe-hammerhead/issues/2356))
584* Added a descriptive message with troubleshooting instructions for the error thrown when the tested web server sends malformed or non-standard headers ([testcafe-hammerhead/#2188](https://github.com/DevExpress/testcafe-hammerhead/issues/2188))
585* Fixed a CSRF error on tested pages that use the `Request` class ([testcafe-hammerhead/#2140](https://github.com/DevExpress/testcafe-hammerhead/issues/2140))
586* `t.hover` now works correctly for tested pages built with the Styled Components framework ([#3830](https://github.com/DevExpress/testcafe/issues/3830))
587* Fixed script processing that could cause unhandled exceptions on some pages ([testcafe-hammerhead/#2417](https://github.com/DevExpress/testcafe-hammerhead/issues/2417))
588* Fixed the 'TypeError: r is not a function' uncaught exception on some pages with an `<iframe>` ([testcafe-hammerhead/#2392](https://github.com/DevExpress/testcafe-hammerhead/issues/2392))
589
590## v1.9.1 (2020-8-12)
591
592### Bug Fixes
593
594* Pages proxied with TestCafe now expose the correct `File` object for uploaded files ([testcafe-hammerhead/#2338](https://github.com/DevExpress/testcafe-hammerhead/issues/2338))
595
596## v1.9.0 (2020-8-6)
597
598### Enhancements
599
600#### 🌟 Multi Window Support (Beta)
601
602TestCafe can now automate user actions in multiple windows. You can switch between open windows during the test. Make edits in one window and check that the other window's content changes dynamically to reflect these modifications.
603
604![Testing in multiple windows](docs/articles/images/blog/2020-07-23-multi-window.gif)
605
606When the main window opens a child window, TestCafe automatically switches to this new window and continues test actions there:
607
608```js
609import { Selector } from 'testcafe';
610
611fixture `Login page`
612 .page('https://login.wrike.com/login/');
613
614const googleButton = Selector('div.login-panel-footer__login-with > button');
615
616test('Login via Google', async t => {
617 await t
618 .click(googleButton)
619 .typeText('input[type=email]', 'This text will be entered inside the pop-up');
620});
621```
622
623You can use the [t.openWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/openwindow.html) method to open a child window in test code:
624
625```js
626import { Selector, ClientFunction } from 'testcafe';
627
628fixture `Test page`
629 .page('https://devexpress.github.io/testcafe/example/');
630
631test('Open a new window', async t => {
632 await t.openWindow('http://example.com');
633
634 const url = await t.eval(() => document.documentURI);
635
636 await t.expect(url).eql('http://example.com');
637});
638```
639
640The [t.switchToWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/switchtowindow.html) method enables you to switch between open windows. You can use a window descriptor or a predicate to specify the window that should be activated:
641
642```js
643fixture `Example page`
644 .page('https://example.com');
645
646test('Switch to a specific window', async t => {
647 const initialWindow = await t.getCurrentWindow();
648 const popUp1 = await t.openWindow('https://devexpress.com');
649 const popUp2 = await t.openWindow('https://github.com');
650
651 await t.switchToWindow(initialWindow);
652
653 const url = t.eval(() => document.documentURI);
654
655 await t.expect(url).eql('https://example.com/');
656
657 await t
658 .switchToWindow(w => w.url.host === 'github.com')
659 .expect(url).eql('https://github.com');
660});
661```
662
663The [t.switchToParentWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/switchtoparentwindow.html) and [t.switchToPreviousWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/switchtopreviouswindow.html) methods allow you to switch back to the parent window or the previously active window.
664
665The [t.closeWindow](https://devexpress.github.io/testcafe/documentation/reference/test-api/testcontroller/closewindow.html) method closes the current window when called without arguments, or the specified window if you pass a descriptor or predicate:
666
667```js
668fixture `Example page`
669 .page('http://www.example.com');
670
671test('Close the current window', async t => {
672 const window1 = await t.openWindow('http://devexpress.com');
673
674 await t.closeWindow();
675
676 const url = await t.eval(() => document.documentURI);
677
678 await t.expect(url).eql('http://www.example.com/');
679});
680
681test('Close a specific window', async t => {
682 const window1 = await t.openWindow('http://devexpress.com');
683
684 await t.closeWindow(window1);
685});
686```
687
688#### Detailed Diffs in Failed Assertions
689
690Test run reports now show the differences between an assertion's actual and expected values:
691
692![A report showing differences between asserted values](docs/articles/images/blog/2020-07-23-rich-diffs.png)
693
694TestCafe can display difference between values, arrays, objects, and even functions.
695
696### Bug Fixes
697
698* TestCafe now throws a descriptive error when it attempts to start the browser UI on Linux without the X11 server ([4461](https://github.com/DevExpress/testcafe/issues/4461))
699* Exception no longer thrown when you use remote browsers on Linux without X11 or run Windows browsers from WSL2 ([#4742](https://github.com/DevExpress/testcafe/issues/4742))
700* Fixed a syntax error on pages whose code destructures empty function parameters ([testcafe-hammerhead/#2391](https://github.com/DevExpress/testcafe-hammerhead/issues/2391))
701* Fixed a bug when page titles were displayed incorrectly ([testcafe-hammerhead/#2374](https://github.com/DevExpress/testcafe-hammerhead/issues/2374))
702
703## v1.8.8 (2020-7-6)
704
705### Bug Fixes
706
707* TestCafe now emits warnings when `ClientFunction` and `Selector` instances are asserted without a call ([#5211](https://github.com/DevExpress/testcafe/pull/5211))
708* Fixed click simulation for Ionic framework elements that use the `disabled` attribute ([#5141](https://github.com/DevExpress/testcafe/issues/5141))
709* Improved compatibility with test pages that use destructuring in the `for..of` loops ([testcafe-hammerhead#2363](https://github.com/DevExpress/testcafe-hammerhead/issues/2363))
710* Improved compatibility with test pages that use destructuring in ternary expressions ([testcafe-hammerhead#2362](https://github.com/DevExpress/testcafe-hammerhead/issues/2362))
711* Improved compatibility with pages that use SVG elements with the `title` tag ([testcafe-hammerhead#2364](https://github.com/DevExpress/testcafe-hammerhead/issues/2364))
712* Fixed the `Failed to execute 'postMessage' on 'Window'` exception for test pages that use the `<iframe>` tags ([testcafe-hammerhead#2165](https://github.com/DevExpress/testcafe-hammerhead/issues/2165))
713
714## v1.8.7 (2020-6-23)
715
716### Bug Fixes
717
718* TestCafe now shows the emulated device's name in the report when tests run in Chrome Emulation Mode ([#3290](https://github.com/DevExpress/testcafe/issues/3290))
719* Event simulation for Knockout.js inputs has been enhanced ([#4881](https://github.com/DevExpress/testcafe/issues/4881))
720* Fixed authentication issues for specific web apps ([testcafe-hammerhead/#2344](https://github.com/DevExpress/testcafe-hammerhead/issues/2344))
721* Enhanced interoperability for pages that use ES6 destructuring ([testcafe-hammerhead/#642](https://github.com/DevExpress/testcafe-hammerhead/issues/642))
722* Fixed `<title>` element handling in iframes ([testcafe-hammerhead/#2340](https://github.com/DevExpress/testcafe-hammerhead/issues/2340))
723* Enhanced compatibility with the `axe` accessibility testing library ([testcafe-hammerhead/#2350](https://github.com/DevExpress/testcafe-hammerhead/issues/2350))
724
725## v1.8.6 (2020-6-1)
726
727### Bug Fixes
728
729* Added TypeScript definitions for the `RequestMock.onRequestTo` and `RequestMock.respond` methods ([#5108](https://github.com/DevExpress/testcafe/issues/5108))
730* Added a TypeScript definition for the client script's `module` option ([#5071](https://github.com/DevExpress/testcafe/issues/5071))
731* TestCafe can now run `.jsx` and `.tsx` files with test code ([#4817](https://github.com/DevExpress/testcafe/issues/4817))
732* Firefox now uses the system certificate storage by default on Windows ([PR#5077](https://github.com/DevExpress/testcafe/pull/5077)) by [@rybesh](https://github.com/rybesh)
733* Fixed an error that occurred in PowerShell Strict Mode ([#4665](https://github.com/DevExpress/testcafe/issues/4665))
734* Fixed a bug that prevented tested pages from changing their title ([testcafe-hammerhead/#2328](https://github.com/DevExpress/testcafe-hammerhead/issues/2328))
735* Fixed an `Invalid Calling Object` error in IE11 ([testcafe-hammerhead/#2236](https://github.com/DevExpress/testcafe-hammerhead/issues/2236))
736* Fixed an error (`Cannot read property 'on' of undefined`) that occurred when testing iframes ([testcafe-hammerhead/#2326](https://github.com/DevExpress/testcafe-hammerhead/issues/2326))
737* Fixed a bug when `MutationObserver.prevSibling` and `MutationObserver.nextSibling` returned wrong values ([testcafe-hammerhead/#2321](https://github.com/DevExpress/testcafe-hammerhead/issues/2321))
738* Fixed a page render error that occurred when using ES6 `Proxy` ([testcafe-hammerhead/#2056](https://github.com/DevExpress/testcafe-hammerhead/issues/2056))
739* Fixed the `ERR_HTTP_HEADERS_SENT` error ([testcafe-hammerhead/#2317](https://github.com/DevExpress/testcafe-hammerhead/issues/2317))
740* Fixed a `QuotaExceedError` error occurred when the `LocalStorage` API was used ([testcafe-hammerhead/#1454](https://github.com/DevExpress/testcafe-hammerhead/issues/1454))
741
742## v1.8.5 (2020-5-19)
743
744### Bug Fixes
745
746* The Linux version in the Docker image was updated to support the latest browsers ([#5057](https://github.com/DevExpress/testcafe/issues/5057))
747* Fixed a regression in `selector.filterVisible` behavior ([#5002](https://github.com/DevExpress/testcafe/issues/5002))
748* Fixed a bug when `iframe` content did not load ([#3904](https://github.com/DevExpress/testcafe/issues/3904))
749* Enhanced a number of error messages ([#4841](https://github.com/DevExpress/testcafe/issues/4841), [#4860](https://github.com/DevExpress/testcafe/issues/4860), [testcafe-hammerhead/PR#2288](https://github.com/DevExpress/testcafe-hammerhead/pull/2288))
750* Fixed an exception that occurred when selecting text in `email` inputs ([#4893](https://github.com/DevExpress/testcafe/issues/4893))
751* Fixed a bug when the `www-authenticate` header was skipped ([testcafe-hammerhead/#2286](https://github.com/DevExpress/testcafe-hammerhead/issues/2286))
752* Fixed stack overflow caused by `WindowSync.syncBetweenWindows` ([testcafe-hammerhead/#2285](https://github.com/DevExpress/testcafe-hammerhead/issues/2285))
753* Fixed an issue with HTTP requests broken due to the `cache-control` header ([testcafe-hammerhead/#2226](https://github.com/DevExpress/testcafe-hammerhead/issues/2226))
754* Fixed an authentication issue related to cookies set by mistake ([testcafe-hammerhead/#2166](https://github.com/DevExpress/testcafe-hammerhead/issues/2166))
755
756## v1.8.4 (2020-4-7)
757
758### Bug Fixes
759
760* TestCafe no longer throws an error when you access the `visible` selector property for a non-existing element ([#2386](https://github.com/DevExpress/testcafe/issues/2386))
761* `t.pressKey` now works if the active element is inside the Shadow DOM ([#2432](https://github.com/DevExpress/testcafe/issues/2432))
762* An original Node.js error is displayed if a browser provider was unable to load ([#4522](https://github.com/DevExpress/testcafe/issues/4522))
763* Custom hooks that use `responseEventConfigureOpts` now trigger the `onResponse` handler for AJAX requests ([testcafe-hammerhead/#2190](https://github.com/DevExpress/testcafe-hammerhead/issues/2190))
764
765## v1.8.3 (2020-3-17)
766
767### Bug Fixes
768
769* Added TypeScript definitions for the `disablePageCaching` and `disablePageReload` methods ([PR #4751](https://github.com/DevExpress/testcafe/pull/4751) by [@jaypea](https://github.com/jaypea))
770* Fixed a bug where tests hung at random moments in Chrome ([#4530](https://github.com/DevExpress/testcafe/issues/4530))
771* Fixed a bug that led to crashes when TestCafe clicked an SVG element in IE11 ([#4709](https://github.com/DevExpress/testcafe/issues/4709))
772* Tests can now click buttons inside elements whose `disabled` property is set to `true` ([testcafe-hammerhead/#2234](https://github.com/DevExpress/testcafe-hammerhead/issues/2234))
773* TestCafe now emits the `change` event in Chrome when an input's `disabled` property is set to `true` ([testcafe-hammerhead/#2240](https://github.com/DevExpress/testcafe-hammerhead/issues/2240))
774* TestCafe Hammerhead now processed `await` keywords with a parenthesis in client scripts correctly ([testcafe-hammerhead/#2255](https://github.com/DevExpress/testcafe-hammerhead/issues/2255))
775* The `click` event action now crosses into the standard DOM from Web Component's shadow DOM ([testcafe-hammerhead/#2272](https://github.com/DevExpress/testcafe-hammerhead/issues/2272))
776
777## v1.8.2 (2020-2-17)
778
779### Bug Fixes
780
781* Added new device names to the `t.resizeWindowToFitDevice` action ([#3767](https://github.com/DevExpress/testcafe/issues/3767))
782* You can now use several reporters with no output stream specified if only one reporter writes to `stdout` ([#3765](https://github.com/DevExpress/testcafe/issues/3765), [#4675](https://github.com/DevExpress/testcafe/issues/4675))
783* Added TypeScript definitions for the `timestamp` property in request and response data objects ([#4718](https://github.com/DevExpress/testcafe/issues/4718))
784* You can now execute asynchronous code in the custom response function ([#4467](https://github.com/DevExpress/testcafe/issues/4467))
785* TestCafe now emits the `beforeInput` event for `contentEditable` elements ([#4644](https://github.com/DevExpress/testcafe/issues/4644))
786* Added TypeScript definitions for the `runner.video` method ([PR#4636](https://github.com/DevExpress/testcafe/pull/4636))
787* Hammerhead now overrides the `EventTarget` class methods ([testcafe-hammerhead/#1902](https://github.com/DevExpress/testcafe-hammerhead/issues/1902))
788* A proxied request no longer hangs if the request to the original site emits an error ([testcafe-hammerhead/#1961](https://github.com/DevExpress/testcafe-hammerhead/issues/1961))
789* Fixed a memory leak that occurred due to unclosed sockets ([testcafe-hammerhead/#2149](https://github.com/DevExpress/testcafe-hammerhead/issues/2149))
790* Pages that iterate through large element collections before `DOMContentLoaded` no longer hang ([testcafe-hammerhead/#2198](https://github.com/DevExpress/testcafe-hammerhead/issues/2198))
791* Hammerhead no longer throws a JavaScript error when it proxies pages with the YouTube player ([testcafe-hammerhead/#2220](https://github.com/DevExpress/testcafe-hammerhead/issues/2220))
792* Fixed a wrong code instrumentation ([testcafe-hammerhead/#2212](https://github.com/DevExpress/testcafe-hammerhead/issues/2212))
793
794## v1.8.1 (2020-1-23)
795
796### Bug Fixes
797
798* TestCafe now starts correctly when unsupported browsers are installed in the system ([#4661](https://github.com/DevExpress/testcafe/issues/4661))
799* `t.getBrowserConsoleMessages` now returns a list of recorded console messages instead of `undefined` ([#4662](https://github.com/DevExpress/testcafe/issues/4662))
800
801## v1.8.0 (2020-1-17)
802
803### :star2: Support for the New Microsoft Edge
804
805TestCafe v1.8.0 supports the new Microsoft Edge based on Chromium. The new Edge is available under the same [alias](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/browser-support.html#locally-installed-browsers): `edge`.
806
807```sh
808testcafe edge test.js
809```
810
811```js
812await runner
813 .src('test.js')
814 .browsers('edge')
815 .run();
816```
817
818Supported Edge's features include [headless mode](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/testing-in-headless-mode.html), [mobile device emulation](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/using-chrome-device-emulation.html), and [video recording](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#record-videos).
819
820### Bug Fixes
821
822* Fixed an error thrown when the webpage creates a `Proxy` ([testcafe-hammerhead/#2206](https://github.com/DevExpress/testcafe-hammerhead/issues/2206)) by [@link89](https://github.com/link89)
823* Event handlers are no longer cleared after the `document.open` function call ([testcafe-hammerhead/#1881](https://github.com/DevExpress/testcafe-hammerhead/issues/1881))
824
825## v1.7.1 (2019-12-19)
826
827### Bug Fixes
828
829* Status bar has been redesigned to fit the debug panel into small screens and emulated mobile devices ([#2510](https://github.com/DevExpress/testcafe/issues/2510))
830* Added timestamp to requests logged with `RequestLogger` ([#3738](https://github.com/DevExpress/testcafe/issues/3738))
831* `t.typeText` now fires the `beforeInput` event ([#4486](https://github.com/DevExpress/testcafe/issues/4486))
832* The `t.hover` action can now be detected with the jQuery `:hover` pseudoselector ([#4493](https://github.com/DevExpress/testcafe/issues/4493))
833* `Object.assign` now merges `Symbol` properties on tested pages correctly ([testcafe-hammerhead/#2189](https://github.com/DevExpress/testcafe-hammerhead/issues/2189))
834
835## v1.7.0 (2019-11-21)
836
837### Enhancements
838
839#### :gear: Identify the Browser and Platform in Test Code ([#481](https://github.com/DevExpress/testcafe/issues/481))
840
841TestCafe now allows you to obtain information about the current user agent. These data identify the operating system, platform type, browser, engine, etc.
842
843Use the [t.browser](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html) property to access user agent data.
844
845```js
846import { Selector } from 'testcafe';
847
848fixture `My fixture`
849 .page `https://example.com`;
850
851test('My test', async t => {
852 if (t.browser.name !== 'Chrome')
853 await t.expect(Selector('div').withText('Browser not supported').visible).ok();
854});
855```
856
857The [t.browser](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html) object exposes the following properties:
858
859Property | Type | Description | Example
860-------- | ---- | ------------- | -------
861[alias](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#alias) | String | The browser alias string specified when tests were launched. | `firefox:headless`
862[name](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#name) | String | The browser name. | `Chrome`
863[version](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#version) | String | The browser version. | `77.0.3865.120`
864[platform](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#platform) | String | The platform type. | `desktop`
865[headless](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#headless) | Boolean | `true` if the browser runs in headless mode. | `false`
866[os](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#os) | Object | The name and version of the operating system. | `{ name: 'macOS', version: '10.15.1' }`
867[engine](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#engine) | Object | The name and version of the browser engine. | `{ name: 'Gecko', version: '20100101' }`
868[userAgent](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#useragent) | String | The user agent string. | `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3865.120 Safari/537.36`
869[prettyUserAgent](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#prettyuseragent) | String | Formatted string with the browser's and operating system's name and version. | `Chrome 77.0.3865.75 / macOS 10.14.0`
870
871The following example shows how to create a [beforeEach](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#test-hooks) hook that runs for specific [browser engines](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#engine).
872
873```js
874import { Selector } from 'testcafe';
875
876fixture `My fixture`
877 .page `https://example.com`
878 .beforeEach(async t => {
879 if (t.browser.engine.name === 'Blink')
880 return;
881 // ...
882 });
883```
884
885You can also use [t.browser](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html) to generate the screenshot path based on the [browser name](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html#name). This prevents screenshots taken with [t.takeElementScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-a-page-element) in different browsers from being overwritten.
886
887```js
888import { Selector } from 'testcafe';
889
890fixture `My fixture`
891 .page `https://example.com`;
892
893test('My test', async t => {
894 const loginButton = Selector('div').withText('Login');
895
896 await t.takeElementScreenshot(loginButton, `auth/${t.browser.name}/login-button.png`);
897});
898```
899
900For more information and examples, see [Identify the Browser and Platform](https://devexpress.github.io/testcafe/documentation/test-api/identify-the-browser-and-platform.html).
901
902### Bug Fixes
903
904* Fixed an error on pages that submit forms immediately after loading ([#4360](https://github.com/DevExpress/testcafe/issues/4360) by [@bill-looby-i](https://github.com/bill-looby-i))
905* TestCafe now scrolls to elements located inside Shadow DOM roots ([#4222](https://github.com/DevExpress/testcafe/issues/4222))
906* Fixed an error that occurred when TypeScripts tests that use Node.js globals were run with TestCafe installed globally ([#4437](https://github.com/DevExpress/testcafe/issues/4437))
907* Fixed the TypeScript definition for the `Selector.withAttribute` method's return type ([#4448](https://github.com/DevExpress/testcafe/issues/4448))
908* Fixed an issue when custom browser providers could not take screenshots ([#4477](https://github.com/DevExpress/testcafe/issues/4477))
909* Support pages that use advanced ES6 module export ([testcafe-hammerhead/#2137](https://github.com/DevExpress/testcafe-hammerhead/issues/2137))
910* Fixed compatibility issues with Salesforce Lightning Web Components ([testcafe-hammerhead/#2152](https://github.com/DevExpress/testcafe-hammerhead/issues/2152))
911
912## v1.6.1 (2019-10-29)
913
914### Bug Fixes
915
916* Fixed a conflict with Jest type definitions that caused a TypeScript error ([#4405](https://github.com/DevExpress/testcafe/issues/4405))
917* TestCafe no longer deletes screenshots with no page content detected ([#3552](https://github.com/DevExpress/testcafe/issues/3552))
918* Fixed a bug when TestCafe did not use the default path to the test files ([#4331](https://github.com/DevExpress/testcafe/issues/4331))
919* Fixed a bug when the FFmpeg library could not be detected in the `PATH` locations ([PR #4377](https://github.com/DevExpress/testcafe/pull/4377))
920* Added a TypeScript definition for `runner.tsConfigPath` ([PR #4403](https://github.com/DevExpress/testcafe/pull/4403))
921
922## v1.6.0 (2019-10-16)
923
924### :star2: Support for macOS 10.15 Catalina
925
926This version provides compatibility with macOS 10.15. Update TestCafe to v1.6.0 if you run macOS Catalina.
927
928### Enhancements
929
930#### :gear: Full-Page Screenshots ([#1520](https://github.com/DevExpress/testcafe/issues/1520))
931
932TestCafe can now take screenshots that show the full page, including content that is not visible due to overflow.
933
934Enable the `fullPage` option in CLI, API or configuration file to capture the full page on all screenshots. You can also pass this option to `t.takeScreenshot` to capture a single full-page screenshot.
935
936*Command line interface*
937
938Enable the [fullPage](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#fullpage) parameter of the [-s (--screenshots)](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-s---screenshots-optionvalueoption2value2) flag:
939
940```sh
941testcafe chrome test.js -s fullPage=true
942```
943
944*API*
945
946Pass the `fullPage` option to [runner.screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#screenshots):
947
948```js
949runner.screenshots({
950 fullPage: true
951});
952```
953
954*Configuration file*
955
956Set the [screenshots.fullPage](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#screenshotsfullpage) property:
957
958```json
959{
960 "screenshots": {
961 "fullPage": true
962 }
963}
964```
965
966*Test code*
967
968Pass the `fullPage` option to the [t.takeScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-the-entire-page) action:
969
970```js
971t.takeScreenshot({
972 fullPage: true
973});
974```
975
976#### :gear: Compound Screenshot Options
977
978The command line interface and configuration file schema have been updated to provide a more concise way to specify the screenshot options.
979
980> TestCafe v1.6.0 also supports the existing options to maintain backward compatibility. However, these options are now marked *obsolete* in the documentation. In the future updates, we will deprecate them and emit warnings.
981
982*Command line interface*
983
984Screenshot options in CLI are now consolidated under the [-s (--screenshots)](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-s---screenshots-optionvalueoption2value2) flag in an `option=value` string:
985
986```sh
987testcafe chrome test.js -s takeOnFails=true,pathPattern=${DATE}_${TIME}/${FILE_INDEX}.png
988```
989
990Old Usage | New Usage
991---------------------------------------------- | -----------
992`-s artifacts/screenshots` | `-s path=artifacts/screenshots`
993`-S`, `--screenshots-on-fails` | `-s takeOnFails=true`
994`-p ${DATE}_${TIME}/${FILE_INDEX}.png` | `-s pathPattern=${DATE}_${TIME}/${FILE_INDEX}.png`
995
996*Configuration file*
997
998Configuration file properties that specify screenshot options are now combined in the [screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#screenshots) object:
999
1000```json
1001{
1002 "screenshots": {
1003 "path": "artifacts/screenshots",
1004 "takeOnFails": true,
1005 "pathPattern": "${DATE}_${TIME}/${FILE_INDEX}.png"
1006 }
1007}
1008```
1009
1010Old Property | New Property
1011------------------------ | ----------------------------
1012`screenshotPath` | `screenshots.path`
1013`takeScreenshotsOnFails` | `screenshots.takeOnFails`
1014`screenshotPathPattern` | `screenshots.pathPattern`
1015
1016#### :gear: Default Screenshot Directory
1017
1018TestCafe now saves the screenshots to `./screenshots` if the base directory is not specified.
1019
1020The [--screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-s---screenshots-optionvalueoption2value2) CLI flag, the [runner.screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#screenshots) method or the [screenshotPath](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#screenshotpath) configuration option are not required to take screenshots. For instance, you can run TestCafe with no additional parameters and use the [t.takeScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-the-entire-page) action in test code:
1021
1022```sh
1023testcafe chrome test.js
1024```
1025
1026*test.js*
1027
1028```js
1029fixture `My fixture`
1030 .page `https://example.com`;
1031
1032test('Take a screenshot', async t => {
1033 await t.takeScreenshot();
1034});
1035```
1036
1037The `path` argument in [runner.screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#screenshots) is now optional.
1038
1039```js
1040runner.screenshots({
1041 takeOnFails: true
1042});
1043```
1044
1045#### :gear: New Option to Disable Screenshots
1046
1047We have added an option that allows you to disable taking screenshots. If this option is specified, TestCafe does not take screenshots when a test fails and when the [t.takeScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-the-entire-page) or [t.takeElementScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-a-page-element) action is executed.
1048
1049You can disable screenshots with a command line, API or configuration file option:
1050
1051* the [--disable-screenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--disable-screenshots) command line flag
1052
1053 ```sh
1054 testcafe chrome my-tests --disable-screenshots
1055 ```
1056
1057* the `disableScreenshots` option in the [runner.run](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run) method
1058
1059 ```js
1060 runner.run({ disableScreenshots: true });
1061 ```
1062
1063* the [disableScreenshots](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#disablescreenshots) configuration file property
1064
1065 ```json
1066 {
1067 "disableScreenshots": true
1068 }
1069 ```
1070
1071### Bug Fixes
1072
1073* Fixed an error thrown when you pass the `-b` command line flag ([#4294](https://github.com/DevExpress/testcafe/issues/4294))
1074* TestCafe no longer hangs when Firefox downloads a file ([#2741](https://github.com/DevExpress/testcafe/issues/2741))
1075* You can now start tests from TypeScript code executed with `ts-node` ([#4276](https://github.com/DevExpress/testcafe/issues/4276))
1076* Fixed TypeScript definitions for client script injection API ([PR #4272](https://github.com/DevExpress/testcafe/pull/4272))
1077* Fixed TypeScript definitions for `disablePageCaching` ([PR #4274](https://github.com/DevExpress/testcafe/pull/4274))
1078* Fixed a bug when anchor links did not navigate to their target destinations ([testcafe-hammerhead/#2080](https://github.com/DevExpress/testcafe-hammerhead/issues/2080))
1079
1080## v1.5.0 (2019-9-12)
1081
1082### Enhancements
1083
1084#### :gear: Page Caching Can be Disabled ([#3780](https://github.com/DevExpress/testcafe/issues/3780))
1085
1086TestCafe may be unable to log in to the tested website correctly if the web server uses caching for authentication pages or pages to which users are redirected after login. See the [User Roles](https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html#test-actions-fail-after-authentication) topic for details.
1087
1088If tests fail unexpectedly after authentication, disable page caching in TestCafe.
1089
1090Use the [fixture.disablePageCaching](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#disable-page-caching) and [test.disablePageCaching](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#disable-page-caching) methods to disable caching during a particular fixture or test.
1091
1092```js
1093fixture
1094 .disablePageCaching `My fixture`
1095 .page `https://example.com`;
1096```
1097
1098```js
1099test
1100 .disablePageCaching
1101 ('My test', async t => { /* ... */ });
1102```
1103
1104To disable page caching during the entire test run, use either of the following options:
1105
1106* the [--disable-page-caching](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--disable-page-caching) command line flag
1107
1108 ```sh
1109 testcafe chrome my-tests --disable-page-caching
1110 ```
1111
1112* the `disablePageCaching` option in the [runner.run](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run) method
1113
1114 ```js
1115 runner.run({ disablePageCaching: true });
1116 ```
1117
1118* the [disablePageCaching](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#disablepagecaching) configuration file property
1119
1120 ```json
1121 {
1122 "disablePageCaching": true
1123 }
1124 ```
1125
1126If tests run correctly without page caching, we recommend that you adjust the server settings to disable caching for authentication pages and pages to which the server redirects from them.
1127
1128### Bug Fixes
1129
1130* Fixed an error that occurred when a selector matched an `<svg>` element ([#3684](https://github.com/DevExpress/testcafe/issues/3684))
1131* Fixed an issue when the `reporter` configuration file option was not applied ([#4234](https://github.com/DevExpress/testcafe/issues/4234))
1132* Fixed a warning message about invalid `tsconfig.json` file ([#4154](https://github.com/DevExpress/testcafe/issues/4154))
1133* `LiveRunner.stop()` now closes the browsers ([#4107](https://github.com/DevExpress/testcafe/issues/4107))
1134* Quarantined tests now re-run correctly in live mode ([#4093](https://github.com/DevExpress/testcafe/issues/4093))
1135* Fixed a bug when client scripts were not injected in live mode when it re-executed tests ([#4183](https://github.com/DevExpress/testcafe/issues/4183))
1136* `form.elements.length` now returns the correct value for forms with file inputs ([testcafe-hammerhead/#2034](https://github.com/DevExpress/testcafe-hammerhead/issues/2034))
1137* Fixed a bug when images were not displayed in inputs with the `image` type ([testcafe-hammerhead/#2116](https://github.com/DevExpress/testcafe-hammerhead/issues/2116))
1138* Fixed an AngularJS compatibility issue that caused a `TypeError` ([testcafe-hammerhead/#2099](https://github.com/DevExpress/testcafe-hammerhead/issues/2099))
1139* TestCafe now works correctly with servers that use `JSZip` to unpack uploaded files ([testcafe-hammerhead/#2115](https://github.com/DevExpress/testcafe-hammerhead/issues/2115))
1140
1141## v1.4.3 (2019-9-2)
1142
1143* Information about TestCafe Studio is no longer displayed in the console.
1144
1145## v1.4.2 (2019-8-28)
1146
1147### Bug Fixes
1148
1149* Added support for pages that reference ES6 modules ([testcafe-hammerhead/#1725](https://github.com/DevExpress/testcafe-hammerhead/issues/1725))
1150* Events are now emulated correctly if the mouse pointer does not move during scrolling ([#3564](https://github.com/DevExpress/testcafe/issues/3564))
1151* Fixed a Capacitor.js compatibility issue ([testcafe-hammerhead/#2094](https://github.com/DevExpress/testcafe-hammerhead/issues/2094))
1152* Fixed Node.js TLS warning suppression ([testcafe-hammerhead/PR#2109](https://github.com/DevExpress/testcafe-hammerhead/pull/2109))
1153* Fixed a warning about injecting duplicated scripts ([#4116](https://github.com/DevExpress/testcafe/issues/4116))
1154* Fixed a bug when information messages were printed in `stderr` ([#3873](https://github.com/DevExpress/testcafe/issues/3873))
1155
1156## v1.4.1 (2019-8-15)
1157
1158### Bug Fixes
1159
1160* Drag now works correctly in Chrome Mobile on Android and Chrome device emulator with touch screens ([#3948](https://github.com/DevExpress/testcafe/issues/3948))
1161* Live Mode no longer fails when it restarts tests that import other modules on Node.js v12 ([#4052](https://github.com/DevExpress/testcafe/issues/4052))
1162* TestCafe now types into inputs wrapped in `label` elements correctly ([#4068](https://github.com/DevExpress/testcafe/issues/4068))
1163* `test.clientScripts` no longer override `fixture.clientScripts` ([#4122](https://github.com/DevExpress/testcafe/issues/4122))
1164
1165## v1.4.0 (2019-8-7)
1166
1167### Enhancements
1168
1169#### :gear: Inject Scripts Into Tested Pages ([#1739](https://github.com/DevExpress/testcafe/issues/1739))
1170
1171TestCafe now allows you to [inject scripts](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html) into pages visited during the tests. Use this feature to add helper functions, mock browser API or import modules.
1172
1173To add client scripts to all tests, specify them in the command line, API or configuration file. Use the following options:
1174
1175* the [--cs (--client-scripts)](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--cs-pathpath2---client-scripts-pathpath2) command line argument
1176
1177 ```sh
1178 testcafe chrome test.js --client-scripts mockDate.js,assets/react-helpers.js
1179 ```
1180
1181* the [runner.clientScripts](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#clientscripts) API method
1182
1183 ```js
1184 runner.clientScripts('mockDate.js', 'scripts/react-helpers.js');
1185 ```
1186
1187* the [clientScripts](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#clientscripts) configuration file property
1188
1189 ```json
1190 {
1191 "clientScripts": ["mockDate.js", "scripts/react-helpers.js"]
1192 }
1193 ```
1194
1195If you need to add scripts to individual fixtures or tests, use the [fixture.clientScripts](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#inject-scripts-into-tested-pages) and [test.clientScripts](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#inject-scripts-into-tested-pages) methods in test code.
1196
1197```js
1198fixture `My fixture`
1199 .page `http://example.com`
1200 .clientScripts('mockDate.js', 'scripts/react-helpers.js');
1201```
1202
1203```js
1204test
1205 ('My test', async t => { /* ... */ })
1206 .clientScripts('mockDate.js', 'scripts/react-helpers.js');
1207```
1208
1209TestCafe also allows you to [inject scripts into specific pages](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html#provide-scripts-for-specific-pages).
1210
1211```js
1212fixture `My fixture`
1213 .clientScripts({
1214 page: 'https://myapp.com/page/',
1215 path: 'scripts/vue-helpers.js'
1216 });
1217```
1218
1219This is helpful when you need to override the browser API on particular pages and use the default behavior everywhere else.
1220
1221You can specify the scripts to inject as follows:
1222
1223* pass the [path to a JavaScript file](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html#inject-a-javascript-file) to inject its content:
1224
1225 ```js
1226 fixture `My fixture`
1227 .clientScripts({ path: 'assets/jquery.js' });
1228 ```
1229
1230* use the [module name](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html#inject-a-module) to inject a module:
1231
1232 ```js
1233 fixture `My fixture`
1234 .clientScripts({ module: 'async' });
1235 ```
1236
1237 TestCafe searches for the module's entry point with Node.js mechanisms and injects its content. Note that the browser must be able to execute this module.
1238
1239* pass the [code](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html#inject-script-code) you need to inject:
1240
1241 ```js
1242 fixture `My fixture`
1243 .clientScripts({ content: 'Geolocation.prototype.getCurrentPosition = () => new Position(0, 0);' });
1244 ```
1245
1246For more information, see [Inject Scripts into Tested Pages](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/inject-scripts-into-tested-pages.html).
1247
1248### Bug Fixes
1249
1250* The browser no longer displays 404 errors after the test submits a form ([#3560](https://github.com/DevExpress/testcafe/issues/3560)
1251* TestCafe can now download files when testing in headless mode ([#3127](https://github.com/DevExpress/testcafe/issues/3127))
1252* TypeScript no longer throws an error when `fixture` or `fixture.page` uses a tag function ([#4042](https://github.com/DevExpress/testcafe/issues/4042))
1253* The `load` event now correctly fires for cached images ([testcafe-hammerhead/#1959](https://github.com/DevExpress/testcafe-hammerhead/issues/1959))
1254* TestCafe can now read resources from `asar` archives ([testcafe-hammerhead/#2033](https://github.com/DevExpress/testcafe-hammerhead/issues/2033))
1255* Fixed a bug when `testcafe-hammerhead` event listeners were called twice ([testcafe-hammerhead/#2062](https://github.com/DevExpress/testcafe-hammerhead/issues/2062))
1256
1257## v1.3.3 (2019-7-17)
1258
1259### Bug Fixes
1260
1261* TestCafe now throws an error if the specified TypeScript configuration file does not exist ([#3991](https://github.com/DevExpress/testcafe/issues/3991))
1262* TypeScript compilation time has been reduced for a large number of files ([#4010](https://github.com/DevExpress/testcafe/issues/4010))
1263* Expressions with the `+=` operator are now expanded only when required ([testcafe-hammerhead/#2029](https://github.com/DevExpress/testcafe-hammerhead/issues/2029))
1264* Parentheses around the `await` expression are now preserved in the processed scripts ([testcafe-hammerhead/#2072](https://github.com/DevExpress/testcafe-hammerhead/issues/2072))
1265* Fixed a compatibility issue with Firefox 68 that prevented text selection ([testcafe-hammerhead/#2071](https://github.com/DevExpress/testcafe-hammerhead/issues/2071))
1266
1267## v1.3.2 (2019-7-11)
1268
1269### :gear: Package dependencies have been upgraded to avoid CVEs found in the 'lodash' package
1270
1271### Bug Fixes
1272
1273* TestCafe no longer hangs when a disconnected browser reconnects to the network ([#3929](https://github.com/DevExpress/testcafe/issues/3929))
1274
1275## v1.3.1 (2019-7-5)
1276
1277This release fixes an issue caused by `tsconfig.json` auto-detection.
1278
1279### Breaking Changes
1280
1281#### :boom: TypeScript Configuration File Location is Required to Apply the Custom Compiler Settings ([#3983](https://github.com/DevExpress/testcafe/issues/3983))
1282
1283Version 1.3.0 introduced support for [custom TypeScript configuration files](https://devexpress.github.io/testcafe/documentation/test-api/typescript-support.html#customize-compiler-options) where you can provide the compiler options. This feature included automatic detection of these configuration files. If the directory from which you run tests contained a `tsconfig.json` file, TestCafe would apply it by default.
1284
1285However, this behavior caused troubles for users who have already had `tsconfig.json` files with conflicting settings in their projects. TestCafe attempted to apply these configurations, which resulted in issues with test compilation.
1286
1287In v1.3.1, we have disabled `tsconfig.json` auto-detection. Now you must explicitly specify the `tsconfig.json` file location to apply the compiler settings. You can do it in one of the following ways:
1288
1289* the [--ts-config-path](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--ts-config-path-path) command line parameter,
1290
1291 ```sh
1292 testcafe chrome my-tests --ts-config-path /Users/s.johnson/testcafe/tsconfig.json
1293 ```
1294
1295* the [runner.tsConfigPath](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#tsconfigpath) API method,
1296
1297 ```js
1298 runner.tsConfigPath('/Users/s.johnson/testcafe/tsconfig.json');
1299 ```
1300
1301* the [tsConfigPath](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#tsconfigpath) configuration file property.
1302
1303 ```json
1304 {
1305 "tsConfigPath": "/Users/s.johnson/testcafe/tsconfig.json"
1306 }
1307 ```
1308
1309We strongly recommend that you upgrade to v1.3.1. We apologize for any inconvenience.
1310
1311## v1.3.0 (2019-7-2)
1312
1313### Enhancements
1314
1315#### :gear: Customize TypeScript Compiler Options ([#1845](https://github.com/DevExpress/testcafe/issues/1845))
1316
1317> **Update:** v1.3.1 disables automatic detection of the `tsconfig.json` file. See [v1.3.1 release notes](https://devexpress.github.io/testcafe/blog/testcafe-v1-3-1-released.html) for more information.
1318
1319TestCafe now allows you to specify the [TypeScript compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html) in the `tsconfig.json` configuration file. You can use these options to enable JSX compilation, import code or typings with `paths` aliases, set aliases to React typings, or customize other compiler settings.
1320
1321Define the `compilerOptions` property in `tsconfig.json` and specify the compiler options in this property:
1322
1323```json
1324{
1325 "compilerOptions": {
1326 "jsx": "react",
1327 "jsxFactory": "myFactory",
1328 "paths": {
1329 "jquery": [ "node_modules/jquery/dist/jquery" ]
1330 },
1331 "alwaysStrict": true
1332 }
1333}
1334```
1335
1336Save this file to the directory from which you run tests (or use the [tsConfigPath](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#tsconfigpath) setting in the main configuration file to specify a different location).
1337
1338See [Customize Compiler Options](https://devexpress.github.io/testcafe/documentation/test-api/typescript-support.html#customize-compiler-options) for more information.
1339
1340### Bug Fixes
1341
1342* TestCafe now waits for asynchronous tasks in `reportTaskDone` to complete before it exits ([#3835](https://github.com/DevExpress/testcafe/issues/3835))
1343* `childNodes.length` now returns the correct result after you type in an `iframe` ([#3887](https://github.com/DevExpress/testcafe/issues/3887))
1344* TestCafe no longer hangs when a custom request hook throws an error ([#3786](https://github.com/DevExpress/testcafe/issues/3786))
1345* Error messages now show the correct selector chains for selectors that use the `with` method ([#3874](https://github.com/DevExpress/testcafe/issues/3874))
1346* TestCafe can now work with test files located on a Windows network drive ([#3918](https://github.com/DevExpress/testcafe/issues/3918))
1347* Page elements overlapped by the TestCafe status panel are now scrolled into view correctly ([#3924](https://github.com/DevExpress/testcafe/issues/3924))
1348* Labels with the `tabIndex` and `for` attributes are now focused correctly ([#3501](https://github.com/DevExpress/testcafe/issues/3501))
1349* Fixed a bug that prevented elements behind the footer from being scrolled up on some pages ([#2601](https://github.com/DevExpress/testcafe/issues/2601))
1350* Enhanced the previous fix for a Chrome 75 compatibility issue when `t.typeText` typed each character at the beginning of the input ([#3865](https://github.com/DevExpress/testcafe/issues/3865))
1351* jQuery scroll functions no longer cause errors ([testcafe-hammerhead/#2045](https://github.com/DevExpress/testcafe-hammerhead/issues/2045))
1352
1353## v1.2.1 (2019-6-10)
1354
1355### Bug Fixes
1356
1357* Fixed a Chrome 75 compatibility issue when `t.typeText` typed each character at the beginning of the input ([#3865](https://github.com/DevExpress/testcafe/issues/3865))
1358* Fixed a bug when a test with an unhandled promise rejection passed ([#3787](https://github.com/DevExpress/testcafe/issues/3787))
1359* The native dialog handler is now applied when a role redirects to the login page ([#2969](https://github.com/DevExpress/testcafe/issues/2969))
1360
1361## v1.2.0 (2019-5-28)
1362
1363### Enhancements
1364
1365#### :gear: Custom Reporters Can Now Handle Test Start ([#3715](https://github.com/DevExpress/testcafe/issues/3715)) by [@Ivan-Katovich](https://github.com/Ivan-Katovich)
1366
1367We have added an optional `reportTestStart` method to reporter API. This method fires each time a test starts. You can override it to output information about the started test:
1368
1369```js
1370async reportTestStart (name, meta) {
1371 this.write(`Starting test: ${name} (${meta.severity})`)
1372 .newline();
1373}
1374```
1375
1376This method also enables better integration with third-party reporter frameworks. For instance, [allure](https://github.com/allure-framework/allure2) requires that you perform some actions (namely, [specify the test steps](https://docs.qameta.io/allure/#_steps_6)) before a test starts. Now you can do this in the `reportTestStart` method in a custom reporter.
1377
1378See the `reportTestStart` method description in [Reporter Methods](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reportteststart).
1379
1380### Bug Fixes
1381
1382* Fixed a regression that prevented non-responsive browsers from restarting ([#3781](https://github.com/DevExpress/testcafe/issues/3781))
1383* Fixed an issue when `t.click` triggered the `click` event twice ([#3645](https://github.com/DevExpress/testcafe/issues/3645))
1384* Fixed a regression that prevented TestCafe from checking `checkbox` inputs with `t.click` ([#3482](https://github.com/DevExpress/testcafe/issues/3482))
1385* TestCafe TypeScript definitions no longer cause the `Cannot find namespace 'NodeJS'` error ([#3719](https://github.com/DevExpress/testcafe/issues/3719))
1386* TestCafe no longer removes the `Authorization` header when Fetch API is used ([testcafe-hammerhead/#2020](https://github.com/DevExpress/testcafe-hammerhead/issues/2020))
1387* TestCafe now provides correct values for the `form.elements.length` property ([testcafe-hammerhead/#2009](https://github.com/DevExpress/testcafe-hammerhead/issues/2009))
1388* Fixed the `Invariant Violation` React error caused by TestCafe Hammerhead ([testcafe-hammerhead/#2000](https://github.com/DevExpress/testcafe-hammerhead/issues/2000))
1389* Fixed a regression that disabled the `IE=edge` meta tag ([testcafe-hammerhead/#1963](https://github.com/DevExpress/testcafe-hammerhead/issues/1963))
1390* Fixed an issue that prevented `t.setFilesToUpload` from raising the `change` event on some file inputs ([testcafe-hammerhead/#2007](https://github.com/DevExpress/testcafe-hammerhead/issues/2007))
1391
1392## v1.1.4 (2019-5-6)
1393
1394### Bug Fixes
1395
1396* Roles now work when navigation to the login URL does not trigger page reload ([#2195](https://github.com/DevExpress/testcafe/issues/2195))
1397* TestCafe no longer emits the `touchmove` events when it simulates clicks on Android devices ([#3465](https://github.com/DevExpress/testcafe/issues/3465))
1398* `t.takeElementScreenshot` now works if the display has custom color correction ([#2918](https://github.com/DevExpress/testcafe/issues/2918))
1399* Fixed a regression that prevented `t.typeText` from working within iframes in IE 11 ([#3724](https://github.com/DevExpress/testcafe/issues/3724))
1400* TestCafe now displays the correct error message when a browser is disconnected ([#3711](https://github.com/DevExpress/testcafe/issues/3711))
1401* URLs that contain authentication credentials are now processed correctly ([testcafe-hammerhead/#1990](https://github.com/DevExpress/testcafe-hammerhead/issues/1990))
1402* TestCafe no longer breaks `async` functions inside constructors ([testcafe-hammerhead/#2002](https://github.com/DevExpress/testcafe-hammerhead/issues/2002))
1403
1404## v1.1.3 (2019-4-18)
1405
1406### Bug Fixes
1407
1408* TestCafe now shows a warning when the `t.resizeWindow` action is used during video recording ([#3513](https://github.com/DevExpress/testcafe/issues/3513))
1409* Debugging in the Docker image can now be enabled with the `--inspect` and `--inspect-brk` flags ([#3646](https://github.com/DevExpress/testcafe/issues/3646))
1410* You can now use the `--window-width` flag to set the emulated window width for headless Chrome ([#3456](https://github.com/DevExpress/testcafe/issues/3456))
1411* TestCafe now shows the correct error message when an iframe is not visible ([#3681](https://github.com/DevExpress/testcafe/issues/3681))
1412* The Unlock Page button no longer throws an error when clicked ([#3652](https://github.com/DevExpress/testcafe/issues/3652))
1413* The `change` event for a file input is no longer emulated unless the `t.setFilesToUpload` method changes the input value ([testcafe-hammerhead/#1844](https://github.com/DevExpress/testcafe-hammerhead/issues/1844))
1414* The upload native dialog is no longer shown in Firefox after a click is simulated ([testcafe-hammerhead/#1984](https://github.com/DevExpress/testcafe-hammerhead/issues/1984))
1415* The `style` attribute and the `HTMLElement.style` property values are now synchronized ([testcafe-hammerhead/#1922](https://github.com/DevExpress/testcafe-hammerhead/issues/1922))
1416
1417## v1.1.2 (2019-4-10)
1418
1419### Bug Fixes
1420
1421* TestCafe now captures full-size screenshots on macOS systems with a Retina display ([#3541](https://github.com/DevExpress/testcafe/issues/3541))
1422* The `referrer` property is now encoded correctly ([testcafe-hammerhead/#1953](https://github.com/DevExpress/testcafe-hammerhead/issues/1953))
1423
1424## v1.1.1 (2019-4-4)
1425
1426### Bug Fixes
1427
1428* TestCafe no longer crashes if the tested page contains many cross-domain iframes ([testcafe-hammerhead/#1885](https://github.com/DevExpress/testcafe-hammerhead/issues/1885))
1429* TestCafe now displays a more concise message when it cannot find and run Chrome or Firefox ([#3534](https://github.com/DevExpress/testcafe/issues/3534))
1430* TestCafe no longer creates temporary video files in the concurrency mode ([#3508](https://github.com/DevExpress/testcafe/issues/3508))
1431* The `--no-sandbox` and `--disable-dev-shm-usage` flags are now applied automatically when TestCafe runs in a Docker container ([#3531](https://github.com/DevExpress/testcafe/issues/3531))
1432* In live mode, TestCafe now hides the spinner when it displays a message or if test compilation has failed ([#3451](https://github.com/DevExpress/testcafe/issues/3451) and ([#3452](https://github.com/DevExpress/testcafe/issues/3452)))
1433* TypeScript definitions for `t.expect().contains` have been fixed to support different types ([#3537](https://github.com/DevExpress/testcafe/issues/3537))
1434* The `keyPress` event simulation now works properly on Android ([#2236](https://github.com/DevExpress/testcafe/issues/2236))
1435* Salesforce Lightning Experience components are now rendered correctly ([testcafe-hammerhead/#1874](https://github.com/DevExpress/testcafe-hammerhead/issues/1874))
1436
1437## v1.1.0 (2019-2-28)
1438
1439### Enhancements
1440
1441#### :gear: TypeScript 3 Support ([#3401](https://github.com/DevExpress/testcafe/issues/3401))
1442
1443TypeScript test files can now use the new syntax features introduced in [TypeScript 3.0](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html) and [TypeScript 3.3](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-3.html).
1444
1445#### :gear: Enhanced TypeScript Definitions for Client Functions ([#3431](https://github.com/DevExpress/testcafe/pull/3431)) by [@vitalics](https://github.com/vitalics)
1446
1447The updated type definitions allow the TypeScript compiler to determine client function's return value type. Static typing now warns you when you call wrong methods for the return value.
1448
1449```js
1450const getFoo = ClientFunction(() => 42);
1451const foo = await getFoo();
1452foo.match(/foo/);
1453```
1454
1455Before v1.1.0, an error occurred during test execution:
1456
1457```text
1458$ testcafe chrome tests.ts
1459 Running tests in:
1460 - Chrome 72.0.3626 / Windows 10.0.0
1461 Fixture 1
1462 √ Test 1
1463 √ Test 2
1464 ...
1465 × Test N
1466 1) TypeError: foo.match is not a function
1467```
1468
1469With v1.1.0, the TypeScript compiler throws an error before tests are started:
1470
1471```text
1472$ testcafe chrome tests.ts
1473 ERROR Cannot prepare tests due to an error.
1474 Error: TypeScript compilation failed.
1475
1476 tests.ts (4, 2): Property 'match' does not exist on type 'number'.
1477```
1478
1479### Bug Fixes
1480
1481* TestCafe no longer ignores test and fixture metadata filters specified in the configuration file ([#3443](https://github.com/DevExpress/testcafe/issues/3443)) by [@NanjoW](https://github.com/NanjoW)
1482* TestCafe no longer resolves placeholders to `null` in video path patterns ([#3455](https://github.com/DevExpress/testcafe/issues/3455))
1483* Fixed the `KeyboardEvent`'s `key` property emulation for Safari ([#3282](https://github.com/DevExpress/testcafe/issues/3282))
1484* TestCafe now correctly captures element screenshots after the page was scrolled ([#3292](https://github.com/DevExpress/testcafe/issues/3292))
1485* Reduced TypeScript compilation time for a large number of files ([#3475](https://github.com/DevExpress/testcafe/issues/3475))
1486* Reach Router can now navigate correctly on tested pages ([testcafe-hammerhead/#1863](https://github.com/DevExpress/testcafe-hammerhead/issues/1863))
1487* TestCafe now correctly handles websites that use the `WebKitMutationObserver` class ([testcafe-hammerhead/#1912](https://github.com/DevExpress/testcafe-hammerhead/issues/1912))
1488* TestCafe now processes ECMAScript modules in `<script>` tags ([testcafe-hammerhead/#1725](https://github.com/DevExpress/testcafe-hammerhead/issues/1725))
1489
1490## v1.0.1 (2019-2-15)
1491
1492### :gear: Package dependencies have been upgraded to avoid CVEs found in the 'lodash' package
1493
1494### Bug Fixes
1495
1496* TestCafe no longer hangs when CLI argument validation fails in live mode ([#3402](https://github.com/DevExpress/testcafe/issues/3402))
1497* TestCafe no longer fails with the `ERR_STREAM_WRITE_AFTER_END` error after restarting tests in live mode ([#3322](https://github.com/DevExpress/testcafe/issues/3322))
1498* TestCafe does not ignore video and encoding options specified in a configuration file ([#3415](https://github.com/DevExpress/testcafe/issues/3415))
1499* You can now specify only tests in TestCafe CLI if browsers are specified in a configuration file ([#3421](https://github.com/DevExpress/testcafe/issues/3421))
1500* Live mode: TestCafe no longer stops test execution in multiple browsers if tests do not contain actions ([#3410](https://github.com/DevExpress/testcafe/issues/3410))
1501* TestCafe now correctly handles the `data-parsley-multiple` attribute ([testcafe-hammerhead/#1845](https://github.com/DevExpress/testcafe-hammerhead/issues/1845))
1502* TestCafe now allows passing the `headers` option of the `fetch` function as an Array ([testcafe-hammerhead/#1898](https://github.com/DevExpress/testcafe-hammerhead/issues/1898))
1503* No error occurs when page scripts pass a number as an argument to the `window.open` function ([testcafe-hammerhead/#1908](https://github.com/DevExpress/testcafe-hammerhead/issues/1908))
1504* TestCafe now correctly processes rewritten stylesheets ([testcafe-hammerhead/#1919](https://github.com/DevExpress/testcafe-hammerhead/pull/1919))
1505* TestCafe now correctly processes source maps in stylesheets ([testcafe-hammerhead/#1907](https://github.com/DevExpress/testcafe-hammerhead/issues/1907))
1506
1507## v1.0.0 (2019-2-7)
1508
1509### Breaking Changes
1510
1511#### :boom: Test Syntax Validation Disabled: All Input Files Are Executed
1512
1513Previous versions performed *test syntax validation* within input script files before executing them. Only files that contained the [fixture](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#fixtures) and [test](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#tests) directives were executed.
1514
1515Starting with v1.0.0, input script files are **never** validated. This means that TestCafe executes all the scripts you specify as test sources. If you use Glob patterns to specify input test files, please recheck these patterns to avoid unintended file matches.
1516
1517The `--disable-test-syntax-validation` command line flag and the `disableTestSyntaxValidation` option for the [runner.run](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run) API method that disabled test syntax validation were removed in v1.0.0.
1518
1519##### What Has Improved
1520
1521You can now load tests dynamically without additional customization. The following example illustrates how tests can be imported from an external library.
1522
1523**external-lib.js**
1524
1525```js
1526export default function runFixture(name, url) {
1527 fixture(name)
1528 .page(url);
1529
1530 test(`${url} test`, async t => {
1531 // ...
1532 });
1533}
1534```
1535
1536**test.js**
1537
1538```js
1539import runFixture from './external-lib';
1540
1541const fixtureName = 'My fixture';
1542const url = 'https://testPage';
1543
1544runFixture(fixtureName, url);
1545```
1546
1547#### :boom: Programming Interface: Multiple Method Calls Prohibited
1548
1549Previous versions allowed you to call the [runner.src](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#src), [runner.browsers](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#browsers) and [runner.reporter](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#reporter) methods several times to specify multiple test files, browsers or reporters.
1550
1551```js
1552const stream = fs.createWriteStream('report.json');
1553
1554runner
1555 .src('/home/user/tests/fixture1.js')
1556 .src('fixture5.js')
1557 .browsers('chrome')
1558 .browsers('firefox:headless')
1559 .reporter('minimal')
1560 .reporter('json', stream);
1561```
1562
1563Starting with v1.0.0, pass arrays to these methods to specify multiple values.
1564
1565To use a reporter that writes to a file, add a `{ name, output }` object to an array (see the [runner.reporter](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#reporter) description for details).
1566
1567```js
1568runner
1569 .src(['/home/user/tests/fixture1.js', 'fixture5.js'])
1570 .browsers(['chrome', 'firefox:headless'])
1571 .reporter(['minimal', { name: 'json', output: 'report.json' }]);
1572```
1573
1574##### What Has Improved
1575
1576This change was necessary to implement the [configuration file](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html) in a way that is consistent with the API and command line interface.
1577
1578#### :boom: Custom Request Hooks: Asynchronous API
1579
1580[Request hook](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/) methods became asynchronous in TestCafe v1.0.0.
1581
1582If the [onRequest](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/creating-a-custom-http-request-hook.html#the-onrequest-method) or [onResponse](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/creating-a-custom-http-request-hook.html#the-onresponse-method) method in your custom hook returns a Promise, TestCafe now waits for this Promise to resolve.
1583
1584This does not necessarily leads to unexpected behavior, but still be aware of possible side effects.
1585
1586Since the [onRequest](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/creating-a-custom-http-request-hook.html#the-onrequest-method) and [onResponse](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/creating-a-custom-http-request-hook.html#the-onresponse-method) methods are now asynchronous, add the `async` keyword to their declarations.
1587
1588```js
1589import { RequestHook } from 'testcafe';
1590
1591class MyRequestHook extends RequestHook {
1592 constructor (requestFilterRules, responseEventConfigureOpts) {
1593 super(requestFilterRules, responseEventConfigureOpts);
1594 // ...
1595 }
1596
1597 async onRequest (event) {
1598 // ...
1599 }
1600
1601 async onResponse (event) {
1602 // ...
1603 }
1604}
1605```
1606
1607##### What Has Improved
1608
1609You can call asynchronous [fs](https://nodejs.org/api/fs.html) functions, invoke a [child_process](https://nodejs.org/api/child_process.html), or perform asynchronous network requests (to a database or any other server) from inside the hooks.
1610
1611#### :boom: Custom Reporter Plugins: Asynchronous API
1612
1613TestCafe v1.0.0 also introduces asynchronous API for [reporter plugins](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/).
1614
1615Similarly to [request hooks](#-boom-custom-request-hooks-asynchronous-api), if any of the custom reporter's methods ([reportTaskStart](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttaskstart), [reportFixtureStart](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reportfixturestart), [reportTestDone](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttestdone) or [reportTaskDone](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttaskdone)) returns a Promise, this Promise is now awaited.
1616
1617Side effects may show up in certain cases.
1618
1619Since the reporter methods are now asynchronous, add the `async` keyword to their declarations.
1620
1621```js
1622async reportTaskStart (startTime, userAgents, testCount) {
1623 // ...
1624},
1625
1626async reportFixtureStart (name, path, meta) {
1627 // ...
1628},
1629
1630async reportTestDone (name, testRunInfo, meta) {
1631 // ...
1632},
1633
1634async reportTaskDone (endTime, passed, warnings, result) {
1635 // ...
1636}
1637```
1638
1639##### What Has Improved
1640
1641Reporters can call asynchronous [fs](https://nodejs.org/api/fs.html) functions, invoke a [child_process](https://nodejs.org/api/child_process.html), or perform asynchronous network requests (to send an email, use REST API, connect to a database, etc).
1642
1643### Enhancements
1644
1645#### :gear: Video Recording ([#2151](https://github.com/DevExpress/testcafe/issues/2151))
1646
1647You can now [record videos of test runs](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#record-videos) in Google Chrome and Mozilla Firefox. To enable video recording, [install the FFmpeg library](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#prerequisites) and then do one of the following:
1648
1649* specify the [--video](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--video-basepath) command line flag,
1650
1651 ```sh
1652 testcafe chrome test.js --video artifacts/videos/
1653 ```
1654
1655* call the [runner.video](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#video) API method,
1656
1657 ```js
1658 runner.video('artifacts/videos/');
1659 ```
1660
1661* specify the [videoPath](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html#videopath) configuration file property (configuration file is also a new feature, see below).
1662
1663 ```json
1664 {
1665 "videoPath": "artifacts/videos/"
1666 }
1667 ```
1668
1669TestCafe records all tests and saves each recording in a separate file. You can change this behavior in [video options](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#basic-video-options). You can also customize [video encoding parameters](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#video-encoding-options).
1670
1671#### :gear: Configuration File ([#3131](https://github.com/DevExpress/testcafe/issues/3131))
1672
1673TestCafe now allows you to store its settings in the `.testcaferc.json` [configuration file](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html) (with support for [JSON5 syntax](https://json5.org/)).
1674
1675```json5
1676{
1677 "browsers": "chrome",
1678 "src": ["/home/user/auth-tests/fixture-1.js", "/home/user/mobile-tests/"],
1679 "reporter": {
1680 "name": "xunit",
1681 "output": "reports/report.xml"
1682 },
1683 "screenshotPath": "/home/user/tests/screenshots/",
1684 "takeScreenshotsOnFails": true,
1685 "videoPath": "/home/user/tests/videos/",
1686 "pageLoadTimeout": 1000,
1687 "hostname": "host.mycorp.com"
1688 // and more
1689}
1690```
1691
1692Keep the configuration file in the project's root directory from which you run TestCafe.
1693
1694Settings you specify when you launch tests from the command line and programming interfaces override settings from `.testcaferc.json`.
1695
1696See [Configuration File](https://devexpress.github.io/testcafe/documentation/using-testcafe/configuration-file.html) for more information.
1697
1698#### :gear: Live Mode ([#3215](https://github.com/DevExpress/testcafe/issues/3215))
1699
1700We have integrated the [testcafe-live](https://github.com/DevExpress/testcafe-live) module into our main code so you can now use the new [live mode](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/live-mode.html).
1701
1702Live mode keeps the TestCafe process and browsers opened the whole time you are working on tests. Changes you make in code immediately restart the tests. That is, live mode allows you to see test results instantly. See [How Live Mode Works](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/live-mode.html#how-live-mode-works).
1703
1704Use the [-L (--live)](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-l---live) flag to enable live mode from the command line interface.
1705
1706```sh
1707testcafe chrome tests/test.js -L
1708```
1709
1710In the API, create a [live mode runner](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/livemoderunner.html) with the [testcafe.createLiveModeRunner](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/testcafe.html#createlivemoderunner) function and use it instead of a [regular test runner](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html).
1711
1712```js
1713const createTestCafe = require('testcafe');
1714let testcafe = null;
1715
1716createTestCafe('localhost', 1337, 1338)
1717 .then(tc => {
1718 testcafe = tc;
1719 const liveRunner = testcafe.createLiveModeRunner();
1720 return liveRunner
1721 .src('tests/test.js')
1722 .browsers('chrome')
1723 .run();
1724 })
1725 .then(() => {
1726 return testcafe.close();
1727 });
1728```
1729
1730#### :gear: Custom Reporter API Enhancements (Part of [#2753](https://github.com/DevExpress/testcafe/issues/2753); [Pull Request](https://github.com/DevExpress/testcafe/pull/3177))
1731
1732* You can now access warnings that appeared during the test run from the [reportTestDone](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttestdone) method. Use the `warnings` property of the [testRunInfo](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#testruninfo-object) object.
1733
1734 ```js
1735 async reportTestDone (name, testRunInfo, meta) {
1736 const warnings = testRunInfo.warnings;
1737 const hasWarnings = !!warnings.length;
1738
1739 if(hasWarnings) {
1740 this.newline()
1741 .write('Warnings:');
1742
1743 warnings.forEach(warning => {
1744 this.newline()
1745 .write(warning);
1746 });
1747 }
1748 }
1749 ```
1750
1751* The [reportTaskDone](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttaskdone) method now receives the [result](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#result-object) parameter that contains information about the number of passed, failed, and skipped tests.
1752
1753 ```js
1754 async reportTaskDone (endTime, passed, warnings, result) {
1755 this.write(`Testing finished!`)
1756 .newline()
1757 .write(`Passed: ${result.passedCount}`)
1758 .newline()
1759 .write(`Failed: ${result.failedCount}`)
1760 .newline();
1761 .write(`Skipped: ${result.skippedCount}`)
1762 .newline();
1763 }
1764 ```
1765
1766#### :gear: Typings for Programming Interface ([#3341](https://github.com/DevExpress/testcafe/issues/3341)) by [@infctr](https://github.com/infctr)
1767
1768TestCafe [programming interface](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/) now features TypeScript typings.
1769
1770![API Typings](docs/articles/images/api-typings.png)
1771
1772#### :gear: Programming Interface: Simpler API to Write Reports to a File
1773
1774You no longer need to use `fs.createWriteStream` to create a stream that writes a report to a file. You can now pass the file name as the [runner.reporter](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#reporter) parameter.
1775
1776```js
1777runner.reporter('json', 'reports/report.json');
1778```
1779
1780### Bug Fixes
1781
1782* The test runner no longer hangs when a custom reporter implementation uses synchronous callbacks ([#3209](https://github.com/DevExpress/testcafe/issues/3209))
1783* Fixture hooks for two adjacent fixtures are now executed in the correct order ([#3298](https://github.com/DevExpress/testcafe/issues/3298))
1784* Iframes no longer throw an error after a `document.open` call in IE and Edge ([#3343](https://github.com/DevExpress/testcafe/issues/3343))
1785* TestCafe no longer triggers a click event when you disable a button with a `span` element inside ([#2902](https://github.com/DevExpress/testcafe/issues/2902))
1786* Fixed a bug that led to errors in certain cases ([#3189](https://github.com/DevExpress/testcafe/issues/3189))
1787* We have improved the status panel design and adaptivity ([#3073](https://github.com/DevExpress/testcafe/issues/3073))
1788* Redirects through several pages in iframes now work correctly ([testcafe-hammerhead/#1825](https://github.com/DevExpress/testcafe-hammerhead/issues/1825))
1789* TestCafe can now correctly work with pages that override `HTMLElement.classList` in IE11 ([testcafe-hammerhead/#1890](https://github.com/DevExpress/testcafe-hammerhead/issues/1890))
1790
1791## v0.23.3 (2018-12-19)
1792
1793### Bug Fixes
1794
1795* Remote browsers now start after tests are compiled ([#3219](https://github.com/DevExpress/testcafe/issues/3219)) by [@link89](https://github.com/link89)
1796* The TestCafe Docker image now includes version tags ([#2315](https://github.com/DevExpress/testcafe/issues/2315))
1797* Tests now fail with a meaningful error if no fixture is defined ([#2913](https://github.com/DevExpress/testcafe/issues/2913))
1798* Tests now resume correctly after a long waiting ([#3070](https://github.com/DevExpress/testcafe/issues/3070))
1799* TestCafe now throws a meaningful exception when taking screenshots in a browser that does not support it ([#2878](https://github.com/DevExpress/testcafe/issues/2878))
1800* Events are now simulated in the correct order when focusing an element after another element was focused on the `changed` event ([#3098](https://github.com/DevExpress/testcafe/issues/3098))
1801* The `Invalid calling object` exception is no longer thrown in IE11 ([testcafe-hammerhead/#1846](https://github.com/DevExpress/testcafe-hammerhead/issues/1846))
1802* The JSON parse error is no longer thrown when sending an XHR request ([testcafe-hammerhead/#1839](https://github.com/DevExpress/testcafe-hammerhead/issues/1839))
1803* Overridden functions now have the right prototype in an `iframe` without `src` ([testcafe-hammerhead/#1824](https://github.com/DevExpress/testcafe-hammerhead/issues/1824))
1804* `gulp-testcafe` now correctly closes Chrome after tests are finished ([testcafe-hammerhead/#1826](https://github.com/DevExpress/testcafe-hammerhead/issues/1826))
1805* Saving the `window` prototype to a property now works correctly ([testcafe-hammerhead/#1828](https://github.com/DevExpress/testcafe-hammerhead/issues/1828))
1806* Hammerhead is now retained after `document.close` in Firefox ([testcafe-hammerhead/#1821](https://github.com/DevExpress/testcafe-hammerhead/issues/1821))
1807
1808## v0.23.2 (2018-11-12)
1809
1810### Bug Fixes
1811
1812* TestCafe no longer posts internal messages to the browser console ([#3099](https://github.com/DevExpress/testcafe/issues/3099))
1813* The TestCafe process no longer terminates before the report is written to a file ([#2502](https://github.com/DevExpress/testcafe/issues/2502))
1814
1815## v0.23.1 (2018-11-7)
1816
1817### Enhancements
1818
1819#### :gear: Select Tests and Fixtures to Run by Their Metadata ([#2527](https://github.com/DevExpress/testcafe/issues/2527)) by [@NickCis](https://github.com/NickCis)
1820
1821You can now run only those tests or fixtures whose [metadata](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#specifying-testing-metadata) contains a specific set of values. Use the [--test-meta](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--test-meta-keyvaluekey2value2) and [--fixture-meta](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--fixture-meta-keyvaluekey2value2) flags to specify these values.
1822
1823```sh
1824testcafe chrome my-tests --test-meta device=mobile,env=production
1825```
1826
1827```sh
1828testcafe chrome my-tests --fixture-meta subsystem=payments,type=regression
1829```
1830
1831In the API, test and fixture metadata is now passed to the [runner.filter](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#filter) method in the `testMeta` and `fixtureMeta` parameters. Use this metadata to build a logic that determines whether to run the current test.
1832
1833```js
1834runner.filter((testName, fixtureName, fixturePath, testMeta, fixtureMeta) => {
1835 return testMeta.mobile === 'true' &&
1836 fixtureMeta.env === 'staging';
1837});
1838```
1839
1840#### :gear: Run Dynamically Loaded Tests ([#2074](https://github.com/DevExpress/testcafe/issues/2074))
1841
1842You can now run tests imported from external libraries or generated dynamically even if the `.js` file does not contain any tests.
1843
1844Previously, test files had to contain the [fixture](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#fixtures) and [test](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#tests) directives. You can now add the `--disable-test-syntax-validation` command line flag to bypass this check.
1845
1846```sh
1847testcafe safari test.js --disable-test-syntax-validation
1848```
1849
1850In the API, use the `disableTestSyntaxValidation` option.
1851
1852```js
1853runner.run({ disableTestSyntaxValidation: true })
1854```
1855
1856### Bug Fixes
1857
1858* Touch events are now simulated with correct touch properties (`touches`, `targetTouches`, `changedTouches`) ([#2856](https://github.com/DevExpress/testcafe/issues/2856))
1859* Google Chrome now closes correctly on macOS after tests are finished ([#2860](https://github.com/DevExpress/testcafe/issues/2860))
1860* Internal attribute and node changes no longer trigger `MutationObserver` notifications ([testcafe-hammerhead/#1769](https://github.com/DevExpress/testcafe-hammerhead/issues/1769))
1861* The `ECONNABORTED` error is no longer raised ([testcafe-hammerhead/#1744](https://github.com/DevExpress/testcafe-hammerhead/issues/1744))
1862* Websites that use `Location.ancestorOrigins` are now proxied correctly ([testcafe-hammerhead/#1342](https://github.com/DevExpress/testcafe-hammerhead/issues/1342))
1863
1864## v0.23.0 (2018-10-25)
1865
1866### Enhancements
1867
1868#### :gear: Stop Test Run After the First Test Fail ([#1323](https://github.com/DevExpress/testcafe/issues/1323))
1869
1870You can now configure TestCafe to stop the entire test run after the first test fail. This saves your time when you fix problems with your tests one by one.
1871
1872Specify the [--sf](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--sf---stop-on-first-fail) flag to enable this feature when you run tests from the command line.
1873
1874```sh
1875testcafe chrome my-tests --sf
1876```
1877
1878In the API, use the [stopOnFirstFail](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run) option.
1879
1880```js
1881runner.run({ stopOnFirstFail: true })
1882```
1883
1884#### :gear: View the JavaScript Errors' Stack Traces in Reports ([#2043](https://github.com/DevExpress/testcafe/issues/2043))
1885
1886Now when a JavaScript error occurs on the tested webpage, the test run report includes a stack trace for this error (only if the [--skip-js-errors](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-e---skip-js-errors) option is disabled).
1887
1888![A report that contains a stack trace for a client JS error](docs/articles/images/client-error-stack-report.png)
1889
1890#### :gear: Browsers are Automatically Restarted When They Stop Responding ([#1815](https://github.com/DevExpress/testcafe/issues/1815))
1891
1892If a browser stops responding while it executes tests, TestCafe restarts the browser and reruns the current test in a new browser instance.
1893If the same problem occurs with this test two more times, the test run finishes and an error is thrown.
1894
1895### Bug Fixes
1896
1897* An error message about an unawaited call to an async function is no longer displayed when an uncaught error occurs ([#2557](https://github.com/DevExpress/testcafe/issues/2557))
1898* A request hook is no longer added multiple times when a filter rule is used ([#2650](https://github.com/DevExpress/testcafe/issues/2650))
1899* Screenshot links in test run reports now contain paths specified by the `--screenshot-pattern` option ([#2726](https://github.com/DevExpress/testcafe/issues/2726))
1900* Assertion chains no longer produce unhandled promise rejections ([#2852](https://github.com/DevExpress/testcafe/issues/2852))
1901* The `moment` loader now works correctly in the Jest environment ([#2500](https://github.com/DevExpress/testcafe/issues/2500))
1902* TestCafe no longer hangs if the screenshot directory contains forbidden symbols ([#681](https://github.com/DevExpress/testcafe/issues/681))
1903* The `--ssl` option's parameters are now parsed correctly ([#2924](https://github.com/DevExpress/testcafe/issues/2924))
1904* TestCafe now throws a meaningful error if an assertion method is missing ([#1063](https://github.com/DevExpress/testcafe/issues/1063))
1905* TestCafe no longer hangs when it clicks a custom element ([#2861](https://github.com/DevExpress/testcafe/issues/2861))
1906* TestCafe now performs keyboard navigation between radio buttons/groups in a way that matches the native browser behavior ([#2067](https://github.com/DevExpress/testcafe/issues/2067), [#2045](https://github.com/DevExpress/testcafe/issues/2045))
1907* The `fetch` method can now be used with data URLs ([#2865](https://github.com/DevExpress/testcafe/issues/2865))
1908* The `switchToIframe` function no longer throws an error ([#2956](https://github.com/DevExpress/testcafe/issues/2956))
1909* TestCafe can now scroll through fixed elements when the action has custom offsets ([#2978](https://github.com/DevExpress/testcafe/issues/2978))
1910* You can now specify the current directory or its parent directories as the base path to store screenshots ([#2975](https://github.com/DevExpress/testcafe/issues/2975))
1911* Tests no longer hang up when you try to debug in headless browsers ([#2846](https://github.com/DevExpress/testcafe/issues/2846))
1912* The `removeEventListener` function now works correctly when an object is passed as its third argument ([testcafe-hammerhead/#1737](https://github.com/DevExpress/testcafe-hammerhead/issues/1737))
1913* Hammerhead no longer adds the `event` property to a null `contentWindow` in IE11 ([testcafe-hammerhead/#1684](https://github.com/DevExpress/testcafe-hammerhead/issues/1684))
1914* The browser no longer resets connection with the server for no reason ([testcafe-hammerhead/#1647](https://github.com/DevExpress/testcafe-hammerhead/issues/1647))
1915* Hammerhead now stringifies values correctly before outputting them to the console ([testcafe-hammerhead/#1750](https://github.com/DevExpress/testcafe-hammerhead/issues/1750))
1916* A document fragment from the top window can now be correctly appended to an iframe ([testcafe-hammerhead/#912](https://github.com/DevExpress/testcafe-hammerhead/issues/912))
1917* Lifecycle callbacks that result from the `document.registerElement` method are no longer called twice ([testcafe-hammerhead/#695](https://github.com/DevExpress/testcafe-hammerhead/issues/695))
1918
1919## v0.22.0 (2018-9-3)
1920
1921### Enhancements
1922
1923#### :gear: CoffeeScript Support ([#1556](https://github.com/DevExpress/testcafe/issues/1556)) by [@GeoffreyBooth](https://github.com/GeoffreyBooth)
1924
1925TestCafe now allows you to write tests in CoffeeScript. You do not need to compile CoffeeScript manually or make any customizations - everything works out of the box.
1926
1927```coffee
1928import { Selector } from 'testcafe'
1929
1930fixture 'CoffeeScript Example'
1931 .page 'https://devexpress.github.io/testcafe/example/'
1932
1933nameInput = Selector '#developer-name'
1934
1935test 'Test', (t) =>
1936 await t
1937 .typeText(nameInput, 'Peter')
1938 .typeText(nameInput, 'Paker', { replace: true })
1939 .typeText(nameInput, 'r', { caretPos: 2 })
1940 .expect(nameInput.value).eql 'Parker';
1941```
1942
1943#### :gear: Failed Selector Method Pinpointed in the Report ([#2568](https://github.com/DevExpress/testcafe/issues/2568))
1944
1945Now the test run report can identify which selector's method does not match any DOM element.
1946
1947![Failed Selector Report](docs/articles/images/failed-selector-report.png)
1948
1949#### :gear: Fail on Uncaught Server Errors ([#2546](https://github.com/DevExpress/testcafe/issues/2546))
1950
1951Previously, TestCafe ignored uncaught errors and unhandled promise rejections that occurred on the server. Whenever an error or a promise rejection happened, test execution continued.
1952
1953Starting from v0.22.0, tests fail if a server error or promise rejection is unhandled. To return to the previous behavior, we have introduced the `skipUncaughtErrors` option. Use the [--skip-uncaught-errors](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-u---skip-uncaught-errors) flag in the command line or the [skipUncaughtErrors](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#run) option in the API.
1954
1955```sh
1956testcafe chrome tests/fixture.js --skipUncaughtErrors
1957```
1958
1959```js
1960runner.run({skipUncaughtErrors:true})
1961```
1962
1963#### :gear: Use Glob Patterns in `runner.src` ([#980](https://github.com/DevExpress/testcafe/issues/980))
1964
1965You can now use [glob patterns](https://github.com/isaacs/node-glob#glob-primer) in the [runner.src](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#src) method to specify a set of test files.
1966
1967```js
1968runner.src(['/home/user/tests/**/*.js', '!/home/user/tests/foo.js']);
1969```
1970
1971### Bug Fixes
1972
1973* `RequestLogger` no longer fails when it tries to stringify a null request body ([#2718](https://github.com/DevExpress/testcafe/issues/2718))
1974* Temporary directories are now correctly removed when the test run is finished ([#2735](https://github.com/DevExpress/testcafe/issues/2735))
1975* TestCafe no longer throws `ECONNRESET` when run against a Webpack project ([#2711](https://github.com/DevExpress/testcafe/issues/2711))
1976* An error is no longer thrown when TestCafe tests Sencha ExtJS applications in IE11 ([#2639](https://github.com/DevExpress/testcafe/issues/2639))
1977* Firefox no longer waits for page elements to appear without necessity ([#2080](https://github.com/DevExpress/testcafe/issues/2080))
1978* `${BROWSER}` in the screenshot pattern now correctly resolves to the browser name ([#2742](https://github.com/DevExpress/testcafe/issues/2742))
1979* The `toString` function now returns a native string for overridden descriptor ancestors ([testcafe-hammerhead/#1713](https://github.com/DevExpress/testcafe-hammerhead/issues/1713))
1980* The `iframe` flag is no longer added when a form with `target="_parent"` is submitted ([testcafe-hammerhead/#1680](https://github.com/DevExpress/testcafe-hammerhead/issues/1680))
1981* Hammerhead no longer sends request headers in lower case ([testcafe-hammerhead/#1380](https://github.com/DevExpress/testcafe-hammerhead/issues/1380))
1982* The overridden `createHTMLDocument` method has the right context now ([testcafe-hammerhead/#1722](https://github.com/DevExpress/testcafe-hammerhead/issues/1722))
1983* Tests no longer lose connection ([testcafe-hammerhead/#1647](https://github.com/DevExpress/testcafe-hammerhead/issues/1647))
1984* The case when both the `X-Frame-Options` header and a CSP with `frame-ancestors` are set is now handled correctly ([testcafe-hammerhead/#1666](https://github.com/DevExpress/testcafe-hammerhead/issues/1666))
1985* The mechanism that resolves URLs on the client now works correctly ([testcafe-hammerhead/#1701](https://github.com/DevExpress/testcafe-hammerhead/issues/1701))
1986* `LiveNodeListWrapper` now imitates the native behavior correctly ([testcafe-hammerhead/#1376](https://github.com/DevExpress/testcafe-hammerhead/issues/1376))
1987
1988## v0.21.1 (2018-8-8)
1989
1990### Bug fixes
1991
1992* The `RequestLogger.clear` method no longer raises an error if it is called during a long running request ([#2688](https://github.com/DevExpress/testcafe/issues/2688))
1993* TestCafe now uses native methods to work with the `fetch` request ([#2686](https://github.com/DevExpress/testcafe/issues/2686))
1994* A URL now resolves correctly for elements in a `document.implementation` instance ([testcafe-hammerhead/#1673](https://github.com/DevExpress/testcafe-hammerhead/issues/1673))
1995* Response header names specified via the `respond` function are lower-cased now ([testcafe-hammerhead/#1704](https://github.com/DevExpress/testcafe-hammerhead/issues/1704))
1996* The cookie domain validation rule on the client side has been fixed ([testcafe-hammerhead/#1702](https://github.com/DevExpress/testcafe-hammerhead/issues/1702))
1997
1998## v0.21.0 (2018-8-2)
1999
2000### Enhancements
2001
2002#### :gear: Test Web Pages Served Over HTTPS ([#1985](https://github.com/DevExpress/testcafe/issues/1985))
2003
2004Some browser features (like [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API), [ApplePaySession](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession), or [SubtleCrypto](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto)) require a secure origin. This means that the website should use the HTTPS protocol.
2005
2006Starting with v0.21.0, TestCafe can serve proxied web pages over HTTPS. This allows you to test pages that require a secure origin.
2007
2008To enable HTTPS when you use TestCafe through the command line, specify the [--ssl](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--ssl-options) flag followed by the [HTTPS server options](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener). The most commonly used options are described in the [TLS topic](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) in the Node.js documentation.
2009
2010```sh
2011testcafe --ssl pfx=path/to/file.pfx;rejectUnauthorized=true;...
2012```
2013
2014When you use a programming API, pass the HTTPS server options to the [createTestCafe](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/createtestcafe.html) method.
2015
2016```js
2017'use strict';
2018
2019const createTestCafe = require('testcafe');
2020const selfSignedCertificate = require('openssl-self-signed-certificate');
2021let runner = null;
2022
2023const sslOptions = {
2024 key: selfSignedCertificate.key,
2025 cert: selfSignedCertificate.cert
2026};
2027
2028createTestCafe('localhost', 1337, 1338, sslOptions)
2029 .then(testcafe => {
2030 runner = testcafe.createRunner();
2031 })
2032 .then(() => {
2033 return runner
2034 .src('test.js')
2035
2036 // Browsers restrict self-signed certificate usage unless you
2037 // explicitly set a flag specific to each browser.
2038 // For Chrome, this is '--allow-insecure-localhost'.
2039 .browsers('chrome --allow-insecure-localhost')
2040 .run();
2041 });
2042```
2043
2044See [Connect to TestCafe Server over HTTPS](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/connect-to-the-testcafe-server-over-https.html) for more information.
2045
2046#### :gear: Construct Screenshot Paths with Patterns ([#2152](https://github.com/DevExpress/testcafe/issues/2152))
2047
2048You can include placeholders in the path, for example, `${DATE}`, `${TIME}`, `${USERAGENT}`, etc. For a complete list, refer to [Path Pattern Placeholders](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/screenshots-and-videos.html#path-pattern-placeholders).
2049
2050You should specify a screenshot path pattern when you run tests. Each time TestCafe takes a screenshot, it substitutes the placeholders with actual values and saves the screenshot to the resulting path.
2051
2052The following example shows how to use the command line to specify a screenshot path pattern:
2053
2054```sh
2055testcafe all test.js -s path=screenshots,pathPattern=${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png
2056```
2057
2058When you use a programming API, pass the screenshot path pattern to the [runner.screenshots method](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html#screenshots).
2059
2060```js
2061runner.screenshots({
2062 path: 'reports/screenshots/',
2063 takeOnFails: true,
2064 pathPattern: '${TEST_INDEX}/${OS}/${BROWSER}-v${BROWSER_VERSION}/${FILE_INDEX}.png'
2065});
2066```
2067
2068#### :gear: Add Info About Screenshots and Quarantine Attempts to Custom Reports ([#2216](https://github.com/DevExpress/testcafe/issues/2216))
2069
2070Custom reporters can now access screenshots' data and the history of quarantine attempts (if the test run in the quarantine mode).
2071
2072The following information about screenshots is now available:
2073
2074* the path to the screenshot file,
2075* the path to the thumbnail image,
2076* the browser's user agent,
2077* the quarantine attempt number (if the screenshot was taken in the quarantine mode),
2078* whether the screenshot was taken because the test failed.
2079
2080If the test was run in the quarantine mode, you can also determine which attempts failed and passed.
2081
2082Refer to the [reportTestDone method description](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html#reporttestdone) for details on how to access this information.
2083
2084### Bug Fixes
2085
2086* HTML5 drag events are no longer simulated if `event.preventDefault` is called for the `mousedown` event ([#2529](https://github.com/DevExpress/testcafe/issues/2529))
2087* File upload no longer causes an exception when there are several file inputs on the page ([#2642](https://github.com/DevExpress/testcafe/issues/2642))
2088* File upload now works with inputs that have the `required` attribute ([#2509](https://github.com/DevExpress/testcafe/issues/2509))
2089* The `load` event listener is no longer triggered when added to an image ([testcafe-hammerhead/#1688](https://github.com/DevExpress/testcafe-hammerhead/issues/1688))
2090
2091## v0.20.5 (2018-7-18)
2092
2093### Bug fixes
2094
2095* The `buttons` property was added to the `MouseEvent` instance ([#2056](https://github.com/DevExpress/testcafe/issues/2056))
2096* Response headers were converted to lowercase ([#2534](https://github.com/DevExpress/testcafe/issues/2534))
2097* Updated flow definitions ([#2053](https://github.com/DevExpress/testcafe/issues/2053))
2098* An `AttributesWrapper` instance is now updated when the the element's property specifies the `disabled` attribute ([#2539](https://github.com/DevExpress/testcafe/issues/2539))
2099* TestCafe no longer hangs when it redirects from a tested page to the 'about:error' page with a hash ([#2371](https://github.com/DevExpress/testcafe/issues/2371))
2100* TestCafe now reports a warning for a mocked request if CORS validation failed ([#2482](https://github.com/DevExpress/testcafe/issues/2482))
2101* Prevented situations when a request logger tries to stringify a body that is not logged ([#2555](https://github.com/DevExpress/testcafe/issues/2555))
2102* The Selector API now reports `NaN` instead of `integer` when type validation fails ([#2470](https://github.com/DevExpress/testcafe/issues/2470))
2103* Enabled `noImplicitAny` and disabled `skipLibCheck` in the TypeScript compiler ([#2497](https://github.com/DevExpress/testcafe/issues/2497))
2104* Pages with `rel=prefetch` links no longer hang during test execution ([#2528](https://github.com/DevExpress/testcafe/issues/2528))
2105* Fixed the `TypeError: this.res.setHeader is not a function` error in Firefox ([#2438](https://github.com/DevExpress/testcafe/issues/2438))
2106* The `formtarget` attribute was overridden ([testcafe-hammerhead/#1513](https://github.com/DevExpress/testcafe-hammerhead/issues/1513))
2107* `fetch.toString()` now equals `function fetch() { [native code] }` ([testcafe-hammerhead/#1662](https://github.com/DevExpress/testcafe-hammerhead/issues/1662))
2108
2109## v0.20.4 (2018-6-25)
2110
2111### Enhancements
2112
2113#### TestCafe now takes screenshots using browsers' debug protocols ([#2492](https://github.com/DevExpress/testcafe/pull/2492))
2114
2115### Bug fixes
2116
2117* `fetch` requests now correctly proxied in a specific case ([testcafe-hammerhead/#1613](https://github.com/DevExpress/testcafe-hammerhead/issues/1613))
2118* Resources responding with `304` HTTP status code and with the 'content-length: ' header are proxied correctly now ([testcafe-hammerhead/#1602](https://github.com/DevExpress/testcafe-hammerhead/issues/1602))
2119* The `transfer` argument of `window.postMessage` is passed correctly now ([testcafe-hammerhead/#1535](https://github.com/DevExpress/testcafe-hammerhead/issues/1535))
2120* Incorrect focus events order in IE has been fixed ([#2072](https://github.com/DevExpress/testcafe/issues/2072))
2121
2122## v0.20.3 (2018-6-6)
2123
2124### Enhancements
2125
2126#### :gear: Add TS definitions to the Docker image ([#2481](https://github.com/DevExpress/testcafe/pull/2481))
2127
2128### Bug fixes
2129
2130* Selection in a `contenteditable` `div` now works properly in a specific scenario ([#2365](https://github.com/DevExpress/testcafe/issues/2365))
2131* A collision related to several `moment-duration-format` package versions is now fixed ([#1750](https://github.com/DevExpress/testcafe/issues/1750))
2132* TestCafe now reports a warning when saving several screenshots at the same path ([#2213](https://github.com/DevExpress/testcafe/issues/2213))
2133* A regression related to wrongly processed `document.write` in IE11 is now fixed ([#2469](https://github.com/DevExpress/testcafe/issues/2469))
2134* An out of memory crash on calling console methods is now fixed ([testcafe-hammerhead/#1546](https://github.com/DevExpress/testcafe-hammerhead/issues/1546))
2135* `Click` action for an element with 1px height or width works properly now ([#2020](https://github.com/DevExpress/testcafe/issues/2020))
2136* Touch emulation for the latest Google Chrome was fixed ([#2448](https://github.com/DevExpress/testcafe/issues/2448))
2137
2138## v0.20.2 (2018-5-24)
2139
2140### :gear: Package dependencies have been upgraded to avoid CVEs reported by Node Security Platform
2141
2142### Bug fixes
2143
2144* Enabled the screenshot and window resizing functionalities in the concurrency mode for Firefox and Chrome on macOS [#2095](https://github.com/DevExpress/testcafe/issues/2095)
2145
2146## v0.20.1 (2018-5-21)
2147
2148### :gear: Typescript definitions for new features from v0.20.0 have been added ([#2428](https://github.com/DevExpress/testcafe/issues/2428))
2149
2150### Bug fixes
2151
2152* Now sites with the overridden `Element.prototype.matches` method work properly [#2241](https://github.com/DevExpress/testcafe/issues/2241)
2153* `window.Blob` now returns a correct result when Array of `ArrayBuffer` is passed as a parameter ([testcafe-hammerhead/#1599](https://github.com/DevExpress/testcafe-hammerhead/issues/1599))
2154* Firefox Shield popup is not shown during test execution now ([#2421](https://github.com/DevExpress/testcafe/pull/2421))
2155
2156## v0.20.0 (2018-5-15)
2157
2158### Request Hooks: Intercepting HTTP requests ([#1341](https://github.com/DevExpress/testcafe/issues/1341))
2159
2160TestCafe now allows you to record HTTP request data or mock responses. You can also create a custom HTTP request hook to emulate authentications like **Kerberos** or **Client Certificate Authentication**.
2161
2162See [Intercepting HTTP Requests](https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests) for more information.
2163
2164### Enhancements
2165
2166#### :gear: Specifying resources accessed by bypassing a proxy server ([#1791](https://github.com/DevExpress/testcafe/issues/1791))
2167
2168TestCafe now allows you to bypass the proxy server when accessing specific resources.
2169
2170To specify resources that require direct access, use the [--proxy-bypass](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--proxy-bypass-rules) flag in the command line or the [useProxy](https://devexpress.github.io/testcafe/documentation/using-testcafe/programming-interface/runner.html) API method's parameters.
2171
2172```sh
2173testcafe chrome my-tests/**/*.js --proxy proxy.corp.mycompany.com --proxy-bypass localhost:8080,internal-resource.corp.mycompany.com
2174```
2175
2176```js
2177runner.useProxy('172.0.10.10:8080', ['localhost:8080', 'internal-resource.corp.mycompany.com']);
2178```
2179
2180#### :gear: Specifying testing metadata ([#2242](https://github.com/DevExpress/testcafe/issues/2242))
2181
2182TestCafe allows you to specify additional information for tests in the form of key-value metadata and use it in reports.
2183
2184You can define metadata for a fixture or a test using the [meta](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#specifying-testing-metadata) method:
2185
2186```js
2187fixture `My Fixture`
2188 .meta('fixtureID', 'f-0001')
2189 .meta({ author: 'John', creationDate: '05/03/2018' });
2190```
2191
2192```js
2193test
2194 .meta('testID', 't-0005')
2195 .meta({ severity: 'critical', testedAPIVersion: '1.0' })
2196 ('MyTest', async t => { /* ... */});
2197```
2198
2199To include testing metadata to reports, use the [custom reporter methods](https://devexpress.github.io/testcafe/documentation/extending-testcafe/reporter-plugin/reporter-methods.html).
2200
2201#### :gear: Passing a regular promise to `t.expect` is deprecated now ([#2207](https://github.com/DevExpress/testcafe/issues/2207))
2202
2203TestCafe now throws an error if you pass a regular promise to the assertion's `expect` method.
2204
2205If you need to assert a regular promise, set the [allowUnawaitedPromise](https://devexpress.github.io/testcafe/documentation/test-api/assertions/#optionsallowunawaitedpromise) option to `true`.
2206
2207```js
2208await t.expect(doSomethingAsync()).ok('check that a promise is returned', { allowUnawaitedPromise: true });
2209```
2210
2211### Bug Fixes
2212
2213* The session recovery bubble in Firefox is disabled ([#2341](https://github.com/DevExpress/testcafe/pull/2341))
2214* TestCafe works properly if a `body` element has the `pointer-events: none;` css style rule ([#2251](https://github.com/DevExpress/testcafe/issues/2251))
2215* Resizing Chrome in the emulation mode works correctly ([#2154](https://github.com/DevExpress/testcafe/issues/2154))
2216* The location port is used for service messages ([#2308](https://github.com/DevExpress/testcafe/pull/2308))
2217* A browser instance shuts down correctly on Unix systems ([#2226](https://github.com/DevExpress/testcafe/issues/2226))
2218* An `Integrity` attribute is removed from `script` and `link` tags ([testcafe-hammerhead/#235](https://github.com/DevExpress/testcafe-hammerhead/issues/235))
2219* The `event.preventDefault()` method call changes the `event.defaultPrevented` property value ([testcafe-hammerhead/#1588](https://github.com/DevExpress/testcafe-hammerhead/issues/1588))
2220* It is possible to set the `meta` element's `content` attribute ([testcafe-hammerhead/#1586](https://github.com/DevExpress/testcafe-hammerhead/issues/1586))
2221* TestCafe no longer overrides attributes used in a non-standard way with `null` ([testcafe-hammerhead/#1583](https://github.com/DevExpress/testcafe-hammerhead/pull/1583))
2222* The `Change` event fires correctly if the `target.value` changes ([#2319](https://github.com/DevExpress/testcafe/issues/2319))
2223* `MouseEvent.screenX` and `MouseEvent.screenY` are added to the emulated events ([#2325](https://github.com/DevExpress/testcafe/issues/2325))
2224* Cookies on `localhost` are processed correctly ([testcafe-hammerhead/#1491](https://github.com/DevExpress/testcafe-hammerhead/issues/1491))
2225* Setting the `//` url for an image works correctly ([#2312](https://github.com/DevExpress/testcafe/issues/2312))
2226* `shadowUI` internal elements are no longer processed ([#2281](https://github.com/DevExpress/testcafe/issues/2281))
2227* `typeInput` event is raised correctly ([#1956](https://github.com/DevExpress/testcafe/issues/1956))
2228* Selecting text in contenteditable elements works properly ([#2301](https://github.com/DevExpress/testcafe/issues/2301))
2229
2230## v0.19.2 (2018-4-11)
2231
2232### Enhancements
2233
2234#### Added support for browser providers from private repositories ([#2221](https://github.com/DevExpress/testcafe/issues/2221))
2235
2236### Bug Fixes
2237
2238* Restored the screenshot functionality in legacy tests ([#2235](https://github.com/DevExpress/testcafe/issues/2235))
2239* Updated the list of emulation devices in Google Chrome ([#2257](https://github.com/DevExpress/testcafe/issues/2257))
2240* Fixed touch events emulation ([#2268](https://github.com/DevExpress/testcafe/issues/2268))
2241* The `event.relatedTarget` property is set correctly for the emulated focus and drag events ([#2197](https://github.com/DevExpress/testcafe/issues/2197))
2242* The `event.detail` property is set correctly for the emulated mouse events ([#2232](https://github.com/DevExpress/testcafe/issues/2232))
2243* The `Element.innerHTML` property is processed correctly in certain cases ([testcafe-hammerhead/#1538](https://github.com/DevExpress/testcafe-hammerhead/issues/1538))
2244* The iframe location has the correct value when it is not initialized ([testcafe-hammerhead/#1531](https://github.com/devexpress/testcafe-hammerhead/issues/1531))
2245* A trailing slash is added to test page URL when necessary ([#2005](https://github.com/DevExpress/testcafe/issues/2005))
2246* The `focus` event is not called for a disabled input ([#2123](https://github.com/devexpress/testcafe/issues/2123))
2247
2248## v0.19.1 (2018-3-13)
2249
2250### Backward compatibility with the legacy test syntax has been restored ([#2210](https://github.com/DevExpress/testcafe/issues/2210))
2251
2252### Bug Fixes
2253
2254* The `document.all` property is overridden ([testcafe-hammerhead/#1046](https://github.com/DevExpress/testcafe-hammerhead/issues/1046))
2255* Proxying properties in `async` class methods are supported ([testcafe-hammerhead/#1510](https://github.com/DevExpress/testcafe-hammerhead/issues/1510))
2256* Fixed wrongly proxying a `localStorage` check-in WebWorkers ([testcafe-hammerhead/#1496](https://github.com/DevExpress/testcafe-hammerhead/issues/1496))
2257
2258## v0.19.0 (2018-3-1)
2259
2260### TestCafe Live: See instant feedback when working on tests ([#1624](https://github.com/DevExpress/testcafe/issues/1624))
2261
2262We have prepared a new tool for rapid test development.
2263
2264TestCafe Live provides a service that keeps the TestCafe process and browsers opened while you are working on tests. Changes you make in code immediately restart the tests. That is, TestCafe Live allows you to see test results instantly.
2265
2266[![TestCafe Live Video](https://raw.githubusercontent.com/DevExpress/testcafe/master/media/changelog/testcafe-live-video.png)](https://www.youtube.com/watch?v=RWQtB6Xv01Q)
2267
2268See [TestCafe Live](https://github.com/DevExpress/testcafe-live) for more information.
2269
2270### Enhancements
2271
2272#### :gear: Taking Screenshots of Individual Page Elements ([#1496](https://github.com/DevExpress/testcafe/issues/1496))
2273
2274We have added the [t.takeElementScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-a-page-element) action that allows you to take a screenshot of an individual page element.
2275
2276```js
2277import { Selector } from 'testcafe';
2278
2279fixture `My fixture`
2280 .page `http://devexpress.github.io/testcafe/example/`;
2281
2282test('Take a screenshot of a fieldset', async t => {
2283 await t
2284 .click('#reusing-js-code')
2285 .click('#continuous-integration-embedding')
2286 .takeElementScreenshot(Selector('fieldset').nth(1), 'my-fixture/important-features.png');
2287});
2288```
2289
2290This action provides additional customization that allows you to adjust the screenshot's center or crop it. Refer to the [t.takeElementScreenshot](https://devexpress.github.io/testcafe/documentation/test-api/actions/take-screenshot.html#take-a-screenshot-of-a-page-element) description for more information.
2291
2292#### :gear: Filtering Elements by Their Visibility ([#1018](https://github.com/DevExpress/testcafe/issues/1018))
2293
2294You can now use the [filterVisible](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html#filtervisible) and [filterHidden](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html#filterhidden) methods to display only visible or hidden elements.
2295
2296```js
2297import { Selector } from 'testcafe';
2298
2299fixture `My fixture`
2300 .page `http://devexpress.github.io/testcafe/example/`;
2301
2302test('Filter visible and hidden elements', async t => {
2303 const inputs = Selector('input');
2304 const hiddenInput = inputs.filterHidden();
2305 const visibleInputs = inputs.filterVisible();
2306
2307 await t
2308 .expect(hiddenInput.count).eql(1)
2309 .expect(visibleInputs.count).eql(11);
2310});
2311```
2312
2313#### :gear: Finding Elements by the Exact Matching Text ([#1292](https://github.com/DevExpress/testcafe/issues/1292))
2314
2315The current selector's [withText](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html#withtext) method looks for elements whose text content *contains* the specified string. With this release, we have added the [withExactText](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/functional-style-selectors.html#withexacttext) method that searches by *strict match*.
2316
2317```js
2318import { Selector } from 'testcafe';
2319
2320fixture `My fixture`
2321 .page `http://devexpress.github.io/testcafe/example/`;
2322
2323test('Search by exact text', async t => {
2324 const labels = Selector('label');
2325 const winLabel = labels.withExactText('Windows');
2326 const reusingLabel = labels.withText('JavaScript');
2327
2328 await t
2329 .expect(winLabel.exists).ok()
2330 .expect(reusingLabel.exists).ok();
2331});
2332```
2333
2334#### :gear: Using Decorators in TypeScript Code ([#2117](https://github.com/DevExpress/testcafe/issues/2117)) by [@pietrovich](https://github.com/pietrovich)
2335
2336TestCafe now allows you to use [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) when [writing tests in TypeScript](https://devexpress.github.io/testcafe/documentation/test-api/typescript-support.html).
2337
2338Note that decorators are still an experimental feature in TypeScript.
2339
2340### Bug Fixes
2341
2342* TestCafe can scroll a webpage when the `body` has a scroll bar ([#1940](https://github.com/DevExpress/testcafe/issues/1940))
2343* Firefox no longer hangs with a dialog asking to set it as the default browser ([#1926](https://github.com/DevExpress/testcafe/issues/1926))
2344* Legacy APIs no longer freeze because of an unexpected error ([#1790](https://github.com/DevExpress/testcafe/issues/1790))
2345* Clicking an element that was hidden and then recreated on timeout works correctly ([#1994](https://github.com/DevExpress/testcafe/issues/1994))
2346* TestCafe finds browsers in headless mode on macOS when tests are executing concurrently ([#2035](https://github.com/DevExpress/testcafe/issues/2035))
2347* The local storage is restored correctly ([#2015](https://github.com/DevExpress/testcafe/issues/2015)) when roles are switched using the `preserverUrl` flag
2348* TestCafe progress bar is no longer visible on screenshots ([#2076](https://github.com/DevExpress/testcafe/issues/2076))
2349* Window manipulations wait for pages to load ([#2000](https://github.com/DevExpress/testcafe/issues/2000))
2350* All toolbars are hidden when taking screenshots ([#1445](https://github.com/DevExpress/testcafe/issues/1445))
2351* TestCafe works with the latest CucumberJS version ([#2107](https://github.com/DevExpress/testcafe/issues/2107))
2352* Fixed an error connected to file permissions on Ubuntu ([#2144](https://github.com/DevExpress/testcafe/issues/2144))
2353* Browser manipulations can be executed step-by-step ([#2150](https://github.com/DevExpress/testcafe/issues/2150))
2354* Fixed a bug where a page does not load because of an error in `generateCallExpression` ([testcafe-hammerhead/#1389](https://github.com/DevExpress/testcafe-hammerhead/issues/1389))
2355* The overridden Blob constructor does not process data unnecessarily ([testcafe-hammerhead/#1359](https://github.com/DevExpress/testcafe-hammerhead/issues/1359))
2356* The `target` attribute is not set for a button after clicking on it ([testcafe-hammerhead/#1437](https://github.com/DevExpress/testcafe-hammerhead/issues/1437))
2357* The `sandbox`, `target` and `style` attributes are cleaned up ([testcafe-hammerhead/#1448](https://github.com/DevExpress/testcafe-hammerhead/issues/1448))
2358* A `RangeError` with the message `Maximum call stack size exceeded` is no longer raised ([testcafe-hammerhead/#1452](https://github.com/DevExpress/testcafe-hammerhead/issues/1452))
2359* A script error is no longer raised on pages that contain a `beforeunload` handler ([testcafe-hammerhead/#1419](https://github.com/DevExpress/testcafe-hammerhead/issues/1419))
2360* Fixed wrongly overridding an event object ([testcafe-hammerhead/#1445](https://github.com/DevExpress/testcafe-hammerhead/issues/1445))
2361* An illegal invocation error is no longer raised when calling the `FileListWrapper.item` method ([testcafe-hammerhead/#1446](https://github.com/DevExpress/testcafe-hammerhead/issues/1446)) by [@javiercbk](https://github.com/javiercbk)
2362* A script error is no longer raised when `Node.nextSibling` is `null` ([testcafe-hammerhead/#1469](https://github.com/DevExpress/testcafe-hammerhead/issues/1469))
2363* The `isShadowUIElement` check is performed for `Node.nextSibling` when a node is not an element ([testcafe-hammerhead/#1465](https://github.com/DevExpress/testcafe-hammerhead/issues/1465))
2364* The `toString` function is overridden for anchor elements ([testcafe-hammerhead/#1483](https://github.com/DevExpress/testcafe-hammerhead/issues/1483))
2365
2366## v0.18.6 (2017-12-28)
2367
2368### Enhancements
2369
2370#### Chrome DevTools are opened in a separate window during test execution ([#1964](https://github.com/DevExpress/testcafe/issues/1964))
2371
2372### Bug Fixes
2373
2374* In Chrome, disabled showing the 'Save password' prompt after typing text in the `password` input ([#1913](https://github.com/DevExpress/testcafe/issues/1913))
2375* TestCafe correctly scrolls a page to an element when this page has scrollbars ([#1955](https://github.com/DevExpress/testcafe/pull/1955))
2376* Fixed the 'Cannot redefine property %testCafeCore%' script error ([#1996](https://github.com/DevExpress/testcafe/issues/1996))
2377* TestCafe rounds off dimension values when it calculates scrolling ([#2004](https://github.com/DevExpress/testcafe/pull/2004))
2378* In Chrome, the 'Download multiple files' dialog no longer prevents the test execution process ([#2017](https://github.com/DevExpress/testcafe/issues/2017))
2379* TestCafe closes a connection to the specified resource if the destination server hangs ([testcafe-hammerhead/#1384](https://github.com/DevExpress/testcafe-hammerhead/issues/1384))
2380* Proxying the `location's` `href` property works correctly ([testcafe-hammerhead/#1362](https://github.com/DevExpress/testcafe-hammerhead/issues/1362))
2381* The proxy supports `https` requests for node 8.6 and higher ([testcafe-hammerhead/#1401](https://github.com/DevExpress/testcafe-hammerhead/issues/1401))
2382* Added support for pages with the `super` keyword ([testcafe-hammerhead/#1390](https://github.com/DevExpress/testcafe-hammerhead/issues/1390))
2383* The proxy emulates native browser behavior for non-success status codes ([testcafe-hammerhead/#1397](https://github.com/DevExpress/testcafe-hammerhead/issues/1397))
2384* The proxied `ServiceWorker.register` method returns a rejected Promise for unsecure URLs ([testcafe-hammerhead/#1411](https://github.com/DevExpress/testcafe-hammerhead/issues/1411))
2385* Added support for `javascript` protocol expressions applied to the location's properties ([testcafe-hammerhead/#1274](https://github.com/DevExpress/testcafe-hammerhead/issues/1274))
2386
2387## v0.18.5 (2017-11-23): Security Update
2388
2389### Vulnerability Fix ([testcafe-legacy-api/#26](https://github.com/DevExpress/testcafe-legacy-api/issues/26))
2390
2391We have fixed a vulnerability related to the dependency on [uglify-js v1.x](https://github.com/mishoo/UglifyJS). We used it in our [testcafe-legacy-api](https://github.com/DevExpress/testcafe-legacy-api/) module that provides backward compatibility with older APIs from the paid TestCafe version.
2392
2393This vulnerability affected only those who run tests created with the commercial version of TestCafe in the new open-source TestCafe.
2394
2395## v0.18.4 (2017-11-17)
2396
2397### Enhancements
2398
2399#### :gear: WebSockets support ([testcafe-hammerhead/#911](https://github.com/DevExpress/testcafe-hammerhead/issues/911))
2400
2401TestCafe provides full-featured WebSocket support (`wss` and `ws` protocols, request authentication, etc.).
2402
2403### Bug Fixes
2404
2405* You can click on elements under the Status bar and specify the `transition` css property ([#1934](https://github.com/DevExpress/testcafe/issues/1934))
2406* Added support for pages with the `rest` and `default parameter` instructions ([testcafe-hammerhead/#1336](https://github.com/DevExpress/testcafe-hammerhead/issues/1336))
2407* Pages with several `base` tags are supported ([testcafe-hammerhead/#1349](https://github.com/DevExpress/testcafe-hammerhead/issues/1349))
2408* Redirects from cross-domain to same-domain pages are processed ([#1922](https://github.com/DevExpress/testcafe/issues/1922))
2409* Contenteditable custom elements are correctly recognized ([testcafe-hammerhead/#1366](https://github.com/DevExpress/testcafe-hammerhead/issues/1366))
2410* Internal headers for `fetch` requests are set correctly ([testcafe-hammerhead/#1360](https://github.com/DevExpress/testcafe-hammerhead/issues/1360))
2411
2412## v0.18.3 (2017-11-08)
2413
2414### Bug Fixes
2415
2416* Readonly instrumented DOM properties are now set correctly for plain objects ([testcafe-hammerhead/#1351](https://github.com/DevExpress/testcafe-hammerhead/issues/1351)).
2417* The `HTMLElement.style` property is proxied on the client side now ([testcafe-hammerhead/#1348](https://github.com/DevExpress/testcafe-hammerhead/issues/1348)).
2418* The `Refresh` response header is proxied now ([testcafe-hammerhead/#1354](https://github.com/DevExpress/testcafe-hammerhead/issues/1354])).
2419
2420## v0.18.2 (2017-10-26)
2421
2422### Bug Fixes
2423
2424* Screenshots are captured correctly when using High DPI monitor configurations on Windows ([#1896](https://github.com/DevExpress/testcafe/issues/1896))
2425* Fixed the `Cannot read property 'getItem' of null` error which is raised when a console message was printed in an iframe before it is completely loaded ([#1875](https://github.com/DevExpress/testcafe/issues/1875))
2426* Fixed the `Content iframe did not load` error which is raised if an iframe reloaded during the `switchToIframe` command execution ([#1842](https://github.com/DevExpress/testcafe/issues/1842))
2427* Selector options are passed to all derivative selectors ([#1907](https://github.com/DevExpress/testcafe/issues/1907))
2428* Fixed a memory leak in IE related to live node collection proxying ([testcafe-hammerhead/#1262](https://github.com/DevExpress/testcafe-hammerhead/issues/1262))
2429* `DocumentFragment` nodes are correctly processed ([testcafe-hammerhead/#1334](https://github.com/DevExpress/testcafe-hammerhead/issues/1334))
2430
2431## v0.18.1 (2017-10-17): a recovery release following v0.18.0
2432
2433### --reporter flag name fixed ([#1881](https://github.com/DevExpress/testcafe/issues/1881))
2434
2435In v0.18.0, we changed the [--reporter](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-r-nameoutput---reporter-nameoutput) CLI flag to `--reporters`. In this release, we rolled back to the previous flag name.
2436
2437### Compatibility with RequireJS restored ([#1874](https://github.com/DevExpress/testcafe/issues/1874))
2438
2439Changes in v0.18.0 made TestCafe incompatible with [RequireJS](http://requirejs.org). It is fixed in this recovery release.
2440
2441We apologize for any inconvenience.
2442
2443## v0.18.0 (2017-10-10)
2444
2445### Enhancements
2446
2447#### :gear: Testing in headless Firefox
2448
2449We have added support for [headless](https://developer.mozilla.org/en-US/Firefox/Headless_mode) testing in Firefox (version 56+) and Chrome.
2450
2451```sh
2452testcafe firefox:headless tests/sample-fixture.js
2453```
2454
2455```js
2456runner
2457 .src('tests/sample-fixture.js')
2458 .browsers('firefox:headless')
2459 .run()
2460 .then(failedCount => {
2461 // ...
2462 });
2463```
2464
2465#### :gear: Outputting test results to multiple channels ([#1412](https://github.com/DevExpress/testcafe/issues/1412))
2466
2467You can now print a report in the console and saved it to a `.json` file by specifying multiple reporters when running tests.
2468
2469```sh
2470testcafe all tests/sample-fixture.js -r spec,json:report.json
2471```
2472
2473```js
2474const stream = fs.createWriteStream('report.json');
2475
2476runner
2477 .src('tests/sample-fixture.js')
2478 .browsers('chrome')
2479 .reporter('spec')
2480 .reporter('json', stream)
2481 .run()
2482 .then(failedCount => {
2483 stream.end();
2484 });
2485```
2486
2487#### :gear: Entering the debug mode when a test fails ([#1608](https://github.com/DevExpress/testcafe/issues/1608))
2488
2489TestCafe can now automatically switch to the debug mode when a test fails. Test execution is paused so that you can explore the tested page to determine the failure's cause.
2490
2491To enable this behavior, use the `--debug-on-fail` flag in the command line or the `debugOnFail` option in the API.
2492
2493```sh
2494testcafe chrome tests/fixture.js --debug-on-fail
2495```
2496
2497```js
2498runner.run({ debugOnFail: true });
2499```
2500
2501#### :gear: Interacting with the tested page in debug mode ([#1848](https://github.com/DevExpress/testcafe/issues/1848))
2502
2503When debugging your tests, you can now interact with the tested page. Click the **Unlock page** button in the page footer to enable interaction.
2504
2505![Unlock page button](docs/articles/images/unlock-page-button.png)
2506
2507Click **Resume** to continue running the test or click **Next Step** to skip to the next step.
2508
2509#### :gear: Chrome and Firefox are opened with clean profiles by default ([#1623](https://github.com/DevExpress/testcafe/issues/1623))
2510
2511TestCafe now opens Chrome and Firefox with empty profiles to eliminate profile settings' and extensions' influence on tests.
2512
2513However, you can **return to the previous behavior** using the `:userProfile` browser option.
2514
2515```sh
2516testcafe firefox:userProfile tests/test.js
2517```
2518
2519```js
2520runner
2521 .src('tests/fixture1.js')
2522 .browsers('firefox:userProfile')
2523 .run();
2524```
2525
2526#### :gear: Customizable timeout to wait for the `window.load` event ([#1645](https://github.com/DevExpress/testcafe/issues/1645))
2527
2528Previously, TestCafe started a test when the `DOMContentLoaded` event was raised. However, there are many pages that execute initialization code on the `window.load` event (which is raised after `DOMContentLoaded` because it waits for all stylesheets, images and subframes to load). In this case, you need to wait for the `window.load` event to fire before running tests.
2529
2530With this release, TestCafe waits `3` seconds for the `window.load` event.
2531We have also added a `pageLoadTimeout` setting that allows you to customize this interval.
2532You can set it to `0` to skip waiting for `window.load`.
2533
2534The following examples show how to use the `pageLoadTimeout` setting from the command line and API:
2535
2536```sh
2537testcafe chrome test.js --page-load-timeout 0
2538```
2539
2540```js
2541runner.run({
2542 pageLoadTimeout: 0
2543});
2544```
2545
2546You can also use the `setPageLoadTimeout` method in the test API to set the timeout for an individual test.
2547
2548```js
2549fixture `Page load timeout`
2550 .page `http://devexpress.github.io/testcafe/example/`;
2551
2552test(`Page load timeout`, async t => {
2553 await t
2554 .setPageLoadTimeout(0)
2555 .navigateTo('http://devexpress.github.io/testcafe/');
2556});
2557```
2558
2559#### :gear: Access messages output by the tested app to the browser console ([#1738](https://github.com/DevExpress/testcafe/issues/1738))
2560
2561You can now obtain messages that the tested app outputs to the browser console. This is useful if your application or the framework it uses posts errors, warnings or other informative messages to the console.
2562
2563Use the `t.getBrowserConsoleMessages` method that returns the following object:
2564
2565```js
2566{
2567 error: ["Cannot access the 'db' database. Wrong credentials.", '...'], // error messages
2568 warn: ['The setTimeout property is deprecated', '...'], // warning messages
2569 log: ['[09:12:08] Logged in', '[09:25:43] Changes saved', '...'], // log messages
2570 info: ['The application was updated since your last visit.', '...'] // info messages
2571}
2572```
2573
2574Note that this method returns only messages posted via the `console.error`, `console.warn`, `console.log` and `console.info` methods. Messages the browser outputs (like when an unhandled exception occurs on the page) are not returned.
2575
2576For instance, you can use React's typechecking feature, [PropTypes](https://reactjs.org/docs/typechecking-with-proptypes.html), to check that you assigned valid values to the component's props. If a `PropTypes` rule is violated, React posts an error to the JavaScript console.
2577
2578The following example shows how to check the React prop types for errors using the `t.getBrowserConsoleMessages` method:
2579
2580```js
2581// check-prop-types.js
2582import { t } from 'testcafe';
2583
2584export default async function () {
2585 const { error } = await t.getBrowserConsoleMessages();
2586
2587 await t.expect(error[0]).notOk();
2588}
2589
2590// test.js
2591import { Selector } from 'testcafe';
2592import checkPropTypes from './check-prop-types';
2593
2594fixture `react example`
2595 .page `http://localhost:8080/` // https://github.com/mzabriskie/react-example
2596 .afterEach(() => checkPropTypes());
2597
2598test('test', async t => {
2599 await t
2600 .typeText(Selector('.form-control'), 'devexpress')
2601 .click(Selector('button').withText('Go'))
2602 .click(Selector('h4').withText('Organizations'));
2603});
2604```
2605
2606#### :gear: Defining drag end point on the destination element ([#982](https://github.com/DevExpress/testcafe/issues/982))
2607
2608The `t.dragToElement` action can now drop a dragged element at any point inside the destination element.
2609You can specify the target point using the `destinationOffsetX` and `destinationOffsetY` options.
2610
2611```js
2612import { Selector } from 'testcafe';
2613
2614const fileIcon = Selector('.file-icon');
2615const directoryPane = Selector('.directory');
2616
2617fixture `My Fixture`
2618 .page `https://example.com/`;
2619
2620test('My Test', async t => {
2621 await t
2622 .dragToElement(fileIcon, directoryPane, {
2623 offsetX: 10,
2624 offsetY: 10,
2625 destinationOffsetX: 100,
2626 destinationOffsetY: 50,
2627 modifiers: {
2628 shift: true
2629 }
2630 });
2631});
2632```
2633
2634#### :gear: TestCafe exits gracefully when the process is interrupted ([#1378](https://github.com/DevExpress/testcafe/issues/1378))
2635
2636Previously, TestCafe left browsers open when you exited the process by pressing `Ctrl+C` in the terminal.
2637Now TestCafe exits gracefully closing all browsers opened for testing.
2638
2639### Bug Fixes
2640
2641* Tests no longer hang in Nightmare ([#1493](https://github.com/DevExpress/testcafe/issues/1493))
2642* The `focus` event is raised when clicking links with `tabIndex="0"` ([#1803](https://github.com/DevExpress/testcafe/issues/1803))
2643* Headless Chrome processes no longer hang after test runs ([#1826](https://github.com/DevExpress/testcafe/issues/1826))
2644* `setFilesToUpload` no longer throws a `RangeError` on websites that use Angular ([#1731](https://github.com/DevExpress/testcafe/issues/1731))
2645* Fixed a bug where an `iframe` got a wrong origin ([#1753](https://github.com/DevExpress/testcafe/issues/1753))
2646* `document.open` does not throw an error if `document.defaultView` is `null` ([testcafe-hammerhead/#1272](https://github.com/DevExpress/testcafe-hammerhead/issues/1272))
2647* No error is thrown when the handler passed to `addEventListener` is `undefined` ([testcafe-hammerhead/#1251](https://github.com/DevExpress/testcafe-hammerhead/issues/1251))
2648* An error is no longer raised if the processed element is not extendible ([testcafe-hammerhead/#1300](https://github.com/DevExpress/testcafe-hammerhead/issues/1300))
2649* Fixed a bug where an `onclick` handler did not work after click on a `Submit` button ([testcafe-hammerhead/#1291](https://github.com/DevExpress/testcafe-hammerhead/issues/1291))
2650* Images with `style = background-image: url("img.png");` are loaded correctly ([testcafe-hammerhead/#1212](https://github.com/DevExpress/testcafe-hammerhead/issues/1212))
2651* Documents can contain two `ShadowUI` roots ([testcafe-hammerhead/#1246](https://github.com/DevExpress/testcafe-hammerhead/issues/1246))
2652* HTML in an overridden `document.write` function is processed correctly ([testcafe-hammerhead/#1311](https://github.com/DevExpress/testcafe-hammerhead/issues/1311))
2653* Elements processing works for a `documentFragment` as it is added to the DOM ([testcafe-hammerhead/#1334](https://github.com/DevExpress/testcafe-hammerhead/issues/1334))
2654
2655## v0.17.2 (2017-9-6)
2656
2657### Bug Fixes
2658
2659* Taking a screenshot on teamcity agent works correctly ([#1625](https://github.com/DevExpress/testcafe/issues/1625))
2660* It is possible to run tests on remote devices from a docker container ([#1728](https://github.com/DevExpress/testcafe/issues/1728))
2661* TestCafe compiles TypeScript tests correctly if Mocha or Jest typedefs are included in the project ([#1537](https://github.com/DevExpress/testcafe/issues/1537))
2662* Running on remote devices works correctly on MacOS ([#1732](https://github.com/DevExpress/testcafe/issues/1732))
2663* A target directory is checked before creating a screenshot ([#1551](https://github.com/DevExpress/testcafe/issues/1551))
2664* TypeScript definitions allow you to send any objects as `dependencies` for `ClientFunctions` ([#1713](https://github.com/DevExpress/testcafe/issues/1713))
2665* The second `MutationObserver` callback argument is not missed ([testcafe-hammerhead/#1268](https://github.com/DevExpress/testcafe-hammerhead/issues/1268))
2666* Link's `href` property with an unsupported protocol is set correctly ([testcafe-hammerhead/#1276](https://github.com/DevExpress/testcafe-hammerhead/issues/1276))
2667* The `document.documentURI` property is processed correctly in IE ([testcafe-hammerhead/#1270](https://github.com/DevExpress/testcafe-hammerhead/issues/1270))
2668* `JSON.stringify` and `Object.keys` functions work properly for a `MessageEvent` instance ([testcafe-hammerhead/#1277](https://github.com/DevExpress/testcafe-hammerhead/issues/1277))
2669
2670## v0.17.1 (2017-8-17)
2671
2672### Bug Fixes
2673
2674* The `hover` action no longer fails for elements that hide on mouseover ([#1679](https://github.com/DevExpress/testcafe/issues/1679))
2675* SelectText and SelectTextAreaContent TypeScript definitions match the documentation ([#1697](https://github.com/DevExpress/testcafe/issues/1697))
2676* TestCafe finds browsers installed for the current user on Windows ([#1688](https://github.com/DevExpress/testcafe/issues/1688))
2677* TestCafe can resize MS Edge 15 window ([#1517](https://github.com/DevExpress/testcafe/issues/1517))
2678* Google Chrome Canary has a dedicated `chrome-canary` alias ([#1711](https://github.com/DevExpress/testcafe/issues/1711))
2679* Test no longer hangs when `takeScreenshot` is called in headless Chrome Canary on Windows ([#1685](https://github.com/DevExpress/testcafe/issues/1685))
2680* Tests fail if the `uncaughtRejection` exception is raised ([#1473](https://github.com/DevExpress/testcafe/issues/1473))
2681* TypeScript tests run on macOS with no errors ([#1696](https://github.com/DevExpress/testcafe/issues/1696))
2682* The test duration is reported accurately ([#1674](https://github.com/DevExpress/testcafe/issues/1674))
2683* XHR requests with an overridden `setRequestHeader` function returned by the `XhrSandbox.openNativeXhr` method are now handled properly ([testcafe-hammerhead/#1252](https://github.com/DevExpress/testcafe-hammerhead/issues/1252))
2684* HTML in an overridden `document.write` function is now processed correctly ([testcafe-hammerhead/#1218](https://github.com/DevExpress/testcafe-hammerhead/issues/1218))
2685* `Object.assign` is overridden ([testcafe-hammerhead/#1208](https://github.com/DevExpress/testcafe-hammerhead/issues/1208))
2686* Scripts with `async` functions are processed correctly ([testcafe-hammerhead/#1260](https://github.com/DevExpress/testcafe-hammerhead/issues/1260))
2687
2688## v0.17.0 (2017-8-2)
2689
2690### Enhancements
2691
2692#### :gear: Testing Electron applications ([testcafe-browser-provider-electron](https://github.com/DevExpress/testcafe-browser-provider-electron))
2693
2694We have created a browser provider that allows you to test Electron applications with TestCafe.
2695
2696To do this, install the browser provider plugin from npm:
2697
2698```sh
2699npm install testcafe-browser-provider-electron
2700```
2701
2702Create a `.testcafe-electron-rc` file that contains the Electron plugin's configurations.
2703The only required setting here is `mainWindowUrl`. It is a URL (or path) to the main window page that relates to the application's directory.
2704
2705```json
2706{
2707 "mainWindowUrl": "./index.html"
2708}
2709```
2710
2711Place this file in the application root directory.
2712
2713Next, install the Electron module.
2714
2715```sh
2716npm install electron@latest
2717```
2718
2719You can now run tests. Specify the `electron` browser name and the application path
2720when the test launches.
2721
2722```sh
2723testcafe "electron:/home/user/electron-app" "path/to/test/file.js"
2724```
2725
2726```js
2727testCafe
2728 .createRunner()
2729 .src('path/to/test/file.js')
2730 .browsers('electron:/home/user/electron-app')
2731 .run();
2732```
2733
2734Nota that you can also test the Electron app's executable files. See the plugin [readme](https://github.com/DevExpress/testcafe-browser-provider-electron) to learn more about the Electron browser provider.
2735
2736#### :gear: Concurrent test execution ([#1165](https://github.com/DevExpress/testcafe/issues/1165))
2737
2738We have added concurrent test launch. This makes a test batch complete faster.
2739
2740TestCafe launches one instance of each specified browser by default. Tests are run one by one in each of them.
2741
2742Enable *concurrency* and TestCafe launches multiple instances of each browser. It distributes the test batch among them. The tests are run in parallel.
2743
2744To enable concurrency, add `-c`in the command line or use the `runner.concurrency()` API method.
2745Specify the number of instances for each browser.
2746
2747```js
2748testcafe -c 3 chrome tests/test.js
2749```
2750
2751```js
2752var testRunPromise = runner
2753 .src('tests/test.js')
2754 .browsers('chrome')
2755 .concurrency(3)
2756 .run();
2757```
2758
2759See [Concurrent Test Execution](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/concurrent-test-execution.html) for more details.
2760
2761#### :gear: Further improvements in automatic waiting mechanism ([#1521](https://github.com/DevExpress/testcafe/issues/1521))
2762
2763We have enhanced the waiting mechanism behavior in certain scenarios which required `wait` actions.
2764
2765#### :gear: User roles preserve the local storage ([#1454](https://github.com/DevExpress/testcafe/issues/1454))
2766
2767TestCafe now saves the local storage state when switching between roles. You get the same local storage content you left when you switch back.
2768
2769This is useful for testing websites that perform authentication via local storage instead of cookies.
2770
2771### Bug Fixes
2772
2773* Selector's `withAttribute` method supports searching by strict match ([#1548](https://github.com/DevExpress/testcafe/issues/1548]))
2774* Description for the `path` parameter of the `t.takeScreenshot` action has been corrected ([#1515](https://github.com/DevExpress/testcafe/issues/1515))
2775* Local storage is now cleaned appropriately after the test run.([#1546](https://github.com/DevExpress/testcafe/issues/1546))
2776* TestCafe now checks element visibility with a timeout when the target element's `style.top` is negative ([#1185](https://github.com/DevExpress/testcafe/issues/1185))
2777* Fetching an absolute CORS URL now works correctly. ([#1629](https://github.com/DevExpress/testcafe/issues/1629))
2778* Add partial support for proxying live node collections (the `GetElementsByTagName` method) ([#1442](https://github.com/DevExpress/testcafe/issues/1442))
2779* TypeScript performance has been enhanced. ([#1591](https://github.com/DevExpress/testcafe/issues/1591))
2780* The right port is now applied to a cross-domain iframe location after redirect. ([testcafe-hammerhead/#1191](https://github.com/DevExpress/testcafe-hammerhead/issues/1191))
2781* All internal properties are marked as non-enumerable. ([testcafe-hammerhead/#1182](https://github.com/DevExpress/testcafe-hammerhead/issues/1182))
2782* Support proxying pages with defined referrer policy. ([testcafe-hammerhead/#1195](https://github.com/DevExpress/testcafe-hammerhead/issues/1195))
2783* WebWorker content is now correctly proxied in FireFox 54. ([testcafe-hammerhead/#1216](https://github.com/DevExpress/testcafe-hammerhead/issues/1216))
2784* Code instrumentation for the `document.activeElement` property works properly if it is `null`. ([testcafe-hammerhead/#1226](https://github.com/DevExpress/testcafe-hammerhead/issues/1226))
2785* `length`, `item` and `namedItem` are no longer own properties of `LiveNodeListWrapper`. ([testcafe-hammerhead/#1222](https://github.com/DevExpress/testcafe-hammerhead/issues/1222))
2786* The `scope` option in the `serviceWorker.register` function is processed correctly. ([testcafe-hammerhead/#1233](https://github.com/DevExpress/testcafe-hammerhead/issues/1233))
2787* Promises from a fetch request are now processed correctly. ([testcafe-hammerhead/#1234](https://github.com/DevExpress/testcafe-hammerhead/issues/1234))
2788* Fix transpiling for the `for..of` loop to support browsers without `window.Iterator`. ([testcafe-hammerhead/#1231](https://github.com/DevExpress/testcafe-hammerhead/issues/1231))
2789
2790## v0.16.2 (2017-6-27)
2791
2792### Bug Fixes
2793
2794* Typing text now raises the `onChange` event in latest React versions. ([#1558](https://github.com/DevExpress/testcafe/issues/1558))
2795* Screenshots can now be taken when TestCafe runs from the Docker image. ([#1540](https://github.com/DevExpress/testcafe/issues/1540))
2796* The native `value` property setters of `HTMLInputElement` and `HTMLTextAreaElement` prototypes are now saved. ([testcafe-hammerhead/#1185](https://github.com/DevExpress/testcafe-hammerhead/issues/1185))
2797* The `name` and `namedItem` methods of an `HTMLCollection` are now marked as non-enumerable. ([testcafe-hammerhead/#1172](https://github.com/DevExpress/testcafe-hammerhead/issues/1172))
2798* Code instrumentation of the `length` property runs faster. ([testcafe-hammerhead/#979](https://github.com/DevExpress/testcafe-hammerhead/issues/979))
2799
2800## v0.16.1 (2017-6-21)
2801
2802### Bug Fixes
2803
2804* A typo in RoleOptions typedefs was fixed ([#1541](https://github.com/DevExpress/testcafe/issues/1541))
2805* TestCafe no longer crashes on node 4 with an unmet dependency ([#1547](https://github.com/DevExpress/testcafe/issues/1547))
2806* Markup imported via `meta[rel="import"]` is now processed. ([testcafe-hammerhead/#1161](https://github.com/DevExpress/testcafe-hammerhead/issues/1161))
2807* The correct context is passed to `MutationObserver`. ([testcafe-hammerhead/#1178](https://github.com/DevExpress/testcafe-hammerhead/issues/1178))
2808* The `innerHtml` property is no longer processed for elements that don't have this property. ([testcafe-hammerhead/#1164](https://github.com/DevExpress/testcafe-hammerhead/issues/1164))
2809
2810## v0.16.0 (2017-6-13)
2811
2812TypeScript support, seamless testing in headless Chrome and device emulator, and numerous bug fixes.
2813
2814### Enhancements
2815
2816#### :gear: TypeScript support ([#408](https://github.com/DevExpress/testcafe/issues/408))
2817
2818In this release, we have added the capability to write tests in [TypeScript](https://www.typescriptlang.org/). By using TypeScript to write your TestCafe tests, you get the advantages of strongly-typed languages such as: rich coding assistance, painless scalability, check-as-you-type code verification, and much more.
2819
2820TestCafe bundles TypeScript declaration file with the npm package, so you have no need to install any additional packages.
2821
2822Just create a `.ts` file with the
2823
2824<!-- Use `js` instead of `ts` for this code block for proper code highlighting -->
2825
2826```js
2827import { Selector } from 'testcafe';
2828```
2829
2830and write your test.
2831
2832For details, see [TypeScript Support](https://devexpress.github.io/testcafe/documentation/test-api/typescript-support.html)
2833
2834#### :gear: Support running in Chrome in headless mode and in device emulator ([#1417](https://github.com/DevExpress/testcafe/issues/1417))
2835
2836Now TestCafe allows you to run your tests in Google Chrome in headless and device emulation modes.
2837
2838[Headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome) allows you to run tests in Chrome without any visible UI shell. To run tests in headless mode, use the `:headless` postfix:
2839
2840```sh
2841testcafe "chrome:headless" tests/sample-fixture.js
2842```
2843
2844Device emulation mode allows you to check how your tests works on mobile devices via Chrome's built-in [device emulator](https://developers.google.com/web/tools/chrome-devtools/device-mode/). To run tests in device emulation mode, specify `emulation:` and [device parameters](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browser-support.html#available-chrome-options):
2845
2846```sh
2847testcafe "chrome:emulation:device=iphone 6" tests/sample-fixture.js
2848```
2849
2850For details, see [Using Chrome-specific Features](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browser-support.html#using-chrome-specific-features).
2851
2852#### :gear: Support HTML5 Drag and Drop ([#897](https://github.com/DevExpress/testcafe/issues/897))
2853
2854Starting with this release, TestCafe supports HTML5 drag and drop, so you can test elements with the `draggable` [attribute](http://w3c.github.io/html/editing.html#the-draggable-attribute).
2855
2856#### :gear: Fixed URL for opening remote browsers ([#1476](https://github.com/DevExpress/testcafe/issues/1476))
2857
2858We have simplified the format of links that TestCafe generates when you [run tests on remote browsers](https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browser-support.html#browsers-on-remote-devices).
2859
2860Now, you have no need to type a unique link for each test run, all the links became constant. So, it is easier now to run tests on a remote device repeatedly: you can run them by navigating a link from your browser history.
2861
2862### Bug Fixes
2863
2864* No TestCafe UI on screenshots created during testing ([#1357](https://github.com/DevExpress/testcafe/issues/1357))
2865* `mouseenter` and `mouseleave` events are not triggered during cursor moving ([#1426](https://github.com/DevExpress/testcafe/issues/1426))
2866* The runner's speed option affects the speed of `doubleClick` action ([#1486](https://github.com/DevExpress/testcafe/issues/1486))
2867* Press action shortcuts work wrong if input's value ends with '.' or starts with '-.' ([#1499](https://github.com/DevExpress/testcafe/issues/1499))
2868* A test report has too small line length on Travis ([#1469](https://github.com/DevExpress/testcafe/issues/1469))
2869* Service messages with cookies do not have enough time to come to server before a new page is loaded ([testcafe-hammerhead/#1086](https://github.com/DevExpress/testcafe-hammerhead/issues/1086))
2870* The `window.history.replaceState` function is overridden incorrectly ([testcafe-hammerhead/#1146](https://github.com/DevExpress/testcafe-hammerhead/issues/1146))
2871* Hammerhead crashes if a script file contains a sourcemap comment ([testcafe-hammerhead/#1052](https://github.com/DevExpress/testcafe-hammerhead/issues/1052))
2872* The proxy should override the `DOMParser.parseFromString` method ([testcafe-hammerhead/#1133](https://github.com/DevExpress/testcafe-hammerhead/issues/1133))
2873* The `fetch` method should emulate the native behavior on header merge ([testcafe-hammerhead/#1116](https://github.com/DevExpress/testcafe-hammerhead/issues/1116))
2874* The `EventSource` requests are broken when used via proxy ([testcafe-hammerhead/#1106](https://github.com/DevExpress/testcafe-hammerhead/issues/1106))
2875* The code processing may cause syntax errors in some cases because of wrong `location` property wrapping ([testcafe-hammerhead/#1101](https://github.com/DevExpress/testcafe-hammerhead/issues/1101))
2876* When calling the `fetch` function without parameters, we should return its native result instead of `window.Promise.reject` ([testcafe-hammerhead/#1099](https://github.com/DevExpress/testcafe-hammerhead/issues/1099))
2877* The `querySelector` function is overridden incorrectly ([testcafe-hammerhead/#1131](https://github.com/DevExpress/testcafe-hammerhead/issues/1131))
2878
2879## v0.15.0 (2017-4-26)
2880
2881Plugins for React and Vue.js, TestCafe Docker image, support for Internet access proxies and lots of bug fixes.
2882
2883### Breaking Changes
2884
2885#### New calls to selector's withText method no longer override previous calls
2886
2887We have changed the way the [withText](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#withtext)
2888method behaves when it is called in a chain.
2889
2890```js
2891const el = Selector('div').withText('This is').withText('my element');
2892```
2893
2894In previous versions, this selector searched for a `div` with text `my element` because the second call to `withText` overrode the first one.
2895
2896Now this code returns an element whose text contains both `This is` and `my element` as the second call compounds with the first one.
2897
2898### Enhancements
2899
2900#### :gear: Plugin for testing React apps
2901
2902In this release cycle, we have created a plugin for testing React applications.
2903This plugin allows you to select React components by their names.
2904
2905```js
2906import ReactSelector from 'testcafe-react-selector';
2907
2908const TodoList = ReactSelector('TodoApp TodoList');
2909const itemsCountStatus = ReactSelector('TodoApp div');
2910const itemsCount = ReactSelector('TodoApp div span');
2911```
2912
2913And it enables you to get React component's `state` and `props`.
2914
2915```js
2916import ReactSelector from 'testcafe-react-selector';
2917
2918fixture `TODO list test`
2919 .page('http://localhost:1337');
2920
2921test('Check list item', async t => {
2922 const el = ReactSelector('TodoList');
2923
2924 await t.expect(el.getReact().props.priority).eql('High');
2925 await t.expect(el.getReact().state.isActive).eql(false);
2926});
2927```
2928
2929To learn more, see the [testcafe-react-selectors](https://github.com/DevExpress/testcafe-react-selectors/) repository.
2930
2931#### :gear: Plugin for testing Vue.js apps
2932
2933In addition to the React plugin, we have released a plugin that facilitates testing Vue.js applications.
2934
2935In the same manner, it allows you to select Vue.js components with `VueSelector` selectors.
2936
2937```js
2938import VueSelector from 'testcafe-vue-selectors';
2939
2940const rootVue = VueSelector();
2941const todoInput = VueSelector('todo-input');
2942const todoItem = VueSelector('todo-list todo-item');
2943```
2944
2945These selectors allow you to get Vue component's `props`, `state` and `computed` properties.
2946
2947```js
2948import VueSelector from 'testcafe-vue-selector';
2949
2950fixture `TODO list test`
2951 .page('http://localhost:1337');
2952
2953test('Check list item', async t => {
2954 const todoItem = VueSelector('todo-item');
2955
2956 await t
2957 .expect(todoItem.getVue().props.priority).eql('High')
2958 .expect(todoItem.getVue().state.isActive).eql(false)
2959 .expect(todoItem.getVue().computed.text).eql('Item 1');
2960});
2961```
2962
2963To learn more, see the [testcafe-vue-selectors](https://github.com/DevExpress/testcafe-vue-selectors) repository.
2964
2965#### :gear: TestCafe Docker image ([#1141](https://github.com/DevExpress/testcafe/issues/1141))
2966
2967We have created a Docker image with TestCafe, Chromium and Firefox preinstalled.
2968
2969You no longer need to manually install browsers or the testing framework on your server.
2970Pull the Docker image from the repository and run TestCafe immediately.
2971
2972```sh
2973docker pull testcafe/testcafe
2974docker run -v //user/tests:/tests -it testcafe/testcafe firefox tests/**/*.js
2975```
2976
2977To learn more, see [Using TestCafe Docker Image](https://devexpress.github.io/testcafe/documentation/using-testcafe/installing-testcafe.html#using-testcafe-docker-image)
2978
2979#### :gear: Support for Internet access proxies ([#1206](https://github.com/DevExpress/testcafe/issues/1206))
2980
2981If your local network uses a proxy server to access the Internet, TestCafe can use it reach the external webpages.
2982
2983To specify the proxy server, use a command line option
2984
2985```sh
2986testcafe chrome my-tests/**/*.js --proxy 172.0.10.10:8080
2987```
2988
2989or a method in the API.
2990
2991```js
2992runner.useProxy('username:password@proxy.mycorp.com');
2993```
2994
2995Note that you can pass the credentials with the proxy server host.
2996
2997#### :gear: Debugging mode option ([#1347](https://github.com/DevExpress/testcafe/issues/1347))
2998
2999As an alternative to calling the [t.debug](https://devexpress.github.io/testcafe/documentation/test-api/debugging.html#client-side-debugging) method
3000in test code, you can now specify the `--debug-mode` command line option to pause the test before the first action or assertion.
3001When the test is paused, you can debug in the browser developer tools as well as continue test execution step by step.
3002
3003```sh
3004testcafe chrome my-tests/**/*.js --debug-mode
3005```
3006
3007If you use TestCafe API, provide the `debugMode` option to the `runner.run` method.
3008
3009```js
3010runner.run({ debugMode: true });
3011```
3012
3013#### :gear: Filtering selector's matched set by attribute ([#1346](https://github.com/DevExpress/testcafe/issues/1346))
3014
3015You can now use the `withAttribute` method to select elements that have a particular attribute set to a specific value.
3016You can omit the attribute value to select elements that simply have the specified attribute.
3017
3018```js
3019const el = Selector('div').withAttribute('attributeName', 'value').nth(2);
3020```
3021
3022#### :gear: hasAttribute method added to DOM node state ([#1045](https://github.com/DevExpress/testcafe/issues/1045))
3023
3024For you convenience, the DOM node state object now provides the `hasAttribute` method that allows you to determine if an element has a particular attribute.
3025
3026```js
3027const el = Selector('div.button');
3028
3029t.expect(el.hasAttribute('disabled')).ok();
3030```
3031
3032#### :gear: Redirection when switching between roles ([#1339](https://github.com/DevExpress/testcafe/issues/1339))
3033
3034[User roles](https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html) now provide a `preserveUrl` option
3035that allows you to save the webpage URL to which the browser was redirected after logging in. If you enable this option when creating a role,
3036the browser will be redirected to the saved URL every time you switch to this role.
3037
3038```js
3039const regularUser = Role(url, async t => {
3040 /* authentication code */
3041}, { preserveUrl: true })
3042```
3043
3044### Bug Fixes
3045
3046* Fixed a bug where incorrect call site and callstack were generated for an assertion that failed in a class method ([#1267](https://github.com/DevExpress/testcafe/issues/1267))
3047* Incorrect validation result no longer appears when a test controller is used inside an async function ([#1285](https://github.com/DevExpress/testcafe/issues/1285))
3048* Click on the status panel no longer affects the page state ([#1389](https://github.com/DevExpress/testcafe/issues/1389))
3049* The `input` event is now raised with a correct selection value when input value was changed ([#1388](https://github.com/DevExpress/testcafe/issues/1388))
3050* Inline source maps are now placed in transpiled files so that breakpoints work correctly ([#1375](https://github.com/DevExpress/testcafe/issues/1375))
3051* `value` and `selectedIndex` in the `input` event handler for the dropdown element are now valid ([#1366](https://github.com/DevExpress/testcafe/issues/1366))
3052* A `presskey('enter')` call now raises the `click` event on a button element ([#1424](https://github.com/DevExpress/testcafe/issues/1424))
3053* The cursor position in Monaco editor is now set correctly on the click action ([#1385](https://github.com/DevExpress/testcafe/issues/1385))
3054* `hasScroll` now works correctly if the `body` has absolute positioning ([#1353](https://github.com/DevExpress/testcafe/issues/1353))
3055* Text can now be typed into HTML5 input elements ([#1327](https://github.com/DevExpress/testcafe/issues/1327))
3056* `focusin` and `focusout` events are now raised when the browser window is in the background ([testcafe-hammerhead/#1044](https://github.com/DevExpress/testcafe-hammerhead/issues/1044))
3057* `caretPositionFromPoint` and `caretRangeFromPoint` now ignore TestCafe UI elements on the page ([testcafe-hammerhead/#1084](https://github.com/DevExpress/testcafe-hammerhead/issues/1084))
3058* Images created with the `Image` constructor are now loaded through the proxy ([testcafe-hammerhead/#1087](https://github.com/DevExpress/testcafe-hammerhead/issues/1087))
3059* The `innerText` return value is now clear of script and style code ([testcafe-hammerhead/#1079](https://github.com/DevExpress/testcafe-hammerhead/issues/1079))
3060* Non-string values for element's text properties are now converted to `String` ([testcafe-hammerhead/#1091](https://github.com/DevExpress/testcafe-hammerhead/issues/1091))
3061* SVG elements are now processed correctly in IE ([testcafe-hammerhead/#1083](https://github.com/DevExpress/testcafe-hammerhead/issues/1083))
3062
3063## v0.14.0 (2017-3-28)
3064
3065Authentication via user roles, client-side debugging and numerous bug fixes.
3066
3067### Enhancements
3068
3069#### :gear: Authentication via user roles ([#243](https://github.com/DevExpress/testcafe/issues/243))
3070
3071Many test scenarios involve the activity of more than one user. TestCafe addresses these scenarios by providing a convenient way
3072to isolate authentication test actions and apply them easily whenever you need to switch the user account.
3073
3074A piece of logic that logs in a particular user is called a *role*. It is a good practice to create a role for each user account participating in your test.
3075
3076Create roles via the `Role` constructor. You can keep them in a separate helper file.
3077
3078*helper.js*
3079
3080```js
3081import { Role } from 'testcafe';
3082
3083export var regularAccUser = Role('http://example.com/login', async t => {
3084 await t
3085 .typeText('#login', 'TestUser')
3086 .typeText('#password', 'testpass')
3087 .click('#sign-in');
3088});
3089
3090export var facebookAccUser = Role('http://example.com/login', async t => {
3091 await t
3092 .click('#sign-in-with-facebook')
3093 .typeText('#email', 'testuser@mycompany.com')
3094 .typeText('#pass', 'testpass')
3095 .click('#submit');
3096});
3097
3098export var admin = Role('http://example.com/login', async t => {
3099 await t
3100 .typeText('#login', 'Admin')
3101 .typeText('#password', 'adminpass')
3102 .click('#sign-in');
3103});
3104```
3105
3106In test code, use the `t.useRole` method to switch between roles.
3107
3108*test.js*
3109
3110```js
3111import { regularAccUser, admin } from './helper';
3112import { Selector } from 'testcafe';
3113
3114const entry = Selector('#entry');
3115const removeButton = Selector('#remove-entry');
3116
3117fixture `My Fixture`
3118 .page `http://example.com`;
3119
3120test('test that involves two users', async t => {
3121 await t
3122 .useRole(regularAccUser)
3123 .expect(entry.exists).ok()
3124 .expect(removeButton.visible).notOk()
3125 .useRole(admin)
3126 .expect(removeButton.visible).ok()
3127 .click(removeButton)
3128 .expect(entry.exists).notOk()
3129});
3130```
3131
3132To learn more, see [User Roles](https://devexpress.github.io/testcafe/documentation/test-api/authentication/user-roles.html).
3133
3134#### :gear: BrowserStack support
3135
3136We have released the [BrowserStack](https://www.browserstack.com/) browser provider [plugin](https://github.com/DevExpress/testcafe-browser-provider-browserstack).
3137
3138Install this plugin from `npm`.
3139
3140```sh
3141npm install testcafe-browser-provider-browserstack
3142```
3143
3144And save the BrowserStack username and access key to environment variables `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY`.
3145
3146Now you can run tests on any virtual machine available on BrowserStack.
3147
3148```sh
3149testcafe "browserstack:Chrome@53.0:Windows 10" "path/to/test/file.js"
3150```
3151
3152#### :gear: Client-side debugging ([#918](https://github.com/DevExpress/testcafe/issues/918))
3153
3154We have added a new `t.debug` method to debug test behavior on the client.
3155
3156When test execution reaches `t.debug`, it pauses so that you can open browser's developer tools
3157and check the web page state, DOM elements location, their CSS styles.
3158
3159```js
3160fixture `My fixture`
3161 .page `https://devexpress.github.io/testcafe/example`;
3162
3163test('My test', async t => {
3164 await t
3165 .debug()
3166 .setNativeDialogHandler(() => true)
3167 .click('#populate')
3168 .click('#submit-button');
3169});
3170```
3171
3172In the footer, you'll find buttons that allow you to continue test execution or step to the next test action.
3173
3174![Page Footer in the Debug Mode](media/client-debugging-footer.png)
3175
3176TestCafe logs points in code where the debugger stopped.
3177
3178![Logging Debugger Breakpoints](media/log-debugger.png)
3179
3180#### :gear: Testing local webpages ([#1286](https://github.com/DevExpress/testcafe/issues/1286))
3181
3182You can now run tests against local webpages. To do this, specify a URL with the `file://` scheme or a relative path when calling the [page](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#specifying-the-start-webpage) function.
3183
3184```js
3185fixture `MyFixture`
3186 .page `file:///user/my-website/index.html`;
3187```
3188
3189```js
3190fixture `MyFixture`
3191 .page `../my-project/index.html`;
3192```
3193
3194You can also navigate to local pages with the [t.navigateTo](https://devexpress.github.io/testcafe/documentation/test-api/actions/navigate.html) action.
3195
3196```js
3197fixture `My fixture`
3198 .page `http://www.example.com/`;
3199
3200test('Navigate to local pages', async t => {
3201 await t
3202 .navigateTo('file:///user/my-website/index.html')
3203 .navigateTo('../my-project/index.html');
3204});
3205```
3206
3207#### :gear: Adding custom methods to the selector ([#1212](https://github.com/DevExpress/testcafe/issues/1212))
3208
3209You can now extend selectors with custom methods executed on the client. Use the [addCustomMethods](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#custom-methods) method to provide custom methods.
3210
3211```js
3212const myTable = Selector('.my-table').addCustomMethods({
3213 getCellText: (table, rowIndex, columnIndex) =>
3214 table.rows[rowIndex].cells[columnIndex].innerText
3215});
3216
3217await t.expect(myTable.getCellText(1, 1)).contains('hey!');
3218```
3219
3220Use this feature to build selectors that reflect the specifics of your web app.
3221
3222#### :gear: Removing the native dialog handler ([#243](https://github.com/DevExpress/testcafe/issues/243))
3223
3224We have added the capability to remove a [native dialog handler](https://devexpress.github.io/testcafe/documentation/test-api/handling-native-dialogs.html) by passing `null` to the `t.setNativeDialogHandler` method.
3225
3226```js
3227fixture `My fixture`
3228 .page `https://devexpress.github.io/testcafe/example`;
3229
3230test('My test', async t => {
3231 await t
3232 .setNativeDialogHandler(() => true)
3233 .click('#populate')
3234 .setNativeDialogHandler(null)
3235 .click('#submit-button');
3236});
3237```
3238
3239### Bug Fixes
3240
3241* Fixed a bug that led to an incorrect callstack in test run report ([#1226](https://github.com/DevExpress/testcafe/issues/1226))
3242* Cursor is now hidden on screenshots created using the `t.takeScreenshot` action ([#1245](https://github.com/DevExpress/testcafe/issues/1245))
3243* Error no longer appears when selecting a non-existent child by index ([#1240](https://github.com/DevExpress/testcafe/issues/1240))
3244* The blur event is now raised on time when an input is hidden in IE ([#1275](https://github.com/DevExpress/testcafe/issues/1275))
3245* TestCafe no longer fails if a client function argument contains ES6 class method syntax ([#1279](https://github.com/DevExpress/testcafe/issues/1279))
3246* TestCafe now reports errors that occur during browser provider initialization ([#1282](https://github.com/DevExpress/testcafe/issues/1282))
3247* Click on the debugger panel no longer affects the tested page ([#1200](https://github.com/DevExpress/testcafe/issues/1200))
3248* An unhandled error no longer occurs when running a fixture without tests ([#1302](https://github.com/DevExpress/testcafe/issues/1302))
3249* The `input` event is now raised when the value of a `select` element is changed ([#1311](https://github.com/DevExpress/testcafe/issues/1311))
3250* You can now perform actions with ShadowDOM elements ([#1312](https://github.com/DevExpress/testcafe/issues/1312))
3251* Server no longer responds with status 222 when window.fetch() is called in Chrome ([#1134](https://github.com/DevExpress/testcafe/issues/1134))
3252* The JSON reporter no longer returns `screenshotPath: null` if a screenshot path is not specified ([#1269](https://github.com/DevExpress/testcafe/issues/1269))
3253* The `navigateTo` action no longer fails silently with schemes like `http*string*://` ([#965](https://github.com/DevExpress/testcafe/issues/965))
3254* The SVG `use` tag is no longer broken when the parent page has a `file://` URL ([testcafe-hammerhead/#1051](https://github.com/DevExpress/testcafe-hammerhead/issues/1051))
3255* Fixed a bug where `toString` was used instead of `instanceToString` from DOM utils ([testcafe-hammerhead/#1055](https://github.com/DevExpress/testcafe-hammerhead/issues/1055))
3256* File download is no longer raised if the resource is fetched by setting the script src ([testcafe-hammerhead/#1062](https://github.com/DevExpress/testcafe-hammerhead/issues/1062))
3257* Fixed wrong CORS emulation for `fetch` requests ([testcafe-hammerhead/#1059](https://github.com/DevExpress/testcafe-hammerhead/issues/1059))
3258* `Navigator.sendBeacon` function is now overridden ([testcafe-hammerhead/#1035](https://github.com/DevExpress/testcafe-hammerhead/issues/1035))
3259
3260## v0.13.0 (2017-2-16)
3261
3262IDE plugins, fixture hooks, `speed` option for test actions, a couple of API enhancements and lots of bug fixes.
3263
3264### Enhancements
3265
3266#### :gear: IDE Plugins
3267
3268With this release, we have prepared test runner plugins for
3269[VSCode](https://github.com/romanresh/vscode-testcafe) and [SublimeText](https://github.com/churkin/testcafe-sublimetext).
3270These plugins allow you to
3271
3272* Run a particular test, fixture, all tests in a file or directory via the context menu or built-in commands,
3273* Automatically detect browsers installed on the local machine,
3274* Repeat last test run,
3275* Debug tests,
3276* View test results in the `Debug Console` panel.
3277
3278#### :gear: Fixture hooks ([#903](https://github.com/DevExpress/testcafe/issues/903))
3279
3280You can now specify fixture hooks that will be executed before the first test in a fixture is started and after the last test is finished.
3281
3282```js
3283fixture `My fixture`
3284 .page `http://example.com`
3285 .before( async ctx => {
3286 /* fixture initialization code */
3287 })
3288 .after( async ctx => {
3289 /* fixture finalization code */
3290 });
3291```
3292
3293Unlike test hooks, fixture hooks are executed between test runs and do not have access to the tested page.
3294Use them to perform server-side operations like preparing the server that hosts the tested app.
3295
3296##### Sharing variables between fixture hooks and test code
3297
3298Use the `ctx` parameter passed to `fixture.before` and `fixture.after` methods (*fixture context*) to share values and objects with test code.
3299You can assign to `ctx` parameter's properties or add new properties.
3300
3301In test code, use the `t.fixtureCtx` property to access the fixture context.
3302
3303```js
3304fixture `Fixture1`
3305 .before(async ctx => {
3306 ctx.someProp = 123;
3307 })
3308 .after(async ctx => {
3309 console.log(ctx.newProp); // > abc
3310 });
3311
3312test('Test1', async t => {
3313 console.log(t.fixtureCtx.someProp); // > 123
3314});
3315
3316test('Test2', async t => {
3317 t.fixtureCtx.newProp = 'abc';
3318});
3319```
3320
3321#### :gear: Speed option for test actions ([#865](https://github.com/DevExpress/testcafe/issues/865))
3322
3323You can now specify speed for individual test actions using the `speed` option.
3324
3325```js
3326import { Selector } from 'testcafe';
3327
3328const nameInput = Selector('#developer-name');
3329
3330fixture `My Fixture`
3331 .page `http://devexpress.github.io/testcafe/example/`
3332
3333test('My Test', async t => {
3334 await t
3335 .typeText(nameInput, 'Peter')
3336 .typeText(nameInput, ' Parker', { speed: 0.1 });
3337});
3338```
3339
3340If speed is also specified for the whole test, the action speed setting overrides test speed.
3341
3342#### :gear: Setting test speed from test code ([#865](https://github.com/DevExpress/testcafe/issues/865))
3343
3344You can now specify test speed from code using the `t.setTestSpeed` method.
3345
3346```js
3347import { Selector } from 'testcafe';
3348
3349fixture `Test Speed`
3350 .page `http://devexpress.github.io/testcafe/example/`;
3351
3352const nameInput = Selector('#developer-name');
3353
3354test(`Test Speed`, async t => {
3355 await t
3356 .typeText(nameInput, 'Peter')
3357 .setTestSpeed(0.1)
3358 .typeText(nameInput, ' Parker');
3359});
3360```
3361
3362#### :gear: Using test controller outside of test code ([#1166](https://github.com/DevExpress/testcafe/issues/1166))
3363
3364You may sometimes need to call test API from outside of test code. For instance, your [page model](https://devexpress.github.io/testcafe/documentation/recipes/extract-reusable-test-code/use-page-model.html)
3365can contain methods that perform common operations used in many tests, like authentication.
3366
3367```js
3368import { Selector } from 'testcafe';
3369
3370export default class Page {
3371 constructor () {
3372 this.loginInput = Selector('#login');
3373 this.passwordInput = Selector('#password');
3374 this.signInButton = Selector('#sign-in-button');
3375 }
3376 async login (t) {
3377 await t
3378 .typeText(this.loginInput, 'MyLogin')
3379 .typeText(this.passwordInput, 'Pa$$word')
3380 .click(this.signInButton);
3381 }
3382}
3383```
3384
3385In this instance, you need to access the test controller from the page model's `login` method.
3386
3387TestCafe allows you to avoid passing the test controller to the method explicitly.
3388Instead, you can simply import `t` to the page model file.
3389
3390```js
3391import { Selector, t } from 'testcafe';
3392
3393export default class Page {
3394 constructor () {
3395 this.loginInput = Selector('#login');
3396 this.passwordInput = Selector('#password');
3397 this.signInButton = Selector('#sign-in-button');
3398 }
3399 async login () {
3400 await t
3401 .typeText(this.loginInput, 'MyLogin')
3402 .typeText(this.passwordInput, 'Pa$$word')
3403 .click(this.signInButton);
3404 }
3405}
3406```
3407
3408TestCafe will implicitly resolve test context and provide the right test controller.
3409
3410#### :gear: Inserting text with one keystroke with t.typeText action (by [@ericyd](https://github.com/ericyd)) ([#1230](https://github.com/DevExpress/testcafe/issues/1230))
3411
3412The new `paste` option allows you to insert a portion of text with one keystroke, similar to the paste operation.
3413
3414```js
3415import { Selector } from 'testcafe';
3416
3417fixture `My fixture`
3418 .page `http://devexpress.github.io/testcafe/example/`;
3419
3420const nameInput = Selector('#developer-name');
3421
3422test(`My test`, async t => {
3423 await t
3424 .typeText(nameInput, 'Peter')
3425 .typeText(nameInput, ' Parker', { paste: true });
3426});
3427```
3428
3429#### :gear: prevSibling and nextSibling selector's DOM search methods ([#1218](https://github.com/DevExpress/testcafe/issues/1218))
3430
3431The new `prevSibling` and `nextSibling` methods allow you to search among sibling elements that reside before and after the selector's matching elements in the DOM tree.
3432
3433```js
3434Selector('li .active').prevSibling(2);
3435Selector('li').nextSibling('.checked');
3436```
3437
3438#### :gear: Deprecated functionality removed ([#1167](https://github.com/DevExpress/testcafe/issues/1167))
3439
3440The following deprecated members have been removed from the API.
3441
3442* `t.select` method - use `Selector` instead:
3443
3444```js
3445const id = await t.select('.someClass').id;
3446
3447// can be replaced with
3448
3449const id = await Selector('.someClass').id;
3450```
3451
3452* `selectorOptions.index` - use [selector.nth()](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#nth) instead.
3453* `selectorOptions.text` - use [selector.withText()](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#withtext) instead.
3454* `selectorOptions.dependencies` - use [filtering](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#filter-dom-nodes) and [hierarchical](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#search-for-elements-in-the-dom-hierarchy) methods to build combined selectors instead.
3455
3456### Bug Fixes
3457
3458* Fixed a bug where tests failed with a script error ([#1188](https://github.com/DevExpress/testcafe/issues/1188))
3459* Text can now be typed to an input field with type "email" in Firefox ([#1187](https://github.com/DevExpress/testcafe/issues/1187))
3460* `npm install` no longer displays warnings ([#769](https://github.com/DevExpress/testcafe/issues/769))
3461* Dev Tools can now be opened with a keyboard shortcut or right click on macOS ([#1193](https://github.com/DevExpress/testcafe/issues/1193))
3462* A warning no longer appears when using ClientFunction with dependencies ([#1168](https://github.com/DevExpress/testcafe/issues/1168))
3463* Tests can now run against React Storybook ([#1147](https://github.com/DevExpress/testcafe/issues/1147))
3464* Script error is no longer thrown in iOS webviews (Firefox, Chrome of iOS) ([#1189](https://github.com/DevExpress/testcafe/issues/1189))
3465* XhrSandbox.createNativeXHR now works correctly ([testcafe-hammerhead/#1042](https://github.com/DevExpress/testcafe-hammerhead/issues/1042))
3466* Window.prototype is no longer used for NativeMethods initialization ([testcafe-hammerhead/#1040](https://github.com/DevExpress/testcafe-hammerhead/issues/1040))
3467* Functions from the 'vm' module are now overridden on the client ([testcafe-hammerhead/#1029](https://github.com/DevExpress/testcafe-hammerhead/issues/1029))
3468* Input type is now changed while setting the selection range in Firefox ([testcafe-hammerhead/#1025](https://github.com/DevExpress/testcafe-hammerhead/issues/1025))
3469* An iframe with the `about:blank` src can now send `postMessage` ([testcafe-hammerhead/#1026](https://github.com/DevExpress/testcafe-hammerhead/issues/1026))
3470* The `formaction` attribute is now overridden correctly after it is appended in DOM ([testcafe-hammerhead/#1021](https://github.com/DevExpress/testcafe-hammerhead/issues/1021))
3471* Fixed a bug where the Authorization Header was wrongly removed ([testcafe-hammerhead/#1016](https://github.com/DevExpress/testcafe-hammerhead/issues/1016))
3472* The `file://` protocol is now supported ([testcafe-hammerhead/#908](https://github.com/DevExpress/testcafe-hammerhead/issues/908))
3473
3474## v0.12.1 (2017-1-20)
3475
3476:racing_car: A recovery release following [v0.12.0](#v0120-2017-1-19) with an important fix. :racing_car:
3477
3478### Bug Fixes
3479
3480* Fixed a bug when the cursor was not visible while running tests ([#1156](https://github.com/DevExpress/testcafe/issues/1156)).
3481
3482## v0.12.0 (2017-1-19)
3483
3484HTTP authentication support, a CI-friendly way to start and stop the tested app and lots of API enhancements.
3485
3486### Enhancements
3487
3488#### :gear: HTTP authentication support ([#955](https://github.com/DevExpress/testcafe/issues/955), [#1109](https://github.com/DevExpress/testcafe/issues/1109))
3489
3490TestCafe now supports testing webpages protected with HTTP Basic and NTLM authentication.
3491
3492Use the [httpAuth](https://devexpress.github.io/testcafe/documentation/test-api/http-authentication.html) function in fixture or test declaration to specify the credentials.
3493
3494```js
3495fixture `My fixture`
3496 .page `http://example.com`
3497 .httpAuth({
3498 username: 'username',
3499 password: 'Pa$$word',
3500
3501 // Optional parameters, can be required for the NTLM authentication.
3502 domain: 'CORP-DOMAIN',
3503 workstation: 'machine-win10'
3504 });
3505
3506test('Test1', async t => {}); // Logs in as username
3507
3508test // Logs in as differentUserName
3509 .httpAuth({
3510 username: 'differentUserName',
3511 password: 'differentPa$$word'
3512 })
3513 ('Test2', async t => {});
3514```
3515
3516#### :gear: Built-in CI-friendly way to start and stop the tested web app ([#1047](https://github.com/DevExpress/testcafe/issues/1047))
3517
3518When launching tests, you can now specify a command that starts the tested application.
3519TestCafe will automatically execute this command before running tests and stop the process when tests are finished.
3520
3521```sh
3522testcafe chrome tests/ --app "node server.js"
3523```
3524
3525```js
3526runner
3527 .startApp('node server.js')
3528 .run();
3529```
3530
3531You can also specify how long TestCafe should wait until the tested application initializes (the default is 1 sec).
3532
3533```sh
3534testcafe chrome tests/ --app "node server.js" --app-init-delay 4000
3535```
3536
3537```js
3538runner
3539 .startApp('node server.js', 4000)
3540 .run();
3541```
3542
3543#### :gear: Screenshot and window resize actions now work on Linux ([#1117](https://github.com/DevExpress/testcafe/issues/1117))
3544
3545The `t.takeScreenshot`, `t.resizeWindow`, `t.resizeWindowToFitDevice` and `t.maximizeWindow` actions can now be executed on Linux machines.
3546
3547#### :gear: Adding custom properties to the element state ([#749](https://github.com/DevExpress/testcafe/issues/749))
3548
3549The state of webpage elements can now be extended with custom properties.
3550
3551We have added the [addCust.htmlOMProperties](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#adding-custom-properties-to-element-state)
3552method to the selector, so that you can add properties to the element state like in the following example.
3553
3554```js
3555import { Selector } from 'testcafe'
3556
3557fixture `My fixture`
3558 .page `https://devexpress.github.io/testcafe/example/`;
3559
3560test('Check Label HTML', async t => {
3561 const label = Selector('label').addCust.htmlOMProperties({
3562 innerHTML: el => el.innerHTML
3563 });
3564
3565 await t.expect(label.innerHTML).contains('input type="checkbox" name="remote"');
3566});
3567```
3568
3569#### :gear: Skipping tests ([#246](https://github.com/DevExpress/testcafe/issues/246))
3570
3571TestCafe now allows you to specify that a particular test or fixture should be skipped when running tests.
3572Use the `fixture.skip` and `test.skip` methods for this.
3573
3574```js
3575fixture.skip `Fixture1`; // All tests in this fixture will be skipped
3576
3577test('Fixture1Test1', () => {});
3578test('Fixture1Test2', () => {});
3579
3580fixture `Fixture2`;
3581
3582test('Fixture2Test1', () => {});
3583test.skip('Fixture2Test2', () => {}); // This test will be skipped
3584test('Fixture2Test3', () => {});
3585```
3586
3587You can also use the `only` method to specify that only a particular test or fixture should run while all others should be skipped.
3588
3589```js
3590fixture.only `Fixture1`;
3591test('Fixture1Test1', () => {});
3592test('Fixture1Test2', () => {});
3593
3594fixture `Fixture2`;
3595test('Fixture2Test1', () => {});
3596test.only('Fixture2Test2', () => {});
3597test('Fixture2Test3', () => {});
3598
3599// Only tests in Fixture1 and the Fixture2Test2 test will run
3600```
3601
3602#### :gear: Specifying the start webpage for a test ([#501](https://github.com/DevExpress/testcafe/issues/501))
3603
3604An individual test can now override the fixture's `page` setting and start on a different page.
3605
3606 ```js
3607 fixture `MyFixture`
3608 .page `http://devexpress.github.io/testcafe/example`;
3609
3610 test('Test1', async t => {
3611 // Starts at http://devexpress.github.io/testcafe/example
3612 });
3613
3614 test
3615 .page `http://devexpress.github.io/testcafe/blog/`
3616 ('Test2', async t => {
3617 // Starts at http://devexpress.github.io/testcafe/blog/
3618 });
3619 ```
3620
3621#### :gear: Initialization and finalization methods for a test ([#1108](https://github.com/DevExpress/testcafe/issues/1108))
3622
3623We have added the [before](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#initialization-and-clean-up)
3624and [after](https://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#initialization-and-clean-up) methods to the test declaration.
3625Use them to provide code that will be executed before a test is started and after it is finished.
3626
3627```js
3628test
3629 .before( async t => {
3630 /* test initialization code */
3631 })
3632 ('My Test', async t => {
3633 /* test code */
3634 })
3635 .after( async t => {
3636 /* test finalization code */
3637 });
3638```
3639
3640#### :gear: Sharing variables between hooks and test code ([#841](https://github.com/DevExpress/testcafe/issues/841))
3641
3642You can now share variables between `fixture.beforeEach`, `fixture.afterEach`, `test.before`, `test.after` functions and test code
3643by using the *test context* object.
3644
3645Test context is available through the `t.ctx` property.
3646
3647Instead of using a global variable, assign the object you want to share directly to `t.ctx` or create a property like in the following example.
3648
3649```js
3650fixture `Fixture1`
3651 .beforeEach(async t => {
3652 t.ctx.someProp = 123;
3653 });
3654
3655test
3656 ('Test1', async t => {
3657 console.log(t.ctx.someProp); // > 123
3658 })
3659 .after(async t => {
3660 console.log(t.ctx.someProp); // > 123
3661 });
3662```
3663
3664#### :gear: Assertion methods to check for regexp match ([#1038](https://github.com/DevExpress/testcafe/issues/1038))
3665
3666We have added `match` and `notMatch` methods to check if a string matches a particular regular expression.
3667
3668```js
3669await t.expect('foobar').match(/^f/, 'this assertion passes');
3670```
3671
3672```js
3673await t.expect('foobar').notMatch(/^b/, 'this assertion passes');
3674```
3675
3676#### :gear: Improved filtering by predicates in selectors ([#1025](https://github.com/DevExpress/testcafe/issues/1025) and [#1065](https://github.com/DevExpress/testcafe/issues/1065))
3677
3678Selector's filter predicates now receive more information about the current node, which enables you to implement more advanced filtering logic.
3679
3680The `filter`, `find`, `parent`, `child` and `sibling` methods now pass the node's index to the predicate.
3681The `find`, `parent`, `child` and `sibling` methods now also pass a node from the preceding selector.
3682
3683```js
3684Selector('ul').find((node, idx, originNode) => {
3685 // node === the <ul>'s descendant node
3686 // idx === index of the current <ul>'s descendant node
3687 // originNode === the <ul> element
3688});
3689```
3690
3691In addition, all these methods now allow you to pass objects to the predicate's scope on the client. To this end, we have added
3692an optional `dependencies` parameter.
3693
3694```js
3695const isNodeOk = ClientFunction(node => { /*...*/ });
3696const flag = getFlag();
3697
3698Selector('ul').child(node => {
3699 return isNodeOk(node) && flag;
3700}, { isNodeOk, flag });
3701```
3702
3703#### :gear: Filtering by negative index in selectors ([#738](https://github.com/DevExpress/testcafe/issues/738))
3704
3705You can now pass negative `index` values to selector methods. In this instance, index is counted from the end of the matched set.
3706
3707```js
3708const lastChild = Selector('.someClass').child(-1);
3709```
3710
3711#### :gear: Improved cursor positioning in test actions ([#981](https://github.com/DevExpress/testcafe/issues/981))
3712
3713In action options, X and Y offsets that define the point where action is performed can now be negative.
3714In this instance, the cursor position is calculated from the bottom-right corner of the target element.
3715
3716```js
3717await t.click('#element', { offsetX: -10, offsetY: -30 });
3718```
3719
3720#### :gear: Client functions as an assertion's actual value ([#1009](https://github.com/DevExpress/testcafe/issues/1009))
3721
3722You can now pass client functions to assertion's `expect` method. In this instance, the
3723[Smart Assertion Query Mechanism](https://devexpress.github.io/testcafe/documentation/test-api/assertions/#smart-assertion-query-mechanism)
3724will run this client function and use the return value as the assertion's actual value.
3725
3726```js
3727import { ClientFunction } from 'testcafe';
3728
3729const windowLocation = ClientFunction(() => window.location.toString());
3730
3731fixture `My Fixture`
3732 .page `http://www.example.com`;
3733
3734test('My Test', async t => {
3735 await t.expect(windowLocation()).eql('http://www.example.com');
3736});
3737```
3738
3739#### :gear: Automatic waiting for scripts added during a test action ([#1072](https://github.com/DevExpress/testcafe/issues/1072))
3740
3741If a test action adds scripts on a page, TestCafe now automatically waits for them to finish before proceeding to the next test action.
3742
3743#### :gear: New ESLint plugin ([#1083](https://github.com/DevExpress/testcafe/issues/1083))
3744
3745We have prepared an [ESLint plugin](https://github.com/miherlosev/eslint-plugin-testcafe).
3746Get it to ensure that ESLint does not fail on TestCafe test code.
3747
3748### Bug Fixes
3749
3750* Remote browser connection timeout has been increased ([#1078](https://github.com/DevExpress/testcafe/issues/1078))
3751* You can now run tests located in directories with a large number of files ([#1090](https://github.com/DevExpress/testcafe/issues/1090))
3752* Key identifiers for all keys are now passed to key events ([#1079](https://github.com/DevExpress/testcafe/issues/1079))
3753* Touch events are no longer emulated for touch monitors ([#984](https://github.com/DevExpress/testcafe/issues/984))
3754* v8 flags can now be passed to Node.js when using TestCafe from the command line ([#1006](https://github.com/DevExpress/testcafe/issues/1006))
3755* ShadowUI root is now hidden for `elementFromPoint` in an iframe in IE ([#1029](https://github.com/DevExpress/testcafe/issues/1029))
3756* Preventing the form submit event no longer leads to additional delay between actions ([#1115](https://github.com/DevExpress/testcafe/issues/1115))
3757* TestCafe no longer hangs when a cursor is moved out of a reloading iframe ([#1140](https://github.com/DevExpress/testcafe/issues/1140))
3758* Onclick event handler is now executed correctly during click automation in specific cases ([#1138](https://github.com/DevExpress/testcafe/issues/1138))
3759* The `application/pdf` mime type is no longer recognized as a page ([testcafe-hammerhead#1014](https://github.com/DevExpress/testcafe-hammerhead/issues/1014))
3760* Limited support for the `frameset` tag is implemented ([testcafe-hammerhead#1009](https://github.com/DevExpress/testcafe-hammerhead/issues/1009))
3761* `Function.prototype.toString` is now proxied correctly when it is overridden in a user script ([testcafe-hammerhead#999](https://github.com/DevExpress/testcafe-hammerhead/issues/999))
3762* Script processing no longer hangs on chained assignments ([testcafe-hammerhead#866](https://github.com/DevExpress/testcafe-hammerhead/issues/866))
3763* `formaction` attribute is now processed ([testcafe-hammerhead#988](https://github.com/DevExpress/testcafe-hammerhead/issues/988))
3764* `document.styleSheets` is now overridden ([testcafe-hammerhead#1000](https://github.com/DevExpress/testcafe-hammerhead/issues/1000))
3765* `href` attribute is now processed correctly in an iframe without src when it is set from the main window ([testcafe-hammerhead#620](https://github.com/DevExpress/testcafe-hammerhead/issues/620))
3766* Cookies without a key are now set correctly ([testcafe-hammerhead#899](https://github.com/DevExpress/testcafe-hammerhead/issues/899))
3767* The `noscript` tag is now processed correctly when it was added via `innerHTML` ([testcafe-hammerhead#987](https://github.com/DevExpress/testcafe-hammerhead/issues/987))
3768* `Element.insertAdjacentHTML` function is now overridden in IE ([testcafe-hammerhead#954](https://github.com/DevExpress/testcafe-hammerhead/issues/954))
3769* Browser behavior is now emulated correctly when the cookie size is bigger than the browser limit ([testcafe-hammerhead#767](https://github.com/DevExpress/testcafe-hammerhead/issues/767))
3770
3771## v0.11.1 (2016-12-8)
3772
3773:racing_car: A quick follow-up for the [v0.11.0](#v0110-2016-12-8) with important fix for Firefox users. :racing_car:
3774
3775### Bug Fixes
3776
3777* Firefox now launches successfully if TestCafe installation directory contains whitespaces ([#1042](https://github.com/DevExpress/testcafe/issues/1042)).
3778
3779## v0.11.0 (2016-12-8)
3780
3781### Enhancements
3782
3783#### :gear: Redesigned selector system. ([#798](https://github.com/DevExpress/testcafe/issues/798))
3784
3785##### New selector methods
3786
3787Multiple [filtering](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#filter-multiple-dom-nodes) and [hierarchical](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#find-elements-by-dom-hierarchy) methods were introduced for selectors.
3788Now you can build flexible, lazily-evaluated functional-style selector chains.
3789
3790*Here are some examples:*
3791
3792```js
3793Selector('ul').find('label').parent('div.someClass')
3794```
3795
3796Finds all `ul` elements on page. Then, in each found `ul` element finds `label` elements.
3797Then, for each `label` element finds a parent that matches the `div.someClass` selector.
3798
3799------
3800
3801Like in jQuery, if you request a [property](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/dom-node-state.html#members-common-across-all-nodes) of the matched set or try evaluate
3802a [snapshot](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#dom-node-state), the selector returns values for the first element in the set.
3803
3804```js
3805// Returns id of the first element in the set
3806const id = await Selector('ul').find('label').parent('div.someClass').id;
3807
3808// Returns snapshot for the first element in the set
3809const snapshot = await Selector('ul').find('label').parent('div.someClass')();
3810```
3811
3812------
3813
3814However, you can obtain data for any element in the set by using `nth` filter.
3815
3816```js
3817// Returns id of the third element in the set
3818const id = await Selector('ul').find('label').parent('div.someClass').nth(2).id;
3819
3820// Returns snapshot for the fourth element in the set
3821const snapshot = await Selector('ul').find('label').parent('div.someClass').nth(4)();
3822```
3823
3824------
3825
3826Note that you can add text and index filters in the selector chain.
3827
3828```js
3829Selector('.container').parent(1).nth(0).find('.content').withText('yo!').child('span');
3830```
3831
3832In this example the selector:
3833
38341. finds the second parent (parent of parent) of `.container` elements;
38352. peeks the first element in the matched set;
38363. in that element, finds elements that match the `.content` selector;
38374. filters them by text `yo!`;
38385. in each filtered element, searches for a child with tag name `span`.
3839
3840------
3841
3842##### Getting selector matched set length
3843
3844Also, now you can get selector matched set length and check matching elements existence by using selector [`count` and `exists` properties](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#get-selector-matching-set-length).
3845
3846##### Unawaited parametrized selector calls now allowed outside test context
3847
3848Previously selector call outside of text context thrown an error:
3849
3850```js
3851const selector = Selector(arg => /* selector code */);
3852
3853selector('someArg'); // <-- throws
3854
3855test ('Some test', async t=> {
3856...
3857});
3858```
3859
3860Now it's not a case if selector is not awaited. It's useful when you need to build a page model outside the test context:
3861
3862```js
3863const selector = Selector(arg => /* selector code */);
3864const selector2 = selector('someArg').find('span'); // <-- doesn't throw anymore
3865
3866test ('Some test', async t=> {
3867...
3868});
3869```
3870
3871However, once you'll try to obtain element property outside of test context it will throw:
3872
3873```js
3874const selector = Selector(arg => /* selector code */);
3875
3876async getId() {
3877 return await selector('someArg').id; // throws
3878}
3879
3880getId();
3881
3882test ('Some test', async t=> {
3883...
3884});
3885```
3886
3887##### Index filter is not ignored anymore if selector returns single node
3888
3889Previously if selector returned single node `index` was ignored:
3890
3891```js
3892Selector('#someId', { index: 2 } ); // index is ignored and selector returns element with id `someId`
3893```
3894
3895however it's not a case now:
3896
3897```js
3898Selector('#someId').nth(2); // returns `null`, since there is only one element in matched set with id `someId`
3899```
3900
3901##### Deprecated API
3902
3903* [`t.select` method](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#one-time-selection) - use `Selector` instead:
3904
3905```js
3906const id = await t.select('.someClass').id;
3907
3908// can be replaced with
3909
3910const id = await Selector('.someClass').id;
3911```
3912
3913* [selectorOptions.index](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selector-options.html#optionsindex) - use [selector.nth()](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#nth) instead.
3914* [selectorOptions.text](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selector-options.html#optionstext) - use [selector.withText()](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#withtext) instead.
3915* [selectorOptions.dependencies](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selector-options.html#optionsdependencies) - use [filtering](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#filter-multiple-dom-nodes) and [hierarchical](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#find-elements-by-dom-hierarchy) methods to build combined selectors instead.
3916
3917#### :gear: Built-in assertions. ([#998](https://github.com/DevExpress/testcafe/issues/998))
3918
3919TestCafe now ships with [numerous built-in BDD-style assertions](http://devexpress.github.io/testcafe/documentation/test-api/assertions/assertion-api.html).
3920If the TestCafe assertion receives a [Selector's property](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/dom-node-state.html#members-common-across-all-nodes) as an actual value, TestCafe uses the [smart assertion query mechanism](http://devexpress.github.io/testcafe/documentation/test-api/assertions/index.html#smart-assertion-query-mechanism):
3921if an assertion did not passed, the test does not fail immediately. The assertion retries to pass multiple times and each time it re-requests the actual shorthand value. The test fails if the assertion could not complete successfully within a timeout.
3922This approach allows you to create stable tests that lack random errors and decrease the amount of time required to run all your tests due to the lack of extra waitings.
3923
3924*Example page markup:*
3925
3926```html
3927<div id="btn"></div>
3928<script>
3929var btn = document.getElementById('btn');
3930
3931btn.addEventListener(function() {
3932 window.setTimeout(function() {
3933 btn.innerText = 'Loading...';
3934 }, 100);
3935});
3936</script>
3937```
3938
3939*Example test code:*
3940
3941```js
3942test('Button click', async t => {
3943 const btn = Selector('#btn');
3944
3945 await t
3946 .click(btn)
3947 // Regular assertion will fail immediately, but TestCafe retries to run DOM state
3948 // assertions many times until this assertion pass successfully within the timeout.
3949 // The default timeout is 3000 ms.
3950 .expect(btn.textContent).contains('Loading...');
3951});
3952```
3953
3954#### :gear: Added [`selected` and `selectedIndex` DOM node state properties](https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/dom-node-state.html#members-common-across-all-nodes). ([#951](https://github.com/DevExpress/testcafe/issues/951))
3955
3956#### :gear: It's now possible to start browser with arguments. ([#905](https://github.com/DevExpress/testcafe/issues/905))
3957
3958If you need to pass arguments for the specified browser, write them right after browser alias. Surround the browser call and its arguments with quotation marks:
3959
3960```sh
3961testcafe "chrome --start-fullscreen",firefox tests/test.js
3962```
3963
3964See [Starting browser with arguments](https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#starting-browser-with-arguments).
3965
3966### Bug Fixes
3967
3968* Action keyboard events now have `event.key` and `event.keyIdentifier` properties set ([#993](https://github.com/DevExpress/testcafe/issues/993)).
3969* `document.body.nextSibling`, that was broken is some cases previously, now operates properly ([#958](https://github.com/DevExpress/testcafe/issues/958)).
3970* Now it's possible to use `t.setFilesToUpload` and `t.clearUpload` methods with the hidden inputs ([#963](https://github.com/DevExpress/testcafe/issues/963)).
3971* Now test not hangs if object `toString` method uses `this.location` getter ([#953](https://github.com/DevExpress/testcafe/issues/953)).
3972* Touch events now correctly dispatched in latest Chrome versions with touch monitor ([#944](https://github.com/DevExpress/testcafe/issues/944)).
3973* Now test compilation doesn't fail if imported helper contains module re-export (e.g. `export * from './mod'`) ([#969](https://github.com/DevExpress/testcafe/issues/969)).
3974* Actions now scroll to element to make it completely visible (there possible) ([#987](https://github.com/DevExpress/testcafe/issues/987), [#973](https://github.com/DevExpress/testcafe/issues/973)).
3975* Dispatched key events now successfully pass `instanceof` check ([#964](https://github.com/DevExpress/testcafe/issues/964)).
3976* Ember elements doesn't throw `Uncaught TypeError: e.getAttribute is not a function` anymore ([#966](https://github.com/DevExpress/testcafe/issues/966)).
3977* First run wizards now automatically disabled in Chrome in Firefox ([testcafe-browser-tools#102](https://github.com/DevExpress/testcafe-browser-tools/issues/102)).
3978* `<td>` now correctly focused on actions ([testcafe-hammerhead#901](https://github.com/DevExpress/testcafe-hammerhead/issues/901)).
3979* `document.baseURI` now returns correct value ([testcafe-hammerhead#920](https://github.com/DevExpress/testcafe-hammerhead/issues/920)).
3980* `Function.constructor` now returns correct value ([testcafe-hammerhead#913](https://github.com/DevExpress/testcafe-hammerhead/issues/913)).
3981* Setting `location` to the URL hash value doesn't lead to JavaScript error anymore ([testcafe-hammerhead#917](https://github.com/DevExpress/testcafe-hammerhead/issues/917)).
3982* Fixed corruption of `<template>` content ([testcafe-hammerhead#912](https://github.com/DevExpress/testcafe-hammerhead/issues/912)).
3983* Fixed `querySelector` for `href` attribute if value contains URL hash ([testcafe-hammerhead#922](https://github.com/DevExpress/testcafe-hammerhead/issues/922)).
3984* HTTP responses with [Brotli](https://github.com/google/brotli) encoding now processed correctly ([testcafe-hammerhead#900](https://github.com/DevExpress/testcafe-hammerhead/issues/900)).
3985* `Element.attributes` now behaves as a live collection ([testcafe-hammerhead#924](https://github.com/DevExpress/testcafe-hammerhead/issues/924)).
3986* TestCafe doesn't fail with `Error: Can't set headers after they are sent.` error on network errors ([testcafe-hammerhead#937](https://github.com/DevExpress/testcafe-hammerhead/issues/937)).
3987* Element property value setters now return correct value ([testcafe-hammerhead#907](https://github.com/DevExpress/testcafe-hammerhead/issues/907)).
3988* `window.fetch` without parameters now returns rejected promise as expected ([testcafe-hammerhead#939](https://github.com/DevExpress/testcafe-hammerhead/issues/939)).
3989* Hyperlinks created in iframe and added to the top window now have correct URL ([testcafe-hammerhead#564](https://github.com/DevExpress/testcafe-hammerhead/issues/564)).
3990* `autocomplete` attribute now not forced on all elements ([testcafe-hammerhead#955](https://github.com/DevExpress/testcafe-hammerhead/issues/955)).
3991* Cookies set via XHR response now available from client code ([testcafe-hammerhead#905](https://github.com/DevExpress/testcafe-hammerhead/issues/905)).
3992* Fixed client rendering problems caused by incorrect DOM element determination ([testcafe-hammerhead#953](https://github.com/DevExpress/testcafe-hammerhead/issues/953)).
3993
3994## v0.10.0 (2016-11-8)
3995
3996### Enhancements
3997
3998#### :gear: Snapshot API shorthands. ([#771](https://github.com/DevExpress/testcafe/issues/771))
3999
4000 Previously, if you needed to use a single property from the snapshot, you had to introduce two assignments
4001
4002 ```js
4003 const snapshot = await selector();
4004 const nodeType = snapshot.nodeType;
4005 ```
4006
4007 or additional parentheses.
4008
4009 ```js
4010 const nodeType = (await selector()).nodeType;
4011 ```
4012
4013 Now snapshot methods and property getters are exposed by selectors
4014 (and selector promises as well) so that you can write more compact code.
4015
4016 ```js
4017 const nodeType = await selector.nodeType;
4018
4019 // or
4020
4021 const nodeType = await selector('someParam').nodeType;
4022 ```
4023
4024 However, shorthand properties do not allow you to omit parentheses when working with dictionary properties
4025 like `style`, `attributes` or `boundingClientRect`.
4026
4027 ```js
4028 const width = (await selector.style)['width'];
4029 ```
4030
4031 That is why we have also introduced shorthand methods for these dictionaries: `getStyleProperty`, `getAttribute` and `getBoundingClientRectProperty`.
4032
4033 ```js
4034 const width = await selector.getStyleProperty('width');
4035 const id = await selector.getAttribute('id');
4036 const left = await selector.getBoundingClientRectProperty('left');
4037 ```
4038
4039 Finally, we have added the `hasClass` method.
4040
4041 ```js
4042 if (await selector.hasClass('foo')) {
4043 //...
4044 }
4045 ```
4046
4047 See [Snapshot API Shorthands](http://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors.html#obtain-element-state).
4048
4049#### :gear: Improved automatic wait mechanism. ([#245](https://github.com/DevExpress/testcafe/issues/245))
4050
4051 We got rid of unnecessary waiting so that tests now run almost two times faster.
4052
4053 ![Tests running in v0.10.0 vs v0.9.0](https://raw.githubusercontent.com/DevExpress/testcafe/master/media/new-0-10-0-autowait.gif)
4054
4055#### :gear: Test execution speed control. ([#938](https://github.com/DevExpress/testcafe/issues/938))
4056
4057 We have introduced an option that allows you to specify how fast tests run.
4058
4059 By default, tests run at the maximum speed. However, if you need to watch a test running to understand what happens in it,
4060 this speed may seem too fast. In this instance, use the new `speed` option to slow the test down.
4061
4062 This option is available from the command line
4063
4064 ```sh
4065 testcafe chrome my-tests --speed 0.1
4066 ```
4067
4068 and from the API.
4069
4070 ```js
4071 await runner.run({
4072 speed: 0.1
4073 })
4074 ```
4075
4076 You can use factor values between `1` (the fastest, used by default) and `0.01` (the slowest).
4077
4078#### :gear: `t.maximizeWindow` test action. ([#812](https://github.com/DevExpress/testcafe/issues/812))
4079
4080 We have added a test action that maximizes the browser window.
4081
4082 ```js
4083 import { expect } from 'chai';
4084 import { Selector } from 'testcafe';
4085
4086 const menu = Selector('#side-menu');
4087
4088 fixture `My fixture`
4089 .page `http://www.example.com/`;
4090
4091 test('Side menu is displayed in full screen', async t => {
4092 await t.maximizeWindow();
4093
4094 expect(await menu.visible).to.be.ok;
4095 });
4096 ```
4097
4098### Bug Fixes
4099
4100* The `t.resizeWindow` and `t.resizeWindowToFitDevice` actions now work correctly on macOS ([#816](https://github.com/DevExpress/testcafe/issues/816))
4101* Browser aliases are now case insensitive in the command line ([#890](https://github.com/DevExpress/testcafe/issues/890))
4102* Tests no longer hang if target scrolling coordinates are fractional ([#882](https://github.com/DevExpress/testcafe/issues/882))
4103* The 'Element is not visible' error is no longer raised when scrolling a document in Quirks mode ([#883](https://github.com/DevExpress/testcafe/issues/883))
4104* `<table>` child elements are now focused correctly ([#889](https://github.com/DevExpress/testcafe/issues/889))
4105* The page is no longer scrolled to the parent element when focusing on a non-focusable child during click automation ([#913](https://github.com/DevExpress/testcafe/issues/913))
4106* Browser auto-detection now works with all the Linux distributions ([#104](https://github.com/DevExpress/testcafe-browser-tools/issues/104),
4107 [#915](https://github.com/DevExpress/testcafe/issues/915))
4108
4109## v0.9.0 (2016-10-18)
4110
4111:tada: Initial release :tada:
4112
\No newline at end of file