codeceptjs 3.2.0 → 3.3.0-beta.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 (74) hide show
  1. package/CHANGELOG.md +78 -2
  2. package/docs/advanced.md +3 -3
  3. package/docs/api.md +227 -188
  4. package/docs/basics.md +26 -1
  5. package/docs/bdd.md +2 -2
  6. package/docs/build/ApiDataFactory.js +13 -6
  7. package/docs/build/Appium.js +98 -36
  8. package/docs/build/FileSystem.js +11 -1
  9. package/docs/build/GraphQL.js +11 -0
  10. package/docs/build/JSONResponse.js +297 -0
  11. package/docs/build/Nightmare.js +48 -48
  12. package/docs/build/Playwright.js +277 -151
  13. package/docs/build/Puppeteer.js +77 -68
  14. package/docs/build/REST.js +36 -0
  15. package/docs/build/TestCafe.js +44 -44
  16. package/docs/build/WebDriver.js +70 -70
  17. package/docs/changelog.md +28 -2
  18. package/docs/configuration.md +8 -8
  19. package/docs/custom-helpers.md +1 -1
  20. package/docs/data.md +9 -9
  21. package/docs/helpers/ApiDataFactory.md +7 -0
  22. package/docs/helpers/Appium.md +240 -198
  23. package/docs/helpers/FileSystem.md +11 -1
  24. package/docs/helpers/JSONResponse.md +230 -0
  25. package/docs/helpers/Playwright.md +283 -216
  26. package/docs/helpers/Puppeteer.md +9 -1
  27. package/docs/helpers/REST.md +30 -9
  28. package/docs/installation.md +3 -1
  29. package/docs/internal-api.md +265 -0
  30. package/docs/mobile.md +11 -11
  31. package/docs/nightmare.md +3 -3
  32. package/docs/pageobjects.md +2 -0
  33. package/docs/playwright.md +73 -18
  34. package/docs/plugins.md +140 -40
  35. package/docs/puppeteer.md +28 -12
  36. package/docs/quickstart.md +2 -3
  37. package/docs/reports.md +44 -3
  38. package/docs/testcafe.md +1 -1
  39. package/docs/translation.md +2 -2
  40. package/docs/videos.md +2 -2
  41. package/docs/visual.md +2 -2
  42. package/docs/vue.md +1 -1
  43. package/docs/webdriver.md +92 -4
  44. package/lib/actor.js +2 -2
  45. package/lib/cli.js +25 -20
  46. package/lib/command/init.js +5 -15
  47. package/lib/command/workers/runTests.js +25 -7
  48. package/lib/config.js +17 -13
  49. package/lib/helper/ApiDataFactory.js +13 -6
  50. package/lib/helper/Appium.js +65 -3
  51. package/lib/helper/FileSystem.js +11 -1
  52. package/lib/helper/GraphQL.js +11 -0
  53. package/lib/helper/JSONResponse.js +297 -0
  54. package/lib/helper/Playwright.js +215 -89
  55. package/lib/helper/Puppeteer.js +13 -4
  56. package/lib/helper/REST.js +36 -0
  57. package/lib/helper/WebDriver.js +1 -1
  58. package/lib/helper/extras/Console.js +8 -0
  59. package/lib/helper/extras/PlaywrightRestartOpts.js +35 -0
  60. package/lib/interfaces/bdd.js +3 -1
  61. package/lib/listener/timeout.js +4 -3
  62. package/lib/plugin/allure.js +12 -0
  63. package/lib/plugin/autoLogin.js +1 -1
  64. package/lib/plugin/eachElement.js +127 -0
  65. package/lib/plugin/retryFailedStep.js +4 -3
  66. package/lib/plugin/stepTimeout.js +5 -4
  67. package/lib/plugin/tryTo.js +6 -0
  68. package/lib/recorder.js +2 -1
  69. package/lib/step.js +57 -2
  70. package/lib/utils.js +20 -0
  71. package/package.json +6 -4
  72. package/translations/pt-BR.js +8 -0
  73. package/typings/index.d.ts +4 -0
  74. package/typings/types.d.ts +345 -110
package/docs/data.md CHANGED
@@ -5,7 +5,7 @@ title: Data Management
5
5
 
6
6
  # Data Management
7
7
 
8
- > This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](http://codecept.io/advanced/#data-drivern-tests) section*
8
+ > This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](https://codecept.io/advanced/#data-drivern-tests) section*
9
9
 
10
10
  Managing data for tests is always a tricky issue. How isolate data between tests, how to prepare data for different tests, etc.
11
11
  There are different approaches to solve it:
@@ -22,7 +22,7 @@ API is supposed to be a stable interface and it can be used by acceptance tests.
22
22
 
23
23
  ## REST
24
24
 
25
- [REST helper](http://codecept.io/helpers/REST/) allows sending raw HTTP requests to application.
25
+ [REST helper](https://codecept.io/helpers/REST/) allows sending raw HTTP requests to application.
26
26
  This is a tool to make shortcuts and create your data pragmatically via API. However, it doesn't provide tools for testing APIs, so it should be paired with WebDriver, Nightmare or Protractor helpers for browser testing.
27
27
 
28
28
  Enable REST helper in the config. It is recommended to set `endpoint`, a base URL for all API requests. If you need some authorization you can optionally set default headers too.
@@ -87,11 +87,11 @@ This can also be used to emulate Ajax requests:
87
87
  I.sendPostRequest('/update-status', {}, { http_x_requested_with: 'xmlhttprequest' });
88
88
  ```
89
89
 
90
- > See complete reference on [REST](http://codecept.io/helpers/REST) helper
90
+ > See complete reference on [REST](https://codecept.io/helpers/REST) helper
91
91
 
92
92
  ## GraphQL
93
93
 
94
- [GraphQL helper](http://codecept.io/helpers/GraphQL/) allows sending GraphQL queries and mutations to application, over Http.
94
+ [GraphQL helper](https://codecept.io/helpers/GraphQL/) allows sending GraphQL queries and mutations to application, over Http.
95
95
  This is a tool to make shortcuts and create your data pragmatically via GraphQL endpoint. However, it doesn't provide tools for testing the endpoint, so it should be paired with WebDriver, Nightmare or Protractor helpers for browser testing.
96
96
 
97
97
  Enable GraphQL helper in the config. It is recommended to set `endpoint`, the URL to which the requests go to. If you need some authorization you can optionally set default headers too.
@@ -160,13 +160,13 @@ After(({ I }) => {
160
160
  });
161
161
  ```
162
162
 
163
- > See complete reference on [GraphQL](http://codecept.io/helpers/GraphQL) helper
163
+ > See complete reference on [GraphQL](https://codecept.io/helpers/GraphQL) helper
164
164
 
165
165
  ## Data Generation with Factories
166
166
 
167
167
  This concept is extended by:
168
- - [ApiDataFactory](http://codecept.io/helpers/ApiDataFactory/) helper, and,
169
- - [GraphQLDataFactory](http://codecept.io/helpers/GraphQLDataFactory/) helper.
168
+ - [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory/) helper, and,
169
+ - [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory/) helper.
170
170
 
171
171
  These helpers build data according to defined rules and use REST API or GraphQL mutations to store them and automatically clean them up after a test.
172
172
 
@@ -238,7 +238,7 @@ At the end of a test ApiDataFactory will clean up created record for you. This i
238
238
  ids from crated records and running `DELETE /api/users/{id}` requests at the end of a test.
239
239
  This rules can be customized in helper configuration.
240
240
 
241
- > See complete reference on [ApiDataFactory](http://codecept.io/helpers/ApiDataFactory) helper
241
+ > See complete reference on [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory) helper
242
242
 
243
243
  ### GraphQL Data Factory
244
244
 
@@ -303,7 +303,7 @@ data from crated records, creating deletion mutation objects by passing the data
303
303
  This behavior is according the `revert` function be customized in helper configuration.
304
304
  The revert function returns an object, that contains the query for deletion, and the variables object to go along with it.
305
305
 
306
- > See complete reference on [GraphQLDataFactory](http://codecept.io/helpers/GraphQLDataFactory) helper
306
+ > See complete reference on [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory) helper
307
307
 
308
308
  ## Requests Using Browser Session
309
309
 
@@ -221,12 +221,15 @@ I.have('user');
221
221
  // create user with defined email
222
222
  // and receive it when inside async function
223
223
  const user = await I.have('user', { email: 'user@user.com'});
224
+ // create a user with options that will not be included in the final request
225
+ I.have('user', { }, { age: 33, height: 55 })
224
226
  ```
225
227
 
226
228
  #### Parameters
227
229
 
228
230
  - `factory` **any** factory to use
229
231
  - `params` **any** predefined parameters
232
+ - `options` **any** options for programmatically generate the attributes
230
233
 
231
234
  ### haveMultiple
232
235
 
@@ -238,6 +241,9 @@ I.haveMultiple('post', 3);
238
241
 
239
242
  // create 3 posts by one author
240
243
  I.haveMultiple('post', 3, { author: 'davert' });
244
+
245
+ // create 3 posts by one author with options
246
+ I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' });
241
247
  ```
242
248
 
243
249
  #### Parameters
@@ -245,6 +251,7 @@ I.haveMultiple('post', 3, { author: 'davert' });
245
251
  - `factory` **any**
246
252
  - `times` **any**
247
253
  - `params` **any**
254
+ - `options` **any**
248
255
 
249
256
  [1]: https://github.com/rosiejs/rosie
250
257