codeceptjs 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +15 -22
  3. package/bin/codecept.js +3 -1
  4. package/docs/advanced.md +1 -1
  5. package/docs/angular.md +6 -9
  6. package/docs/basics.md +388 -86
  7. package/docs/bdd.md +4 -3
  8. package/docs/build/Nightmare.js +3 -0
  9. package/docs/build/Polly.js +26 -12
  10. package/docs/build/Puppeteer.js +14 -13
  11. package/docs/build/TestCafe.js +101 -2
  12. package/docs/build/WebDriver.js +53 -52
  13. package/docs/changelog.md +86 -57
  14. package/docs/detox.md +235 -0
  15. package/docs/helpers/Detox.md +579 -0
  16. package/docs/helpers/Polly.md +13 -3
  17. package/docs/helpers/Puppeteer.md +155 -156
  18. package/docs/helpers/TestCafe.md +53 -0
  19. package/docs/helpers/WebDriver.md +209 -204
  20. package/docs/locators.md +2 -0
  21. package/docs/mobile.md +5 -1
  22. package/docs/puppeteer.md +59 -13
  23. package/docs/quickstart.md +47 -12
  24. package/docs/testcafe.md +157 -0
  25. package/docs/webdriver.md +453 -0
  26. package/lib/command/definitions.js +152 -7
  27. package/lib/command/gherkin/snippets.js +19 -8
  28. package/lib/command/init.js +30 -22
  29. package/lib/command/utils.js +1 -1
  30. package/lib/container.js +36 -10
  31. package/lib/data/dataScenarioConfig.js +18 -0
  32. package/lib/helper/Nightmare.js +3 -0
  33. package/lib/helper/Polly.js +26 -12
  34. package/lib/helper/Puppeteer.js +14 -13
  35. package/lib/helper/TestCafe.js +72 -2
  36. package/lib/helper/WebDriver.js +53 -52
  37. package/lib/helper/testcafe/testcafe-utils.js +3 -2
  38. package/lib/interfaces/scenarioConfig.js +2 -2
  39. package/lib/listener/config.js +2 -2
  40. package/lib/plugin/allure.js +3 -0
  41. package/lib/step.js +5 -2
  42. package/lib/ui.js +1 -1
  43. package/lib/utils.js +13 -21
  44. package/package.json +14 -12
package/docs/changelog.md CHANGED
@@ -3,10 +3,39 @@ id: changelog
3
3
  title: Releases
4
4
  ---
5
5
 
6
+ ## 2.2.1
7
+
8
+ * **[WebDriver]** A [dedicated guide](https://codecept.io/webdriver) written.
9
+ * **[TestCade]** A [dedicated guide](https://codecept.io/testcafe) written.
10
+ * **[Puppeteer]** A [chapter on mocking](https://codecept.io/puppeteer#mocking-requests) written
11
+ * [Puppeteer][Nightmare][TestCafe] Window mode is enabled by default on `codeceptjs init`.
12
+ * **[TestCafe]** Actions implemented by **[hubidu](https://github.com/hubidu)**
13
+ * `grabPageScrollPosition`
14
+ * `scrollPageToTop`
15
+ * `scrollPageToBottom`
16
+ * `scrollTo`
17
+ * `switchTo`
18
+ * Intellisense improvements. Renamed `tsconfig.json` to `jsconfig.json` on init. Fixed autocompletion for Visual Studio Code.
19
+ * **[Polly]** Take configuration values from Puppeteer. Fix [#1766](https://github.com/Codeception/CodeceptJS/issues/1766) by **[VikalpP](https://github.com/VikalpP)**
20
+ * **[Polly]** Add preconditions to check for puppeteer page availability by **[VikalpP](https://github.com/VikalpP)**. Fixes [#1767](https://github.com/Codeception/CodeceptJS/issues/1767)
21
+ * **[WebDriver]** Use filename for `uploadFile` by **[VikalpP](https://github.com/VikalpP)**. See [#1797](https://github.com/Codeception/CodeceptJS/issues/1797)
22
+ * **[Puppeteer]** Configure speed of input with `pressKeyDelay` option. By **[hubidu](https://github.com/hubidu)**
23
+ * Fixed recursive loading of support objects by **[davertmik](https://github.com/davertmik)**.
24
+ * Fixed support object definitions in steps.d.ts by **[johnyb](https://github.com/johnyb)**. Fixes [#1795](https://github.com/Codeception/CodeceptJS/issues/1795)
25
+ * Fixed `Data().Scenario().injectDependencies()` is not a function by **[andrerleao](https://github.com/andrerleao)**
26
+ * Fixed crash when using xScenario & Scenario.skip with tag by **[VikalpP](https://github.com/VikalpP)**. Fixes [#1751](https://github.com/Codeception/CodeceptJS/issues/1751)
27
+ * Dynamic configuration of helpers can be performed with async function. See [#1786](https://github.com/Codeception/CodeceptJS/issues/1786) by **[cviejo](https://github.com/cviejo)**
28
+ * Added TS definitions for internal objects by **[Vorobeyko](https://github.com/Vorobeyko)**
29
+ * BDD improvements:
30
+ * Fix for snippets command with a .feature file that has special characters by **[asselin](https://github.com/asselin)**
31
+ * Fix `--path` option on `gherkin:snippets` command by **[asselin](https://github.com/asselin)**. See [#1790](https://github.com/Codeception/CodeceptJS/issues/1790)
32
+ * Added `--feature` option to `gherkin:snippets` to enable creating snippets for a subset of .feature files. See [#1803](https://github.com/Codeception/CodeceptJS/issues/1803) by **[asselin](https://github.com/asselin)**.
33
+ * Fixed: dynamic configs not reset after test. Fixes [#1776](https://github.com/Codeception/CodeceptJS/issues/1776) by **[cviejo](https://github.com/cviejo)**.
34
+
6
35
  ## 2.2.0
7
36
 
8
37
  * **EXPERIMENTAL** [**TestCafe** helper](https://codecept.io/helpers/TestCafe) introduced. TestCafe allows to run cross-browser tests it its own very fast engine. Supports all browsers including mobile. Thanks to **[hubidu](https://github.com/hubidu)** for implementation! Please test it and send us feedback.
9
- * **[Puppeteer]** Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly)
38
+ * **[Puppeteer]** Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly). Thanks **[VikalpP](https://github.com/VikalpP)**
10
39
 
11
40
  ```js
12
41
  // use Polly & Puppeteer helpers
@@ -14,24 +43,24 @@ I.mockRequest('GET', '/api/users', 200);
14
43
  I.mockRequest('POST', '/users', { user: { name: 'fake' }});
15
44
  ```
16
45
 
17
- * **EXPERIMENTAL** **[Puppeteer]** [Firefox support](https://codecept.io/helpers/Puppeteer-firefox) introduced by **[ngadiyak](https://github.com/ngadiyak)**, see [#1740](https://github.com/Codeception/Codeception/issues/1740)
18
- * **[stepByStepReportPlugin]** use md5 hash to generate reports into unique folder. Fix [#1744](https://github.com/Codeception/Codeception/issues/1744) by **[chimurai](https://github.com/chimurai)**
46
+ * **EXPERIMENTAL** **[Puppeteer]** [Firefox support](https://codecept.io/helpers/Puppeteer-firefox) introduced by **[ngadiyak](https://github.com/ngadiyak)**, see [#1740](https://github.com/Codeception/CodeceptJS/issues/1740)
47
+ * **[stepByStepReportPlugin]** use md5 hash to generate reports into unique folder. Fix [#1744](https://github.com/Codeception/CodeceptJS/issues/1744) by **[chimurai](https://github.com/chimurai)**
19
48
  * Interactive pause improvements:
20
49
  * print result of `grab` commands
21
50
  * print message for successful assertions
22
51
  * `run-multiple` (parallel execution) improvements:
23
- * `bootstrapAll` must be called before creating chunks. [#1741](https://github.com/Codeception/Codeception/issues/1741) by **[Vorobeyko](https://github.com/Vorobeyko)**
24
- * Bugfix: If value in config has falsy value then multiple config does not overwrite original value. [#1756](https://github.com/Codeception/Codeception/issues/1756) by **[LukoyanovE](https://github.com/LukoyanovE)**
52
+ * `bootstrapAll` must be called before creating chunks. [#1741](https://github.com/Codeception/CodeceptJS/issues/1741) by **[Vorobeyko](https://github.com/Vorobeyko)**
53
+ * Bugfix: If value in config has falsy value then multiple config does not overwrite original value. [#1756](https://github.com/Codeception/CodeceptJS/issues/1756) by **[LukoyanovE](https://github.com/LukoyanovE)**
25
54
  * Fixed hooks broken in 2.1.5 by **[Vorobeyko](https://github.com/Vorobeyko)**
26
- * Fix references to support objects when using Dependency Injection. Fix by **[johnyb](https://github.com/johnyb)**. See [#1701](https://github.com/Codeception/Codeception/issues/1701)
27
- * Fix dynamic config applied for multiple helpers by **[VikalpP](https://github.com/VikalpP)** [#1743](https://github.com/Codeception/Codeception/issues/1743)
55
+ * Fix references to support objects when using Dependency Injection. Fix by **[johnyb](https://github.com/johnyb)**. See [#1701](https://github.com/Codeception/CodeceptJS/issues/1701)
56
+ * Fix dynamic config applied for multiple helpers by **[VikalpP](https://github.com/VikalpP)** [#1743](https://github.com/Codeception/CodeceptJS/issues/1743)
28
57
 
29
58
 
30
59
  ## 2.1.5
31
60
 
32
61
  * **EXPERIMENTAL** [Wix Detox support](https://github.com/Codeception/detox-helper) introduced as standalone helper. Provides a faster alternative to Appium for mobile testing.
33
62
  * Saving successful commands inside interactive pause into `_output/cli-history` file. By **[hubidu](https://github.com/hubidu)**
34
- * Fixed hanging error handler inside scenario. See [#1721](https://github.com/Codeception/Codeception/issues/1721) by **[haily-lgc](https://github.com/haily-lgc)**.
63
+ * Fixed hanging error handler inside scenario. See [#1721](https://github.com/Codeception/CodeceptJS/issues/1721) by **[haily-lgc](https://github.com/haily-lgc)**.
35
64
  * Fixed by **[Vorobeyko](https://github.com/Vorobeyko)**: tests did not fail when an exception was raised in async bootstrap.
36
65
  * **[WebDriver]** Added window control methods by **[emmonspired](https://github.com/emmonspired)**
37
66
  * `grabAllWindowHandles` returns all window handles
@@ -193,7 +222,7 @@ Use it with `FileSystem` helper to test availability of a file:
193
222
  * [allure plugin] Add skipped tests to allure reports by **[Vorobeyko](https://github.com/Vorobeyko)**
194
223
  * Fixed `Logged Test name | [object Object]` when used Data().Scenario(). By **[Vorobeyko](https://github.com/Vorobeyko)**
195
224
  * Fixed Data().only.Scenario() to run for all datasets. By **[Vorobeyko](https://github.com/Vorobeyko)**
196
- * **[WebDriver]** `attachFile` to work with hidden elements. Fixed in [#1460](https://github.com/Codeception/Codeception/issues/1460) by **[tsuemura](https://github.com/tsuemura)**
225
+ * **[WebDriver]** `attachFile` to work with hidden elements. Fixed in [#1460](https://github.com/Codeception/CodeceptJS/issues/1460) by **[tsuemura](https://github.com/tsuemura)**
197
226
 
198
227
 
199
228
 
@@ -262,7 +291,7 @@ Use it with `FileSystem` helper to test availability of a file:
262
291
  * **Using `codecept.conf.js` as default configuration format**
263
292
  * Fixed "enametoolong" error when saving screenshots for data driven tests by **[PeterNgTr](https://github.com/PeterNgTr)**
264
293
  * Updated NodeJS to 10 in Docker image
265
- * **[Pupeteer]** Add support to use WSEndpoint. Allows to execute tests remotely. [See [#1350](https://github.com/Codeception/Codeception/issues/1350)] by **[gabrielcaires](https://github.com/gabrielcaires)** (https://github.com/Codeception/CodeceptJS/pull/1350)
294
+ * **[Pupeteer]** Add support to use WSEndpoint. Allows to execute tests remotely. [See [#1350](https://github.com/Codeception/CodeceptJS/issues/1350)] by **[gabrielcaires](https://github.com/gabrielcaires)** (https://github.com/Codeception/CodeceptJS/pull/1350)
266
295
  * In interactive shell **[Enter]** goes to next step. Improvement by **[PeterNgTr](https://github.com/PeterNgTr)**.
267
296
  * `I.say` accepts second parameter as color to print colorful comments. Improvement by **[PeterNgTr](https://github.com/PeterNgTr)**.
268
297
 
@@ -278,12 +307,12 @@ I.say('This is by default'); //cyan is used
278
307
 
279
308
  * **[Puppeteer]** `dragSlider` action added by **[PeterNgTr](https://github.com/PeterNgTr)**
280
309
  * **[Puppeteer]** Fixed opening browser in shell mode by **[allenhwkim](https://github.com/allenhwkim)**
281
- * **[Puppeteer]** Fixed making screenshot on additional sessions by **[PeterNgTr](https://github.com/PeterNgTr)**. Fixes [#1266](https://github.com/Codeception/Codeception/issues/1266)
310
+ * **[Puppeteer]** Fixed making screenshot on additional sessions by **[PeterNgTr](https://github.com/PeterNgTr)**. Fixes [#1266](https://github.com/Codeception/CodeceptJS/issues/1266)
282
311
  * Added `--invert` option to `run-multiple` command by **[LukoyanovE](https://github.com/LukoyanovE)**
283
312
  * Fixed steps in Allure reports by **[PeterNgTr](https://github.com/PeterNgTr)**
284
313
  * Add option `output` to customize output directory in [stepByStepReport plugin](https://codecept.io/plugins/#stepbystepreport). By **[fpsthirty](https://github.com/fpsthirty)**
285
314
  * Changed type definition of PageObjects to get auto completion by **[rhicu](https://github.com/rhicu)**
286
- * Fixed steps output for async/arrow functions in CLI by **[LukoyanovE](https://github.com/LukoyanovE)**. See [#1329](https://github.com/Codeception/Codeception/issues/1329)
315
+ * Fixed steps output for async/arrow functions in CLI by **[LukoyanovE](https://github.com/LukoyanovE)**. See [#1329](https://github.com/Codeception/CodeceptJS/issues/1329)
287
316
 
288
317
  ## 1.4.5
289
318
 
@@ -296,7 +325,7 @@ I.say('This is by default'); //cyan is used
296
325
  ```
297
326
 
298
327
  * **[WebDriverIO]** Fix timeouts definition to be compatible with W3C drivers. By **[LukoyanovE](https://github.com/LukoyanovE)**
299
- * Fixed: exception in Before block w/ Mocha causes test not to report failure. See [#1292](https://github.com/Codeception/Codeception/issues/1292) by **[PeterNgTr](https://github.com/PeterNgTr)**
328
+ * Fixed: exception in Before block w/ Mocha causes test not to report failure. See [#1292](https://github.com/Codeception/CodeceptJS/issues/1292) by **[PeterNgTr](https://github.com/PeterNgTr)**
300
329
  * Command `run-parallel` now accepts `--override` flag. Thanks to **[ClemCB](https://github.com/ClemCB)**
301
330
  * Fixed Allure report with Before/BeforeSuite/After/AfterSuite steps. By **[PeterNgTr](https://github.com/PeterNgTr)**
302
331
  * Added `RUN_MULTIPLE` env variable to [Docker config](https://codecept.io/docker/). Allows to run tests in parallel inside a container. Thanks to **[PeterNgTr](https://github.com/PeterNgTr)**
@@ -327,7 +356,7 @@ Scenario('update user profile', () => {
327
356
 
328
357
  * Fixed attaching Allure screenshot on exception. Fix by **[DevinWatson](https://github.com/DevinWatson)**
329
358
  * Improved type definitions for custom steps. By **[Akxe](https://github.com/Akxe)**
330
- * Fixed setting `multiple.parallel.chunks` as environment variable in config. See [#1238](https://github.com/Codeception/Codeception/issues/1238) by **[ngadiyak](https://github.com/ngadiyak)**
359
+ * Fixed setting `multiple.parallel.chunks` as environment variable in config. See [#1238](https://github.com/Codeception/CodeceptJS/issues/1238) by **[ngadiyak](https://github.com/ngadiyak)**
331
360
 
332
361
  ## 1.4.2
333
362
 
@@ -497,9 +526,9 @@ locate('//table')
497
526
 
498
527
  * [Dynamic configuration](https://codecept.io/advanced/#dynamic-configuration) to update helpers config per test or per suite.
499
528
  * Added `event.test.finished` which fires synchronously for both failed and passed tests.
500
- * [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue[#1600](https://github.com/Codeception/Codeception/issues/1600). You can enabled them with `fullPageScreenshots: true`, however they may work unstable in Selenium.
529
+ * [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue[#1600](https://github.com/Codeception/CodeceptJS/issues/1600). You can enabled them with `fullPageScreenshots: true`, however they may work unstable in Selenium.
501
530
  * `within` blocks can return values. See [updated documentation](https://codecept.io/basics/#within).
502
- * Removed doublt call to `_init` in helpers. Fixes issue [#1036](https://github.com/Codeception/Codeception/issues/1036)
531
+ * Removed doublt call to `_init` in helpers. Fixes issue [#1036](https://github.com/Codeception/CodeceptJS/issues/1036)
503
532
  * Added scenario and feature configuration via fluent API:
504
533
 
505
534
  ```js
@@ -763,7 +792,7 @@ I.dontSee('Email Address');
763
792
  ↑ This element can be located with `~foobar` in WebDriverIO and Appium helpers. Thanks to **[flyskywhy](https://github.com/flyskywhy)**
764
793
 
765
794
  * Allow providing arbitrary objects in config includes by **[rlewan](https://github.com/rlewan)**
766
- * **[REST]** Prevent from mutating default headers by **[alexashley](https://github.com/alexashley)**. See [#789](https://github.com/Codeception/Codeception/issues/789)
795
+ * **[REST]** Prevent from mutating default headers by **[alexashley](https://github.com/alexashley)**. See [#789](https://github.com/Codeception/CodeceptJS/issues/789)
767
796
  * **[REST]** Fixed sending empty helpers with `haveRequestHeaders` in `sendPostRequest`. By **[petrisorionel](https://github.com/petrisorionel)**
768
797
  * Fixed displaying undefined args in output by **[APshenkin](https://github.com/APshenkin)**
769
798
  * Fixed NaN instead of seconds in output by **[APshenkin](https://github.com/APshenkin)**
@@ -775,7 +804,7 @@ I.dontSee('Email Address');
775
804
  ## 1.0.3
776
805
 
777
806
  * [WebDriverIO][Protractor][Nightmare] method `waitUntilExists` implemented by **[sabau](https://github.com/sabau)**
778
- * Absolute path can be set for `output` dir by **[APshenkin](https://github.com/APshenkin)**. Fix [#571](https://github.com/Codeception/Codeception/issues/571)* Data table rows can be ignored by using `xadd`. By **[APhenkin](https://github.com/APhenkin)**
807
+ * Absolute path can be set for `output` dir by **[APshenkin](https://github.com/APshenkin)**. Fix [#571](https://github.com/Codeception/CodeceptJS/issues/571)* Data table rows can be ignored by using `xadd`. By **[APhenkin](https://github.com/APhenkin)**
779
808
  * Added `Data(table).only.Scenario` to give ability to launch only Data tests. By **[APhenkin](https://github.com/APhenkin)**
780
809
  * Implemented `ElementNotFound` error by **[BorisOsipov](https://github.com/BorisOsipov)**.
781
810
  * Added TypeScript compiler / configs to check the JavaScript by **[KennyRules](https://github.com/KennyRules)**
@@ -788,11 +817,11 @@ I.dontSee('Email Address');
788
817
 
789
818
  * Introduced generators support in scenario hooks for `BeforeSuite`/`Before`/`AfterSuite`/`After`
790
819
  * **[ApiDataFactory]** Fixed loading helper; `requireg` package included.
791
- * Fix [#485](https://github.com/Codeception/Codeception/issues/485)`run-multiple`: the first browser-resolution combination was be used in all configurations
820
+ * Fix [#485](https://github.com/Codeception/CodeceptJS/issues/485)`run-multiple`: the first browser-resolution combination was be used in all configurations
792
821
  * Fixed unique test names:
793
- * Fixed [#447](https://github.com/Codeception/Codeception/issues/447) tests failed silently if they have the same name as other tests.
822
+ * Fixed [#447](https://github.com/Codeception/CodeceptJS/issues/447) tests failed silently if they have the same name as other tests.
794
823
  * Use uuid in screenshot names when `uniqueScreenshotNames: true`
795
- * **[Protractor]** Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes [#458](https://github.com/Codeception/Codeception/issues/458)* Added output for steps in hooks when they fail
824
+ * **[Protractor]** Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes [#458](https://github.com/Codeception/CodeceptJS/issues/458)* Added output for steps in hooks when they fail
796
825
 
797
826
  ## 1.0.1
798
827
 
@@ -801,7 +830,7 @@ I.dontSee('Email Address');
801
830
  * Added [Mochawesome](http://codecept.io/helpers/Mochawesome/) helper
802
831
  * `addMochawesomeContext` method to add custom data to mochawesome reports
803
832
  * Fixed Mochawesome context for failed screenshots.
804
- * **[WebDriverIO]** improved click on context to match clickable element with a text inside. Fixes [#647](https://github.com/Codeception/Codeception/issues/647)* **[Nightmare]** Added `refresh` function by **[awhanks](https://github.com/awhanks)**
833
+ * **[WebDriverIO]** improved click on context to match clickable element with a text inside. Fixes [#647](https://github.com/Codeception/CodeceptJS/issues/647)* **[Nightmare]** Added `refresh` function by **[awhanks](https://github.com/awhanks)**
805
834
  * fixed `Unhandled promise rejection (rejection id: 1): Error: Unknown wait type: pageLoad`
806
835
  * support for tests with retries in html report
807
836
  * be sure that change window size and timeouts completes before test
@@ -866,16 +895,16 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
866
895
  * Minimal NodeJS version is 6.11.1 LTS
867
896
  * Use `within` command with generators.
868
897
  * [Data Driven Tests](http://codecept.io/advanced/#data-driven-tests) introduced.
869
- * Print execution time per step in `--debug` mode. [#591](https://github.com/Codeception/Codeception/issues/591) by **[APshenkin](https://github.com/APshenkin)**
898
+ * Print execution time per step in `--debug` mode. [#591](https://github.com/Codeception/CodeceptJS/issues/591) by **[APshenkin](https://github.com/APshenkin)**
870
899
  * [WebDriverIO][Protractor][Nightmare] Added `disableScreenshots` option to disable screenshots on fail by **[Apshenkin](https://github.com/Apshenkin)**
871
900
  * [WebDriverIO][Protractor][Nightmare] Added `uniqueScreenshotNames` option to generate unique names for screenshots on failure by **[Apshenkin](https://github.com/Apshenkin)**
872
901
  * [WebDriverIO][Nightmare] Fixed click on context; `click('text', '#el')` will throw exception if text is not found inside `#el`.
873
902
  * [WebDriverIO][Protractor][SeleniumWebdriver] [SmartWait introduced](http://codecept.io/acceptance/#smartwait).
874
- * [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by **[HughZurname](https://github.com/HughZurname)** [#549](https://github.com/Codeception/Codeception/issues/549)
903
+ * [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by **[HughZurname](https://github.com/HughZurname)** [#549](https://github.com/Codeception/CodeceptJS/issues/549)
875
904
  * **[Appium]** helper introduced by **[APshenkin](https://github.com/APshenkin)**
876
- * **[REST]** helper introduced by **[atrevino](https://github.com/atrevino)** in [#504](https://github.com/Codeception/Codeception/issues/504)
877
- * [WebDriverIO][SeleniumWebdriver] Fixed "windowSize": "maximize" for Chrome 59+ version [#560](https://github.com/Codeception/Codeception/issues/560) by **[APshenkin](https://github.com/APshenkin)**
878
- * **[Nightmare]** Fixed restarting by **[APshenkin](https://github.com/APshenkin)** [#581](https://github.com/Codeception/Codeception/issues/581)
905
+ * **[REST]** helper introduced by **[atrevino](https://github.com/atrevino)** in [#504](https://github.com/Codeception/CodeceptJS/issues/504)
906
+ * [WebDriverIO][SeleniumWebdriver] Fixed "windowSize": "maximize" for Chrome 59+ version [#560](https://github.com/Codeception/CodeceptJS/issues/560) by **[APshenkin](https://github.com/APshenkin)**
907
+ * **[Nightmare]** Fixed restarting by **[APshenkin](https://github.com/APshenkin)** [#581](https://github.com/Codeception/CodeceptJS/issues/581)
879
908
  * **[WebDriverIO]** Methods added by **[APshenkin](https://github.com/APshenkin)**:
880
909
  * [grabCssPropertyFrom](http://codecept.io/helpers/WebDriverIO/#grabcsspropertyfrom)
881
910
  * [seeTitleEquals](http://codecept.io/helpers/WebDriverIO/#seetitleequals)
@@ -895,10 +924,10 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
895
924
  * [scrollPageToBottom](http://codecept.io/helpers/WebDriverIO/#scrollpagetobottom)
896
925
  * [scrollPageToTop](http://codecept.io/helpers/WebDriverIO/#scrollpagetotop)
897
926
  * [grabBrowserLogs](http://codecept.io/helpers/WebDriverIO/#grabbrowserlogs)
898
- * Use mkdirp to create output directory. [#592](https://github.com/Codeception/Codeception/issues/592) by **[vkramskikh](https://github.com/vkramskikh)**
899
- * **[WebDriverIO]** Fixed `seeNumberOfVisibleElements` by **[BorisOsipov](https://github.com/BorisOsipov)** [#574](https://github.com/Codeception/Codeception/issues/574)
900
- * Lots of fixes for promise chain by **[APshenkin](https://github.com/APshenkin)** [#568](https://github.com/Codeception/Codeception/issues/568)
901
- * Fix [#543](https://github.com/Codeception/Codeception/issues/543)- After block not properly executed if Scenario fails
927
+ * Use mkdirp to create output directory. [#592](https://github.com/Codeception/CodeceptJS/issues/592) by **[vkramskikh](https://github.com/vkramskikh)**
928
+ * **[WebDriverIO]** Fixed `seeNumberOfVisibleElements` by **[BorisOsipov](https://github.com/BorisOsipov)** [#574](https://github.com/Codeception/CodeceptJS/issues/574)
929
+ * Lots of fixes for promise chain by **[APshenkin](https://github.com/APshenkin)** [#568](https://github.com/Codeception/CodeceptJS/issues/568)
930
+ * Fix [#543](https://github.com/Codeception/CodeceptJS/issues/543)- After block not properly executed if Scenario fails
902
931
  * Expected behavior in promise chains: `_beforeSuite` hooks from helpers -> `BeforeSuite` from test -> `_before` hooks from helpers -> `Before` from test - > Test steps -> `_failed` hooks from helpers (if test failed) -> `After` from test -> `_after` hooks from helpers -> `AfterSuite` from test -> `_afterSuite` hook from helpers.
903
932
  * if during test we got errors from any hook (in test or in helper) - stop complete this suite and go to another
904
933
  * if during test we got error from Selenium server - stop complete this suite and go to another
@@ -906,7 +935,7 @@ Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)*
906
935
  * Complete `_after`, `_afterSuite` hooks even After/AfterSuite from test was failed
907
936
  * Don't close browser between suites, when `restart` option is false. We should start browser only one time and close it only after all tests.
908
937
  * Close tabs and clear local storage, if `keepCookies` flag is enabled
909
- * Fix TypeError when using babel-node or ts-node on node.js 7+ [#586](https://github.com/Codeception/Codeception/issues/586) by **[vkramskikh](https://github.com/vkramskikh)**
938
+ * Fix TypeError when using babel-node or ts-node on node.js 7+ [#586](https://github.com/Codeception/CodeceptJS/issues/586) by **[vkramskikh](https://github.com/vkramskikh)**
910
939
  * **[Nightmare]** fixed usage of `_locate`
911
940
 
912
941
  Special thanks to **Andrey Pshenkin** for his work on this release and the major improvements.
@@ -922,9 +951,9 @@ Scenario('My scenario', { build_id: 123, type: 'slow' }, function (I)
922
951
  those options can be accessed as `opts` property inside a `test` object. Can be used in custom listeners.
923
952
 
924
953
  * Added `docs` directory to a package.
925
- * [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by **[tfiwm](https://github.com/tfiwm)** [#519](https://github.com/Codeception/Codeception/issues/519)
954
+ * [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by **[tfiwm](https://github.com/tfiwm)** [#519](https://github.com/Codeception/CodeceptJS/issues/519)
926
955
  * [WebDriverIO][Protractor][Nightmare] Added second parameter to `saveScreenshot` to allow a full page screenshot. By **[HughZurname](https://github.com/HughZurname)**
927
- * Added suite object to `suite.before` and `suite.after` events by **[implico](https://github.com/implico)**. [#496](https://github.com/Codeception/Codeception/issues/496)
956
+ * Added suite object to `suite.before` and `suite.after` events by **[implico](https://github.com/implico)**. [#496](https://github.com/Codeception/CodeceptJS/issues/496)
928
957
 
929
958
  ## 0.6.2
930
959
 
@@ -993,8 +1022,8 @@ codeceptjs run users_test.js -c tests
993
1022
  ## 0.5.0
994
1023
 
995
1024
  * Protractor ^5.0.0 support (while keeping ^4.0.9 compatibility)
996
- * Fix 'fullTitle() is not a function' in exit.js by **[hubidu](https://github.com/hubidu)**. See [#388](https://github.com/Codeception/Codeception/issues/388).
997
- * **[Nightmare]** Fix for `waitTimeout` by **[HughZurname](https://github.com/HughZurname)**. See [#391](https://github.com/Codeception/Codeception/issues/391). Resolves [#236](https://github.com/Codeception/Codeception/issues/236)* Dockerized CodeceptJS setup by **[artiomnist](https://github.com/artiomnist)**. [See reference](https://github.com/Codeception/CodeceptJS/blob/master/docker/README.md)
1025
+ * Fix 'fullTitle() is not a function' in exit.js by **[hubidu](https://github.com/hubidu)**. See [#388](https://github.com/Codeception/CodeceptJS/issues/388).
1026
+ * **[Nightmare]** Fix for `waitTimeout` by **[HughZurname](https://github.com/HughZurname)**. See [#391](https://github.com/Codeception/CodeceptJS/issues/391). Resolves [#236](https://github.com/Codeception/CodeceptJS/issues/236)* Dockerized CodeceptJS setup by **[artiomnist](https://github.com/artiomnist)**. [See reference](https://github.com/Codeception/CodeceptJS/blob/master/docker/README.md)
998
1027
 
999
1028
  ## 0.4.16
1000
1029
 
@@ -1076,7 +1105,7 @@ Scenario('Not that complex', {timeout: 1000}, (I) => {
1076
1105
  });
1077
1106
  ```
1078
1107
 
1079
- * **[WebDriverIO]** Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By **[APshenkin](https://github.com/APshenkin)**. See [#299](https://github.com/Codeception/Codeception/issues/299)
1108
+ * **[WebDriverIO]** Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By **[APshenkin](https://github.com/APshenkin)**. See [#299](https://github.com/Codeception/CodeceptJS/issues/299)
1080
1109
  * **[WebDriverIO]** `clearField` method improved to accept name/label locators and throw errors.
1081
1110
  * [Nightmare][SeleniumWebdriver][Protractor] `clearField` method added.
1082
1111
  * **[Nightmare]** Fixed `waitForElement`, and `waitForVisible` methods.
@@ -1098,7 +1127,7 @@ codeceptjs run -o '{ "helpers": {"WebDriverIO": {"browser": "chrome"}}}'
1098
1127
  ## 0.4.11
1099
1128
 
1100
1129
  * Fixed regression in 0.4.10
1101
- * Added `bootstrap`/`teardown` config options to accept functions as parameters by **[pscanf](https://github.com/pscanf)**. See updated [config reference](http://codecept.io/configuration/) [#319](https://github.com/Codeception/Codeception/issues/319)
1130
+ * Added `bootstrap`/`teardown` config options to accept functions as parameters by **[pscanf](https://github.com/pscanf)**. See updated [config reference](http://codecept.io/configuration/) [#319](https://github.com/Codeception/CodeceptJS/issues/319)
1102
1131
 
1103
1132
  ## 0.4.10
1104
1133
 
@@ -1113,26 +1142,26 @@ module.exports = function(done) {
1113
1142
  }
1114
1143
  ```
1115
1144
 
1116
- * Changed 'pending' to 'skipped' in reports by **[timja-kainos](https://github.com/timja-kainos)**. See [#315](https://github.com/Codeception/Codeception/issues/315)
1145
+ * Changed 'pending' to 'skipped' in reports by **[timja-kainos](https://github.com/timja-kainos)**. See [#315](https://github.com/Codeception/CodeceptJS/issues/315)
1117
1146
 
1118
1147
  ## 0.4.9
1119
1148
 
1120
1149
  * [SeleniumWebdriver][Protractor][WebDriverIO][Nightmare] fixed `executeScript`, `executeAsyncScript` to work and return values.
1121
1150
  * [Protractor][SeleniumWebdriver][WebDriverIO] Added `waitForInvisible` and `waitForStalenessOf` methods by **[Nighthawk14](https://github.com/Nighthawk14)**.
1122
1151
  * Added `--config` option to `codeceptjs run` to manually specify config file by **[cnworks](https://github.com/cnworks)**
1123
- * **[Protractor]** Simplified behavior of `amOutsideAngularApp` by using `ignoreSynchronization`. Fixes [#278](https://github.com/Codeception/Codeception/issues/278)
1124
- * Set exit code to 1 when test fails at `Before`/`After` hooks. Fixes [#279](https://github.com/Codeception/Codeception/issues/279)
1152
+ * **[Protractor]** Simplified behavior of `amOutsideAngularApp` by using `ignoreSynchronization`. Fixes [#278](https://github.com/Codeception/CodeceptJS/issues/278)
1153
+ * Set exit code to 1 when test fails at `Before`/`After` hooks. Fixes [#279](https://github.com/Codeception/CodeceptJS/issues/279)
1125
1154
 
1126
1155
 
1127
1156
  ## 0.4.8
1128
1157
 
1129
1158
  * [Protractor][SeleniumWebdriver][Nightmare] added `moveCursorTo` method.
1130
- * [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By **[cnworks](https://github.com/cnworks)**. [PR[#250](https://github.com/Codeception/Codeception/issues/250)
1159
+ * [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By **[cnworks](https://github.com/cnworks)**. [PR[#250](https://github.com/Codeception/CodeceptJS/issues/250)
1131
1160
  * Fixed `codeceptjs init` to work with nested directories and file masks.
1132
1161
  * Fixed `codeceptjs gt` to generate test with proper file name suffix. By **[Zougi](https://github.com/Zougi)**.
1133
1162
  * **[Nightmare]** Fixed: Error is thrown when clicking on element which can't be locate. By **[davetmik](https://github.com/davetmik)**
1134
1163
  * **[WebDriverIO]** Fixed `attachFile` for file upload. By **[giuband](https://github.com/giuband)** and **[davetmik](https://github.com/davetmik)**
1135
- * **[WebDriverIO]** Add support for timeouts in config and with `defineTimeouts` method. By **[easternbloc](https://github.com/easternbloc)** [#258](https://github.com/Codeception/Codeception/issues/258) and [#267](https://github.com/Codeception/Codeception/issues/267) by **[davetmik](https://github.com/davetmik)**
1164
+ * **[WebDriverIO]** Add support for timeouts in config and with `defineTimeouts` method. By **[easternbloc](https://github.com/easternbloc)** [#258](https://github.com/Codeception/CodeceptJS/issues/258) and [#267](https://github.com/Codeception/CodeceptJS/issues/267) by **[davetmik](https://github.com/davetmik)**
1136
1165
  * Fixed hanging of CodeceptJS when error is thrown by event dispatcher. Fix by **[Zougi](https://github.com/Zougi)** and **[davetmik](https://github.com/davetmik)**
1137
1166
 
1138
1167
 
@@ -1149,7 +1178,7 @@ module.exports = function(done) {
1149
1178
  ## 0.4.5
1150
1179
 
1151
1180
  * Fixed running `codecept def` command by **[jankaspar](https://github.com/jankaspar)**
1152
- * [Protractor][SeleniumWebdriver] Added support for special keys in `pressKey` method. Fixes [#216](https://github.com/Codeception/Codeception/issues/216)
1181
+ * [Protractor][SeleniumWebdriver] Added support for special keys in `pressKey` method. Fixes [#216](https://github.com/Codeception/CodeceptJS/issues/216)
1153
1182
 
1154
1183
  ## 0.4.4
1155
1184
 
@@ -1176,7 +1205,7 @@ exports.config = {
1176
1205
 
1177
1206
  ## 0.4.2
1178
1207
 
1179
- * Added ability to localize tests with translation [#189](https://github.com/Codeception/Codeception/issues/189). Thanks to **[abner](https://github.com/abner)**
1208
+ * Added ability to localize tests with translation [#189](https://github.com/Codeception/CodeceptJS/issues/189). Thanks to **[abner](https://github.com/abner)**
1180
1209
  * **[Translation]** ru-RU translation added.
1181
1210
  * **[Translation]** pt-BR translation added.
1182
1211
  * **[Protractor]** Protractor 4.0.4 compatibility.
@@ -1187,8 +1216,8 @@ exports.config = {
1187
1216
 
1188
1217
  ## 0.4.1
1189
1218
 
1190
- * Added custom steps to step definition list. See [#174](https://github.com/Codeception/Codeception/issues/174) by **[jayS-de](https://github.com/jayS-de)**
1191
- * **[WebDriverIO]** Fixed using `waitForTimeout` option by **[stephane-ruhlmann](https://github.com/stephane-ruhlmann)**. See [#178](https://github.com/Codeception/Codeception/issues/178)
1219
+ * Added custom steps to step definition list. See [#174](https://github.com/Codeception/CodeceptJS/issues/174) by **[jayS-de](https://github.com/jayS-de)**
1220
+ * **[WebDriverIO]** Fixed using `waitForTimeout` option by **[stephane-ruhlmann](https://github.com/stephane-ruhlmann)**. See [#178](https://github.com/Codeception/CodeceptJS/issues/178)
1192
1221
 
1193
1222
  ## 0.4.0
1194
1223
 
@@ -1228,7 +1257,7 @@ Depending on installation type additional modules (webdriverio, protractor, ...)
1228
1257
  * [Protractor][SeleniumWebdriver] fixed closing browser instances
1229
1258
  * [Protractor][SeleniumWebdriver] `doubleClick` method added
1230
1259
  * [WebDriverIO][Protractor][SeleniumWebdriver] `doubleClick` method to locate clickable elements by text, `context` option added.
1231
- * Fixed using assert in generator without yields [#89](https://github.com/Codeception/Codeception/issues/89)
1260
+ * Fixed using assert in generator without yields [#89](https://github.com/Codeception/CodeceptJS/issues/89)
1232
1261
 
1233
1262
  ## 0.3.1
1234
1263
 
@@ -1248,8 +1277,8 @@ Starting from 0.3.0 webdriverio is not the only backend for running selenium tes
1248
1277
  * **[WebDriverIO]** fixed `windowSize: maximize` option in config
1249
1278
  * **[WebDriverIO]** `seeElement` and `dontSeeElement` check element for visibility by **[fabioel](https://github.com/fabioel)** and **[davertmik](https://github.com/davertmik)**
1250
1279
  * **[WebDriverIO]** `seeElementInDOM`, `dontSeeElementInDOM` added to check element exists on page.
1251
- * **[WebDriverIO]** fixed saving screenshots on failure. Fixes [#70](https://github.com/Codeception/Codeception/issues/70)
1252
- * fixed `within` block doesn't end in output not [#79](https://github.com/Codeception/Codeception/issues/79)
1280
+ * **[WebDriverIO]** fixed saving screenshots on failure. Fixes [#70](https://github.com/Codeception/CodeceptJS/issues/70)
1281
+ * fixed `within` block doesn't end in output not [#79](https://github.com/Codeception/CodeceptJS/issues/79)
1253
1282
 
1254
1283
 
1255
1284
  ## 0.2.8
@@ -1258,20 +1287,20 @@ Starting from 0.3.0 webdriverio is not the only backend for running selenium tes
1258
1287
 
1259
1288
  ## 0.2.7
1260
1289
 
1261
- * process ends with exit code 1 on error or failure [#49](https://github.com/Codeception/Codeception/issues/49)
1262
- * fixed registereing global Helper [#57](https://github.com/Codeception/Codeception/issues/57)
1263
- * fixed handling error in within block [#50](https://github.com/Codeception/Codeception/issues/50)
1290
+ * process ends with exit code 1 on error or failure [#49](https://github.com/Codeception/CodeceptJS/issues/49)
1291
+ * fixed registereing global Helper [#57](https://github.com/Codeception/CodeceptJS/issues/57)
1292
+ * fixed handling error in within block [#50](https://github.com/Codeception/CodeceptJS/issues/50)
1264
1293
 
1265
1294
  ## 0.2.6
1266
1295
 
1267
1296
  * Fixed `done() was called multiple times`
1268
1297
  * **[WebDriverIO]** added `waitToHide` method by **[fabioel](https://github.com/fabioel)**
1269
- * Added global `Helper` (alias `codecept_helper)`, object use for writing custom Helpers. Generator updated. Changes to [#48](https://github.com/Codeception/Codeception/issues/48)
1298
+ * Added global `Helper` (alias `codecept_helper)`, object use for writing custom Helpers. Generator updated. Changes to [#48](https://github.com/Codeception/CodeceptJS/issues/48)
1270
1299
 
1271
1300
  ## 0.2.5
1272
1301
 
1273
- * Fixed issues with using yield inside a test [#45](https://github.com/Codeception/Codeception/issues/45) [#47](https://github.com/Codeception/Codeception/issues/47) [#43](https://github.com/Codeception/Codeception/issues/43)
1274
- * Fixed generating a custom helper. Helper class is now accessible with `codecept_helper` var. Fixes [#48](https://github.com/Codeception/Codeception/issues/48)
1302
+ * Fixed issues with using yield inside a test [#45](https://github.com/Codeception/CodeceptJS/issues/45) [#47](https://github.com/Codeception/CodeceptJS/issues/47) [#43](https://github.com/Codeception/CodeceptJS/issues/43)
1303
+ * Fixed generating a custom helper. Helper class is now accessible with `codecept_helper` var. Fixes [#48](https://github.com/Codeception/CodeceptJS/issues/48)
1275
1304
 
1276
1305
  ## 0.2.4
1277
1306
 
@@ -1304,7 +1333,7 @@ Whenever you need to create `I` object (in page objects, custom steps, but not i
1304
1333
  - mouse: `rightClick`
1305
1334
  * tests added
1306
1335
  * **[WebDriverIO]** proxy configuration added by **[petehouston](https://github.com/petehouston)**
1307
- * **[WebDriverIO]** fixed `waitForText` method by **[roadhump](https://github.com/roadhump)**. Fixes [#11](https://github.com/Codeception/Codeception/issues/11)
1336
+ * **[WebDriverIO]** fixed `waitForText` method by **[roadhump](https://github.com/roadhump)**. Fixes [#11](https://github.com/Codeception/CodeceptJS/issues/11)
1308
1337
  * Fixed creating output dir when it already exists on init by **[alfirin](https://github.com/alfirin)**
1309
1338
  * Fixed loading of custom helpers
1310
1339
 
package/docs/detox.md ADDED
@@ -0,0 +1,235 @@
1
+ ---
2
+ id: detox
3
+ title: Testing React Native with Detox
4
+ ---
5
+
6
+ > Warning! Detox support in CodeceptJS is experimental. Please try it and help us to test it and improve it. [See Detox helper repository](https://github.com/Codeception/detox-helper).
7
+
8
+ Automated mobile testing can be slow, hard, and ineffective. The price of it goes high, if we take into account fragility of applications, slowness of emulators, and the complexity of debug. [Appium](https://codecept.io/mobile) helps writing mobile tests but not all apps can be tested effectively with it. That's why you should consider using an alternative approach.
9
+
10
+ Meet [Detox](https://github.com/wix/Detox) - grey-box testing solution for mobile testing by Wix.
11
+
12
+ Unlike, Appium, Detox requires to update mobile application to include test instrumentation, so an application could receive commands from a test, and act accordingly. Let's see pros and cons of such approach:
13
+
14
+
15
+ **Pros**:
16
+
17
+ * faster tests
18
+ * synchronization with application
19
+ * plays nicely with React Native
20
+
21
+ **Cons**:
22
+
23
+ * application should be built in a special way
24
+ * no hybrid applications
25
+ * native Android apps not supported (except React Native)
26
+ * no cloud testing with SauceLabs or BrowserStack
27
+
28
+ CodeceptJS allows you to try different options and choose the one which works best for you. Both Appium and Detox helpers share the same syntax for testing mobile applications, interactive pause, automatic retries, and other useful features.
29
+
30
+ CodeceptJS provides next features over standard Detox:
31
+
32
+ * **Unified API**. The same test can be executed in Appium or Detox. Unified API helps different teams to use the same syntax and easy port tests from one engine to another.
33
+ * [Interactive pause](https://codecept.io/basics#pause). When starting/stopping an application takes a long time, debugging and writing tests can be hard. CodeceptJS solves this by pausing an execution and letting you try different commands and locators. With this feature a test can be writtern during one running session.
34
+ * [Auto-retries](https://codecept.io/basics#retries) using `retryFailedStepPlugin` and `I.retry()`
35
+ * **Cross-Platform testing** - one test can be executed on different engines. When needed, platform-specific actions and locators can be easily applied.
36
+
37
+ ## A Test
38
+
39
+ Compare a test written for Detox using its native syntax:
40
+
41
+ ```js
42
+ await expect(element(by.text('Welcome'))).toBeVisible();
43
+ await expect(element(by.id('createdAndVisibleText'))).toNotExist();
44
+ await element(by.id('GoButton')).tap();
45
+ await waitFor(element(by.id('createdAndVisibleText'))).toExist().withTimeout(20000);
46
+ await expect(element(by.id('createdAndVisibleText'))).toExist();
47
+ ```
48
+
49
+ with the same test written using CodeceptJS syntax:
50
+
51
+ ```js
52
+ I.see('Welcome');
53
+ I.dontSeeElement('#createdAndVisibleText');
54
+ I.click('#GoButton');
55
+ I.waitForElement('#createdAndVisibleText', 20);
56
+ I.seeElement('#createdAndVisibleText');
57
+ ```
58
+
59
+ As you see, CodeceptJS test is shorter and easier to follow. By simplifying the code and reducing visual noise we make tests easier to follow. But before writing a test we need to prepare an application to be testable with Detox.
60
+
61
+ ## Setup
62
+
63
+ It is important to follow [Detox guide](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) to build an application with Detox test instrouments included.
64
+
65
+ After you install Detox, create configuration and build an application using `detox build` command, you are ready to integrate Detox with CodeceptJS.
66
+
67
+ You need to install Detox CodeceptJS helper:
68
+
69
+ ```
70
+ npm i @codeceptjs/detox-helper --save-dev
71
+ ```
72
+
73
+ Then enable this helper in `codecept.conf.js`:
74
+
75
+ ```js
76
+ helpers: {
77
+ Detox: {
78
+ require: '@codeceptjs/detox-helper',
79
+ configuration: '<detox app configuration name>',
80
+ reloadReactNative: true,
81
+ }
82
+ }
83
+ ```
84
+
85
+ Enable `reloadReactNative: true` if you test React Native application.
86
+
87
+ ## Actions
88
+
89
+ Create test as usual, by running command:
90
+
91
+ ```
92
+ npx codeceptjs gt
93
+ ```
94
+
95
+ A test starts when emulator starts and loads an application. So you can begin testing an application.
96
+
97
+ ```js
98
+ // inside a created test
99
+ Scenario('test React Native app', (I) => {
100
+ I.see('Welcome');
101
+ I.tap('Start');
102
+ I.see('Started!');
103
+ });
104
+ ```
105
+
106
+ The most common actions are:
107
+
108
+ * `tap` (or `click`)
109
+ * `multiTap` - perform multiple taps on element
110
+ * `longPress` - longer press
111
+ * `fillField` - fill in value of text field
112
+ * `clearField` - clear value in text field
113
+ * `appendField` - append value in a field
114
+ * `swipeUp`, `swipeDown`, `swipeLeft`, `swipeRigth`
115
+
116
+ There are also common assertions:
117
+
118
+ * `see` - to check visibility of text
119
+ * `seeElement` - to check visibility of element
120
+ * `seeElementExists` - to check that element exists
121
+
122
+ > For more details on actions refer to the [API reference of Detox helper](https://github.com/Codeception/detox-helper#api).
123
+
124
+ ## Locators
125
+
126
+ To write a test you need to learn about available locators in Detox.
127
+ Unlike, Appium there are no XPath locators. Possible locators limited to `text`, `id`, `accessibility id`, and element `type`. Thus, again, an application should be prepared for testing, to ensure that all active elements are accessible.
128
+
129
+ Let's see how they can be used:
130
+
131
+ * For **ID locators** use `#` prefix (same as in CSS). Example:
132
+
133
+ ```js
134
+ I.seeElement('#WelcomeScreen')
135
+ ```
136
+ * For **accessibility ID** use `~` prefix (as in Appium helper). Example:
137
+
138
+ ```js
139
+ I.seeElement('~welcome')
140
+ ```
141
+
142
+ * Locating elements **by text** requires no prefix, but can be applied only for actions accepting semantic locators.
143
+
144
+ ```js
145
+ I.tap('Start')
146
+ I.fillField('Username', 'davert')
147
+ I.clearField('Username')
148
+ I.see('Welcome, davert')
149
+ ```
150
+
151
+ * Locating elements **by type** also use no prefix but can be used only where for elements.
152
+
153
+ ```js
154
+ I.seeElement('Button')
155
+ ```
156
+
157
+ Text locators can be combined with others, as methods `tap`, `click` and `see` can receive a second paramater, which defines a context where to perfrom a search.
158
+
159
+ ```js
160
+ // tap "Start" inside "#Layout"
161
+ I.tap('Start', '#Layout');
162
+ // see text "Welcome" inside "~msg"
163
+ I.see('Welcome', '~msg');
164
+ ```
165
+
166
+ Alternatively, you can use specify locator by using *strict locator*, passing an object as a locator:
167
+
168
+ ```js
169
+ I.click({ type: 'Button' });
170
+ I.seeElement({ label: 'welcome' });
171
+ ```
172
+
173
+ > If you are familiar with Detox API, this is how locators are actually translated: `{label: 'welcome'}` => `by.label('welcome')`.
174
+
175
+ ### Cross Platform Testing
176
+
177
+ If element differs on on iOS and Android you can use **cross platform locators**.
178
+
179
+ ```js
180
+ // locate element by text on Android
181
+ // locate element by accessibility id on iOS
182
+ I.click({ android: 'Start', ios: '~start' });
183
+ ```
184
+
185
+ When application behavior differs on Android and iOS use platform-specific actions:
186
+
187
+ ```js
188
+ I.runOnIOS(() => {
189
+ // this will be executed only on IOS
190
+ I.see('Hello iOS');
191
+ });
192
+ I.runOnAndroid(() => {
193
+ // this will be executed only on Android
194
+ I.see('Hello Android');
195
+ });
196
+ ```
197
+
198
+ ### Sample Test
199
+
200
+ Finally, you can get a test looking like this
201
+
202
+ ```js
203
+ Feature('My Detox App');
204
+
205
+ Scenario('save in application', (I) => {
206
+ I.setLandscapeOrientation();
207
+ I.fillField('#text', 'a new text');
208
+ I.see('a new text', '#textValue');
209
+ I.dontSeeElement('#createdAndVisibleText');
210
+ I.click({ ios: '#GoButton', android: 'Button' });
211
+ I.waitForElement('#createdAndVisibleText', 20);
212
+ I.seeElement('#createdAndVisibleText');
213
+ I.runOnAndroid(() => {
214
+ I.click('Save');
215
+ I.see('Text Saved', '#message');
216
+ });
217
+ I.runOnIOS(() => {
218
+ I.click('SAVE');
219
+ I.see('SAVED!');
220
+ });
221
+ });
222
+ ```
223
+
224
+ To execute it use `codeceptjs run` command
225
+
226
+ ```
227
+ npx codeceptjs run
228
+ ```
229
+ If you want to use detox configuration other than is set in `codecept.conf.js` use `--configuration` argument:
230
+
231
+ ```
232
+ npx codeceptjs run --configuration android.test.ci
233
+ ```
234
+
235
+ You can also pass all [other arguments that Detox CLI supports](https://github.com/wix/Detox/blob/master/docs/APIRef.DetoxCLI.md#test).