codeceptjs 3.2.1 → 3.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -0
- package/docs/advanced.md +3 -3
- package/docs/api.md +227 -188
- package/docs/basics.md +26 -1
- package/docs/bdd.md +2 -2
- package/docs/build/ApiDataFactory.js +13 -6
- package/docs/build/Appium.js +98 -36
- package/docs/build/FileSystem.js +11 -1
- package/docs/build/GraphQL.js +11 -0
- package/docs/build/JSONResponse.js +297 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +282 -151
- package/docs/build/Puppeteer.js +76 -67
- package/docs/build/REST.js +36 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +70 -70
- package/docs/changelog.md +17 -0
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +9 -9
- package/docs/helpers/ApiDataFactory.md +7 -0
- package/docs/helpers/Appium.md +240 -198
- package/docs/helpers/FileSystem.md +11 -1
- package/docs/helpers/JSONResponse.md +230 -0
- package/docs/helpers/Playwright.md +283 -216
- package/docs/helpers/Puppeteer.md +9 -1
- package/docs/helpers/REST.md +30 -9
- package/docs/installation.md +3 -1
- package/docs/internal-api.md +265 -0
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/pageobjects.md +2 -0
- package/docs/playwright.md +73 -18
- package/docs/plugins.md +138 -38
- package/docs/puppeteer.md +28 -12
- package/docs/quickstart.md +2 -3
- package/docs/reports.md +44 -3
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +2 -2
- package/docs/videos.md +2 -2
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +92 -4
- package/lib/actor.js +2 -2
- package/lib/cli.js +25 -20
- package/lib/command/init.js +5 -15
- package/lib/command/workers/runTests.js +25 -7
- package/lib/config.js +17 -13
- package/lib/helper/ApiDataFactory.js +13 -6
- package/lib/helper/Appium.js +65 -3
- package/lib/helper/FileSystem.js +11 -1
- package/lib/helper/GraphQL.js +11 -0
- package/lib/helper/JSONResponse.js +297 -0
- package/lib/helper/Playwright.js +220 -89
- package/lib/helper/Puppeteer.js +12 -3
- package/lib/helper/REST.js +36 -0
- package/lib/helper/WebDriver.js +1 -1
- package/lib/helper/extras/Console.js +8 -0
- package/lib/helper/extras/PlaywrightRestartOpts.js +35 -0
- package/lib/interfaces/bdd.js +3 -1
- package/lib/listener/timeout.js +4 -3
- package/lib/plugin/allure.js +12 -0
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/eachElement.js +127 -0
- package/lib/plugin/stepTimeout.js +5 -4
- package/lib/plugin/tryTo.js +6 -0
- package/lib/recorder.js +2 -1
- package/lib/step.js +57 -2
- package/lib/utils.js +20 -0
- package/package.json +24 -22
- package/translations/pt-BR.js +8 -0
- package/typings/index.d.ts +4 -0
- 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](
|
|
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](
|
|
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](
|
|
90
|
+
> See complete reference on [REST](https://codecept.io/helpers/REST) helper
|
|
91
91
|
|
|
92
92
|
## GraphQL
|
|
93
93
|
|
|
94
|
-
[GraphQL helper](
|
|
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](
|
|
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](
|
|
169
|
-
- [GraphQLDataFactory](
|
|
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](
|
|
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](
|
|
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
|
|