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/CHANGELOG.md CHANGED
@@ -1,7 +1,36 @@
1
+ ## 2.2.1
2
+
3
+ * [WebDriver] A [dedicated guide](https://codecept.io/webdriver) written.
4
+ * [TestCade] A [dedicated guide](https://codecept.io/testcafe) written.
5
+ * [Puppeteer] A [chapter on mocking](https://codecept.io/puppeteer#mocking-requests) written
6
+ * [Puppeteer][Nightmare][TestCafe] Window mode is enabled by default on `codeceptjs init`.
7
+ * [TestCafe] Actions implemented by @hubidu
8
+ * `grabPageScrollPosition`
9
+ * `scrollPageToTop`
10
+ * `scrollPageToBottom`
11
+ * `scrollTo`
12
+ * `switchTo`
13
+ * Intellisense improvements. Renamed `tsconfig.json` to `jsconfig.json` on init. Fixed autocompletion for Visual Studio Code.
14
+ * [Polly] Take configuration values from Puppeteer. Fix #1766 by @VikalpP
15
+ * [Polly] Add preconditions to check for puppeteer page availability by @VikalpP. Fixes #1767
16
+ * [WebDriver] Use filename for `uploadFile` by @VikalpP. See #1797
17
+ * [Puppeteer] Configure speed of input with `pressKeyDelay` option. By @hubidu
18
+ * Fixed recursive loading of support objects by @davertmik.
19
+ * Fixed support object definitions in steps.d.ts by @johnyb. Fixes #1795
20
+ * Fixed `Data().Scenario().injectDependencies()` is not a function by @andrerleao
21
+ * Fixed crash when using xScenario & Scenario.skip with tag by @VikalpP. Fixes #1751
22
+ * Dynamic configuration of helpers can be performed with async function. See #1786 by @cviejo
23
+ * Added TS definitions for internal objects by @Vorobeyko
24
+ * BDD improvements:
25
+ * Fix for snippets command with a .feature file that has special characters by @asselin
26
+ * Fix `--path` option on `gherkin:snippets` command by @asselin. See #1790
27
+ * Added `--feature` option to `gherkin:snippets` to enable creating snippets for a subset of .feature files. See #1803 by @asselin.
28
+ * Fixed: dynamic configs not reset after test. Fixes #1776 by @cviejo.
29
+
1
30
  ## 2.2.0
2
31
 
3
32
  * **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 for implementation! Please test it and send us feedback.
4
- * [Puppeteer] Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly)
33
+ * [Puppeteer] Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly). Thanks @VikalpP
5
34
 
6
35
  ```js
7
36
  // use Polly & Puppeteer helpers
package/README.md CHANGED
@@ -18,19 +18,20 @@ Scenario('check Welcome page on site', (I) => {
18
18
  });
19
19
  ```
20
20
 
21
- Codeception tests are:
21
+ CodeceptJS tests are:
22
22
 
23
23
  * **Synchronous**. You don't need to care about callbacks, or promises, test scenarios are linear, your test should be too.
24
24
  * Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons.
25
25
  * Backend **API agnostic**. We don't know which WebDriver implementation is running this test. We can easily switch from WebDriverIO to Protractor or PhantomJS.
26
26
 
27
- Codeception uses **Helper** modules to provide actions to `I` object. Currently CodeceptJS has these helpers:
27
+ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently CodeceptJS has these helpers:
28
28
 
29
- * [**WebDriverIO**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriverIO.md) - wrapper on top of Selenium bindings library [WebDriverIO](http://webdriver.io/)
30
- * [**Protractor**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Protractor.md) - helper empowered by [Protractor](http://protractortest.org/) framework for AngularJS testing
31
- * [**Nightmare**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - helper which for testing web applications indi Electron using NightmareJS.
32
- * [**Appium**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
33
29
  * [**Puppeteer**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
30
+ * [**WebDriver**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol.
31
+ * [**Protractor**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Protractor.md) - helper empowered by [Protractor](http://protractortest.org/) to run tests via WebDriver protocol.
32
+ * [**TestCafe**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation.
33
+ * [**Nightmare**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - uses Electron and NightmareJS to run tests.
34
+ * [**Appium**](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
34
35
 
35
36
  And more to come...
36
37
 
@@ -38,7 +39,7 @@ And more to come...
38
39
 
39
40
  CodeceptJS is a successor of [Codeception](http://codeception.com), a popular full-stack testing framework for PHP.
40
41
  With CodeceptJS your scenario-driven functional and acceptance tests will be as simple and clean as they can be.
41
- You don't need to worry about asynchronous nature of NodeJS or about various APIs of Selenium, PhantomJS, Protractor, etc,
42
+ You don't need to worry about asynchronous nature of NodeJS or about various APIs of Selenium, Puppeteer, Protractor, TestCafe etc,
42
43
  as CodeceptJS unifies them and makes them work as they were synchronous.
43
44
 
44
45
  ## Features
@@ -47,7 +48,6 @@ as CodeceptJS unifies them and makes them work as they were synchronous.
47
48
  * Designed for scenario driven acceptance testing in BDD-style
48
49
  * Uses ES6 natively without transpiler.
49
50
  * Also plays nice with TypeScript.
50
- * Selenium WebDriver integration using [webdriverio](http://webdriver.io).
51
51
  * Smart locators: use names, labels, matching text, CSS or XPath to locate elements.
52
52
  * Interactive debugging shell: pause test at any point and try different commands in a browser.
53
53
  * Easily create tests, pageobjects, stepobjects with CLI generators.
@@ -55,13 +55,13 @@ as CodeceptJS unifies them and makes them work as they were synchronous.
55
55
  ## Install
56
56
 
57
57
  ```sh
58
- npm install -g codeceptjs
58
+ npm install codeceptjs --save
59
59
  ```
60
60
 
61
61
  Move to directory where you'd like to have your tests (and codeceptjs config) stored, and run
62
62
 
63
63
  ```sh
64
- codeceptjs init
64
+ npx codeceptjs init
65
65
  ```
66
66
 
67
67
  to create and configure test environment. It is recommended to select WebDriverIO from the list of helpers,
@@ -70,19 +70,19 @@ if you need to write Selenium WebDriver tests.
70
70
  After that create your first test by executing:
71
71
 
72
72
  ```sh
73
- codeceptjs generate:test
73
+ npx codeceptjs generate:test
74
74
  ```
75
75
 
76
76
  Now test is created and can be executed with
77
77
 
78
78
  ```sh
79
- codeceptjs run
79
+ npx codeceptjs run
80
80
  ```
81
81
 
82
82
  If you want to write your tests using TypeScript just generate standard Type Definitions by executing:
83
83
 
84
84
  ```sh
85
- codeceptjs def .
85
+ npx codeceptjs def .
86
86
  ```
87
87
 
88
88
  Later you can even automagically update Type Definitions to include your own custom [helpers methods](docs/helpers.md).
@@ -113,7 +113,7 @@ Scenario('test some forms', (I) => {
113
113
  ```
114
114
 
115
115
  All actions are performed by I object; assertions functions start with `see` function.
116
- In this examples all methods of `I` are taken from WebDriverIO helper, see [reference](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriverIO.md) to learn how to use them.
116
+ In this examples all methods of `I` are taken from WebDriver helper, see [reference](https://github.com/Codeception/CodeceptJS/blob/master/docs/helpers/WebDriver.md) to learn how to use them.
117
117
 
118
118
  Let's execute this test with `run` command. Additional option `--steps` will show us the running process. We recommend use `--steps` or `--debug` during development.
119
119
 
@@ -230,16 +230,9 @@ It will create a page object file for you and add it to config.
230
230
  Let's assume we created one named `docsPage`:
231
231
 
232
232
  ```js
233
- 'use strict';
234
-
235
- let I;
233
+ const { I } = inject();
236
234
 
237
235
  module.exports = {
238
-
239
- _init() {
240
- I = actor();
241
- },
242
-
243
236
  fields: {
244
237
  email: '#user_basic_email',
245
238
  password: '#user_basic_password'
package/bin/codecept.js CHANGED
@@ -53,9 +53,11 @@ program.command('gherkin:steps [path]')
53
53
 
54
54
  program.command('gherkin:snippets [path]')
55
55
  .alias('bdd:snippets')
56
- .description('Generate step defintions from steps.')
56
+ .description('Generate step definitions from steps.')
57
57
  .option('--dry-run', "don't save snippets to file")
58
58
  .option('-c, --config [file]', 'configuration file to be used')
59
+ .option('--feature [file]', 'feature files(s) to scan')
60
+ .option('--path [file]', 'file in which to place the new snippets')
59
61
  .action(require('../lib/command/gherkin/snippets'));
60
62
 
61
63
 
package/docs/advanced.md CHANGED
@@ -367,7 +367,7 @@ Scenario('should create data via v2 version of API', (I) => {
367
367
  ```
368
368
 
369
369
  Config can also be set by a function, in this case you can get a test object and specify config values based on it.
370
- This is very useful when running tests against cloud providers, like BrowserStack.
370
+ This is very useful when running tests against cloud providers, like BrowserStack. This function can also be asynchronous.
371
371
 
372
372
  ```js
373
373
  Scenario('should report to BrowserStack', (I) => {
package/docs/angular.md CHANGED
@@ -150,12 +150,12 @@ exports.config = {
150
150
  Sure, Protractor can be used to test applications built without AngularJS. In this case you need to disable angular synchronization feature in config:
151
151
 
152
152
  ```js
153
- "helpers": {
154
- "Protractor": {
155
- "url": "http://todomvc.com/examples/angularjs/",
156
- "driver": "hosted",
157
- "browser": "firefox",
158
- "angular": false
153
+ helpers: {
154
+ Protractor: {
155
+ url: "http://todomvc.com/examples/angularjs/",
156
+ driver: "hosted",
157
+ browser: "firefox",
158
+ angular: false
159
159
  }
160
160
  }
161
161
  ```
@@ -304,9 +304,6 @@ Scenario('create todo item', (I) => {
304
304
 
305
305
  To learn more about refactoring options in CodeceptJS read [PageObjects guide](http://codecept.io/pageobjects/).
306
306
 
307
- ## Multiple Sessions
308
-
309
- To run several browsers in one test see [multiple session](https://codecept.io/acceptance/#multiple-sessions) chapter.
310
307
 
311
308
  ## Extending
312
309