codeceptjs 3.3.0 → 3.3.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.
- package/CHANGELOG.md +39 -1
- package/README.md +26 -0
- package/docs/api.md +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +26 -11
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +52 -23
- package/docs/build/Playwright.js +126 -48
- package/docs/build/Protractor.js +70 -32
- package/docs/build/Puppeteer.js +78 -35
- package/docs/build/REST.js +4 -1
- package/docs/build/TestCafe.js +53 -22
- package/docs/build/WebDriver.js +115 -65
- package/docs/changelog.md +39 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +113 -15
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/Nightmare.md +131 -29
- package/docs/helpers/Playwright.md +424 -215
- package/docs/helpers/Puppeteer.md +229 -92
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +166 -62
- package/docs/helpers/WebDriver.md +254 -103
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +7 -2
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +49 -13
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +6 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +3 -3
- package/typings/types.d.ts +558 -607
package/docs/changelog.md
CHANGED
|
@@ -7,6 +7,44 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
+
## 3.3.1
|
|
11
|
+
|
|
12
|
+
🛩️ Features:
|
|
13
|
+
|
|
14
|
+
* Add option to avoid duplicate gherkin step definitions ([#3257](https://github.com/codeceptjs/CodeceptJS/issues/3257)) - **[raywiis](https://github.com/raywiis)**
|
|
15
|
+
* Added `step.*` for run-workers [#3272](https://github.com/codeceptjs/CodeceptJS/issues/3272). Thanks to **[abhimanyupandian](https://github.com/abhimanyupandian)**
|
|
16
|
+
* Fixed loading tests for `codecept run` using glob patterns. By **[jayudey-wf](https://github.com/jayudey-wf)**
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npx codeceptjs run test-dir/*"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
* **[Playwright]** **Possible breaking change.** By default `timeout` is changed to 5000ms. The value set in 3.3.0 was too low. Please set `timeout` explicitly to not depend on release values.
|
|
23
|
+
* **[Playwright]** Added for color scheme option by **[PeterNgTr](https://github.com/PeterNgTr)**
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
helpers: {
|
|
27
|
+
Playwright : {
|
|
28
|
+
url: "http://localhost",
|
|
29
|
+
colorScheme: "dark",
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
🐛 Bugfixes:
|
|
36
|
+
|
|
37
|
+
* **[Playwright]** Fixed `Cannot read property 'video' of undefined`
|
|
38
|
+
* Fixed haveRequestHeaders() and amBearerAuthenticated() of REST helper ([#3260](https://github.com/codeceptjs/CodeceptJS/issues/3260)) - **[mirao](https://github.com/mirao)**
|
|
39
|
+
* Fixed: allure attachment fails if screenshot failed [#3298](https://github.com/codeceptjs/CodeceptJS/issues/3298) by **[ruudvanderweijde](https://github.com/ruudvanderweijde)**
|
|
40
|
+
* Fixed [#3105](https://github.com/codeceptjs/CodeceptJS/issues/3105) using autoLogin() plugin with TypeScript. Fix [#3290](https://github.com/codeceptjs/CodeceptJS/issues/3290) by **[PeterNgTr](https://github.com/PeterNgTr)**
|
|
41
|
+
* **[Playwright]** Added extra params for click and dragAndDrop to type definitions by **[mirao](https://github.com/mirao)**
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
📖 Documentation
|
|
45
|
+
* Improving the typings in many places
|
|
46
|
+
* Improving the return type of helpers for TS users ([#3245](https://github.com/codeceptjs/CodeceptJS/issues/3245)) - **[nlespiaucq](https://github.com/nlespiaucq)**
|
|
47
|
+
|
|
10
48
|
## 3.3.0
|
|
11
49
|
|
|
12
50
|
🛩️ Features:
|
|
@@ -55,7 +93,7 @@ await eachElement('click all links in .list', '.list a', (el) => {
|
|
|
55
93
|
|
|
56
94
|
📖 Documentation
|
|
57
95
|
|
|
58
|
-
* Added [Testomat.io reporter](/
|
|
96
|
+
* Added [Testomat.io reporter](/reports#testomatio)
|
|
59
97
|
* Added [api testing](/api) guides
|
|
60
98
|
* Added [internal api](/internal-api) guides
|
|
61
99
|
* **[Appium]** Fixed documentation for `performSwipe`
|
package/docs/custom-helpers.md
CHANGED
|
@@ -7,7 +7,7 @@ title: Custom Helpers
|
|
|
7
7
|
|
|
8
8
|
Helper is the core concept of CodeceptJS. Helper is a wrapper on top of various libraries providing unified interface around them. When `I` object is used in tests it delegates execution of its functions to currently enabled helper classes.
|
|
9
9
|
|
|
10
|
-
Use Helpers to introduce low-level API to your tests without polluting test scenarios. Helpers can also be used to share functionality
|
|
10
|
+
Use Helpers to introduce low-level API to your tests without polluting test scenarios. Helpers can also be used to share functionality across different project and installed as npm packages.
|
|
11
11
|
|
|
12
12
|
## Development
|
|
13
13
|
|
package/docs/data.md
CHANGED
|
@@ -206,7 +206,7 @@ See the example providing a factory for User generation:
|
|
|
206
206
|
```js
|
|
207
207
|
// factories/post.js
|
|
208
208
|
var Factory = require('rosie').Factory;
|
|
209
|
-
var faker = require('faker');
|
|
209
|
+
var faker = require('@faker-js/faker');
|
|
210
210
|
|
|
211
211
|
module.exports = new Factory()
|
|
212
212
|
.attr('name', () => faker.name.findName())
|
|
@@ -262,7 +262,7 @@ See the example providing a factory for User generation:
|
|
|
262
262
|
```js
|
|
263
263
|
// factories/post.js
|
|
264
264
|
var Factory = require('rosie').Factory;
|
|
265
|
-
var faker = require('faker');
|
|
265
|
+
var faker = require('@faker-js/faker');
|
|
266
266
|
|
|
267
267
|
module.exports = new Factory((buildObj) => {
|
|
268
268
|
return {
|
|
@@ -43,7 +43,7 @@ To make this work you need
|
|
|
43
43
|
Install [Rosie][1] and [Faker][2] libraries.
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
npm i rosie faker --save-dev
|
|
46
|
+
npm i rosie @faker-js/faker --save-dev
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Create a factory file for a resource.
|
|
@@ -53,8 +53,8 @@ See the example for Posts factories:
|
|
|
53
53
|
```js
|
|
54
54
|
// tests/factories/posts.js
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const Factory = require('rosie').Factory;
|
|
57
|
+
const faker = require('@faker-js/faker');
|
|
58
58
|
|
|
59
59
|
module.exports = new Factory()
|
|
60
60
|
// no need to set id, it will be set by REST API
|
|
@@ -231,6 +231,8 @@ I.have('user', { }, { age: 33, height: 55 })
|
|
|
231
231
|
- `params` **any** predefined parameters
|
|
232
232
|
- `options` **any** options for programmatically generate the attributes
|
|
233
233
|
|
|
234
|
+
Returns **[Promise][5]<any>**
|
|
235
|
+
|
|
234
236
|
### haveMultiple
|
|
235
237
|
|
|
236
238
|
Generates bunch of records and saves multiple API requests to store them.
|
|
@@ -260,3 +262,5 @@ I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' });
|
|
|
260
262
|
[3]: http://codecept.io/helpers/REST/
|
|
261
263
|
|
|
262
264
|
[4]: https://github.com/axios/axios#request-config
|
|
265
|
+
|
|
266
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
package/docs/helpers/Appium.md
CHANGED
|
@@ -264,6 +264,8 @@ Appium: support only Android
|
|
|
264
264
|
- `appId` **[string][5]**
|
|
265
265
|
- `bundleId` **[string][5]?** ID of bundle
|
|
266
266
|
|
|
267
|
+
Returns **[Promise][4]<any>**
|
|
268
|
+
|
|
267
269
|
### seeCurrentActivityIs
|
|
268
270
|
|
|
269
271
|
Check current activity on an Android device.
|
|
@@ -396,6 +398,8 @@ Switch to the specified context.
|
|
|
396
398
|
|
|
397
399
|
- `context` **any** the context to switch to
|
|
398
400
|
|
|
401
|
+
Returns **[Promise][4]<any>**
|
|
402
|
+
|
|
399
403
|
### switchToWeb
|
|
400
404
|
|
|
401
405
|
Switches to web context.
|
|
@@ -429,7 +433,7 @@ I.switchToNative('SOME_OTHER_CONTEXT');
|
|
|
429
433
|
|
|
430
434
|
#### Parameters
|
|
431
435
|
|
|
432
|
-
- `context` **any
|
|
436
|
+
- `context` **any?** (optional, default `null`)
|
|
433
437
|
|
|
434
438
|
Returns **[Promise][4]<void>**
|
|
435
439
|
|
|
@@ -506,6 +510,8 @@ Appium: support Android and iOS
|
|
|
506
510
|
- `strategy` **(`"tapOutside"` \| `"pressKey"`)?** Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
507
511
|
- `key` **[string][5]?** Optional key
|
|
508
512
|
|
|
513
|
+
Returns **[Promise][4]<any>**
|
|
514
|
+
|
|
509
515
|
### sendDeviceKeyEvent
|
|
510
516
|
|
|
511
517
|
Send a key event to the device.
|
|
@@ -597,7 +603,9 @@ I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 });
|
|
|
597
603
|
#### Parameters
|
|
598
604
|
|
|
599
605
|
- `from` **[object][8]**
|
|
600
|
-
- `to` **[object][8]**
|
|
606
|
+
- `to` **[object][8]**
|
|
607
|
+
|
|
608
|
+
Returns **[Promise][4]<any>** Appium: support Android and iOS
|
|
601
609
|
|
|
602
610
|
### swipeDown
|
|
603
611
|
|
|
@@ -731,6 +739,8 @@ Appium: support Android and iOS
|
|
|
731
739
|
|
|
732
740
|
- `actions` **[Array][6]** Array of touch actions
|
|
733
741
|
|
|
742
|
+
Returns **[Promise][4]<any>**
|
|
743
|
+
|
|
734
744
|
### pullFile
|
|
735
745
|
|
|
736
746
|
Pulls a file from the device.
|
|
@@ -833,6 +843,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
833
843
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator
|
|
834
844
|
- `value` **[string][5]** text value to append.
|
|
835
845
|
|
|
846
|
+
Returns **[Promise][4]<any>**
|
|
847
|
+
|
|
836
848
|
### checkOption
|
|
837
849
|
|
|
838
850
|
Selects a checkbox or radio button.
|
|
@@ -851,6 +863,8 @@ I.checkOption('agree', '//form');
|
|
|
851
863
|
- `field` **([string][5] \| [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
852
864
|
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator. (optional, default `null`)
|
|
853
865
|
|
|
866
|
+
Returns **[Promise][4]<any>**
|
|
867
|
+
|
|
854
868
|
### click
|
|
855
869
|
|
|
856
870
|
Perform a click on a link or a button, given by a locator.
|
|
@@ -878,7 +892,9 @@ I.click({css: 'nav a.login'});
|
|
|
878
892
|
#### Parameters
|
|
879
893
|
|
|
880
894
|
- `locator` **([string][5] \| [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
881
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
|
|
895
|
+
- `context` **([string][5]? | [object][8] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
|
|
896
|
+
|
|
897
|
+
Returns **[Promise][4]<any>**
|
|
882
898
|
|
|
883
899
|
### dontSeeCheckboxIsChecked
|
|
884
900
|
|
|
@@ -894,6 +910,8 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
894
910
|
|
|
895
911
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
896
912
|
|
|
913
|
+
Returns **[Promise][4]<any>**
|
|
914
|
+
|
|
897
915
|
### dontSeeElement
|
|
898
916
|
|
|
899
917
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
@@ -906,6 +924,8 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
906
924
|
|
|
907
925
|
- `locator` **([string][5] \| [object][8])** located by CSS|XPath|Strict locator.
|
|
908
926
|
|
|
927
|
+
Returns **[Promise][4]<any>**
|
|
928
|
+
|
|
909
929
|
### dontSeeInField
|
|
910
930
|
|
|
911
931
|
Checks that value of input field or textarea doesn't equal to given value
|
|
@@ -921,6 +941,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
921
941
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
922
942
|
- `value` **[string][5]** value to check.
|
|
923
943
|
|
|
944
|
+
Returns **[Promise][4]<any>**
|
|
945
|
+
|
|
924
946
|
### dontSee
|
|
925
947
|
|
|
926
948
|
Opposite to `see`. Checks that a text is not present on a page.
|
|
@@ -936,6 +958,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
936
958
|
- `text` **[string][5]** which is not present.
|
|
937
959
|
- `context` **([string][5] \| [object][8])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. (optional, default `null`)
|
|
938
960
|
|
|
961
|
+
Returns **[Promise][4]<any>**
|
|
962
|
+
|
|
939
963
|
### fillField
|
|
940
964
|
|
|
941
965
|
Fills a text field or textarea, after clearing its value, with the given string.
|
|
@@ -957,6 +981,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
957
981
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
958
982
|
- `value` **([string][5] \| [object][8])** text value to fill.
|
|
959
983
|
|
|
984
|
+
Returns **[Promise][4]<any>**
|
|
985
|
+
|
|
960
986
|
### grabTextFromAll
|
|
961
987
|
|
|
962
988
|
Retrieves all texts from an element located by CSS or XPath and returns it to test.
|
|
@@ -1099,7 +1125,9 @@ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "cent
|
|
|
1099
1125
|
#### Parameters
|
|
1100
1126
|
|
|
1101
1127
|
- `locator` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1102
|
-
- `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][15].
|
|
1128
|
+
- `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][15].
|
|
1129
|
+
|
|
1130
|
+
Returns **[Promise][4]<any>** Supported only for web testing
|
|
1103
1131
|
|
|
1104
1132
|
### seeCheckboxIsChecked
|
|
1105
1133
|
|
|
@@ -1115,6 +1143,8 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1115
1143
|
|
|
1116
1144
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1117
1145
|
|
|
1146
|
+
Returns **[Promise][4]<any>**
|
|
1147
|
+
|
|
1118
1148
|
### seeElement
|
|
1119
1149
|
|
|
1120
1150
|
Checks that a given Element is visible
|
|
@@ -1128,6 +1158,8 @@ I.seeElement('#modal');
|
|
|
1128
1158
|
|
|
1129
1159
|
- `locator` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1130
1160
|
|
|
1161
|
+
Returns **[Promise][4]<any>**
|
|
1162
|
+
|
|
1131
1163
|
### seeInField
|
|
1132
1164
|
|
|
1133
1165
|
Checks that the given input field or textarea equals to given value.
|
|
@@ -1145,6 +1177,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1145
1177
|
- `field` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1146
1178
|
- `value` **[string][5]** value to check.
|
|
1147
1179
|
|
|
1180
|
+
Returns **[Promise][4]<any>**
|
|
1181
|
+
|
|
1148
1182
|
### see
|
|
1149
1183
|
|
|
1150
1184
|
Checks that a page contains a visible text.
|
|
@@ -1161,6 +1195,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1161
1195
|
- `text` **[string][5]** expected on page.
|
|
1162
1196
|
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text. (optional, default `null`)
|
|
1163
1197
|
|
|
1198
|
+
Returns **[Promise][4]<any>**
|
|
1199
|
+
|
|
1164
1200
|
### selectOption
|
|
1165
1201
|
|
|
1166
1202
|
Selects an option in a drop-down select.
|
|
@@ -1185,7 +1221,9 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1185
1221
|
#### Parameters
|
|
1186
1222
|
|
|
1187
1223
|
- `select` **([string][5] \| [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1188
|
-
- `option` **([string][5] \| [Array][6]<any>)** visible text or value of option.
|
|
1224
|
+
- `option` **([string][5] \| [Array][6]<any>)** visible text or value of option.
|
|
1225
|
+
|
|
1226
|
+
Returns **[Promise][4]<any>** Supported only for web testing
|
|
1189
1227
|
|
|
1190
1228
|
### waitForElement
|
|
1191
1229
|
|
|
@@ -1202,6 +1240,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1202
1240
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1203
1241
|
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait (optional, default `null`)
|
|
1204
1242
|
|
|
1243
|
+
Returns **[Promise][4]<any>**
|
|
1244
|
+
|
|
1205
1245
|
### waitForVisible
|
|
1206
1246
|
|
|
1207
1247
|
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
@@ -1216,6 +1256,8 @@ I.waitForVisible('#popup');
|
|
|
1216
1256
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1217
1257
|
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
|
|
1218
1258
|
|
|
1259
|
+
Returns **[Promise][4]<any>**
|
|
1260
|
+
|
|
1219
1261
|
### waitForInvisible
|
|
1220
1262
|
|
|
1221
1263
|
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
@@ -1230,6 +1272,8 @@ I.waitForInvisible('#popup');
|
|
|
1230
1272
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1231
1273
|
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
|
|
1232
1274
|
|
|
1275
|
+
Returns **[Promise][4]<any>**
|
|
1276
|
+
|
|
1233
1277
|
### waitForText
|
|
1234
1278
|
|
|
1235
1279
|
Waits for a text to appear (by default waits for 1sec).
|
|
@@ -1247,6 +1291,8 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1247
1291
|
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`)
|
|
1248
1292
|
- `context` **([string][5] \| [object][8])?** (optional) element located by CSS|XPath|strict locator. (optional, default `null`)
|
|
1249
1293
|
|
|
1294
|
+
Returns **[Promise][4]<any>**
|
|
1295
|
+
|
|
1250
1296
|
### useWebDriverTo
|
|
1251
1297
|
|
|
1252
1298
|
Use [webdriverio][16] API inside a test.
|
|
@@ -1374,6 +1420,8 @@ I.amOnPage('/login'); // opens a login page
|
|
|
1374
1420
|
|
|
1375
1421
|
- `url` **[string][5]** url path or global url.
|
|
1376
1422
|
|
|
1423
|
+
Returns **[Promise][4]<any>**
|
|
1424
|
+
|
|
1377
1425
|
### forceClick
|
|
1378
1426
|
|
|
1379
1427
|
Perform an emulated click on a link or a button, given by a locator.
|
|
@@ -1404,7 +1452,9 @@ I.forceClick({css: 'nav a.login'});
|
|
|
1404
1452
|
#### Parameters
|
|
1405
1453
|
|
|
1406
1454
|
- `locator` **([string][5] \| [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1407
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1455
|
+
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
|
|
1456
|
+
|
|
1457
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1408
1458
|
|
|
1409
1459
|
### doubleClick
|
|
1410
1460
|
|
|
@@ -1421,7 +1471,9 @@ I.doubleClick('.btn.edit');
|
|
|
1421
1471
|
#### Parameters
|
|
1422
1472
|
|
|
1423
1473
|
- `locator` **([string][5] \| [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1424
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1474
|
+
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
|
|
1475
|
+
|
|
1476
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1425
1477
|
|
|
1426
1478
|
### rightClick
|
|
1427
1479
|
|
|
@@ -1439,7 +1491,9 @@ I.rightClick('Click me', '.context');
|
|
|
1439
1491
|
#### Parameters
|
|
1440
1492
|
|
|
1441
1493
|
- `locator` **([string][5] \| [object][8])** clickable element located by CSS|XPath|strict locator.
|
|
1442
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1494
|
+
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator. (optional, default `null`)
|
|
1495
|
+
|
|
1496
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1443
1497
|
|
|
1444
1498
|
### forceRightClick
|
|
1445
1499
|
|
|
@@ -1461,7 +1515,9 @@ I.forceRightClick('Menu');
|
|
|
1461
1515
|
#### Parameters
|
|
1462
1516
|
|
|
1463
1517
|
- `locator` **([string][5] \| [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1464
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1518
|
+
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`)
|
|
1519
|
+
|
|
1520
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1465
1521
|
|
|
1466
1522
|
### clearField
|
|
1467
1523
|
|
|
@@ -1478,6 +1534,8 @@ I.clearField('#email');
|
|
|
1478
1534
|
- `field`
|
|
1479
1535
|
- `editable` **([string][5] \| [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1480
1536
|
|
|
1537
|
+
Returns **[Promise][4]<any>**
|
|
1538
|
+
|
|
1481
1539
|
### attachFile
|
|
1482
1540
|
|
|
1483
1541
|
Attaches a file to element located by label, name, CSS or XPath
|
|
@@ -1493,7 +1551,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
1493
1551
|
|
|
1494
1552
|
- `locator` **([string][5] \| [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1495
1553
|
- `pathToFile` **[string][5]** local file path relative to codecept.json config file.
|
|
1496
|
-
|
|
1554
|
+
|
|
1555
|
+
Returns **[Promise][4]<any>** Appium: not tested
|
|
1497
1556
|
|
|
1498
1557
|
### uncheckOption
|
|
1499
1558
|
|
|
@@ -1511,8 +1570,9 @@ I.uncheckOption('agree', '//form');
|
|
|
1511
1570
|
#### Parameters
|
|
1512
1571
|
|
|
1513
1572
|
- `field` **([string][5] \| [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1514
|
-
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1515
|
-
|
|
1573
|
+
- `context` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator. (optional, default `null`)
|
|
1574
|
+
|
|
1575
|
+
Returns **[Promise][4]<any>** Appium: not tested
|
|
1516
1576
|
|
|
1517
1577
|
### grabHTMLFromAll
|
|
1518
1578
|
|
|
@@ -1560,6 +1620,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1560
1620
|
- `text` **[string][5]** element value to check.
|
|
1561
1621
|
- `context` **([string][5] \| [object][8])?** element located by CSS|XPath|strict locator. (optional, default `null`)
|
|
1562
1622
|
|
|
1623
|
+
Returns **[Promise][4]<any>**
|
|
1624
|
+
|
|
1563
1625
|
### seeElementInDOM
|
|
1564
1626
|
|
|
1565
1627
|
Checks that a given Element is present in the DOM
|
|
@@ -1573,6 +1635,8 @@ I.seeElementInDOM('#modal');
|
|
|
1573
1635
|
|
|
1574
1636
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1575
1637
|
|
|
1638
|
+
Returns **[Promise][4]<any>**
|
|
1639
|
+
|
|
1576
1640
|
### dontSeeElementInDOM
|
|
1577
1641
|
|
|
1578
1642
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
@@ -1585,6 +1649,8 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
1585
1649
|
|
|
1586
1650
|
- `locator` **([string][5] \| [object][8])** located by CSS|XPath|Strict locator.
|
|
1587
1651
|
|
|
1652
|
+
Returns **[Promise][4]<any>**
|
|
1653
|
+
|
|
1588
1654
|
### seeInSource
|
|
1589
1655
|
|
|
1590
1656
|
Checks that the current page contains the given string in its raw source code.
|
|
@@ -1597,6 +1663,8 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1597
1663
|
|
|
1598
1664
|
- `text` **[string][5]** value to check.
|
|
1599
1665
|
|
|
1666
|
+
Returns **[Promise][4]<any>**
|
|
1667
|
+
|
|
1600
1668
|
### grabSource
|
|
1601
1669
|
|
|
1602
1670
|
Retrieves page source and returns it to test.
|
|
@@ -1633,6 +1701,8 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
1633
1701
|
- `text`
|
|
1634
1702
|
- `value` **[string][5]** to check.
|
|
1635
1703
|
|
|
1704
|
+
Returns **[Promise][4]<any>**
|
|
1705
|
+
|
|
1636
1706
|
### seeNumberOfElements
|
|
1637
1707
|
|
|
1638
1708
|
Asserts that an element appears a given number of times in the DOM.
|
|
@@ -1645,7 +1715,9 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1645
1715
|
#### Parameters
|
|
1646
1716
|
|
|
1647
1717
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1648
|
-
- `num` **[number][10]** number of elements.
|
|
1718
|
+
- `num` **[number][10]** number of elements.
|
|
1719
|
+
|
|
1720
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1649
1721
|
|
|
1650
1722
|
### seeNumberOfVisibleElements
|
|
1651
1723
|
|
|
@@ -1659,7 +1731,9 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1659
1731
|
#### Parameters
|
|
1660
1732
|
|
|
1661
1733
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1662
|
-
- `num` **[number][10]** number of elements.
|
|
1734
|
+
- `num` **[number][10]** number of elements.
|
|
1735
|
+
|
|
1736
|
+
Returns **[Promise][4]<any>** {{ react }}
|
|
1663
1737
|
|
|
1664
1738
|
### seeAttributesOnElements
|
|
1665
1739
|
|
|
@@ -1674,6 +1748,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1674
1748
|
- `locator` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1675
1749
|
- `attributes` **[object][8]** attributes and their values to check.
|
|
1676
1750
|
|
|
1751
|
+
Returns **[Promise][4]<any>**
|
|
1752
|
+
|
|
1677
1753
|
### scrollTo
|
|
1678
1754
|
|
|
1679
1755
|
Scrolls to element matched by locator.
|
|
@@ -1690,6 +1766,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1690
1766
|
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset. (optional, default `0`)
|
|
1691
1767
|
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset. (optional, default `0`)
|
|
1692
1768
|
|
|
1769
|
+
Returns **[Promise][4]<any>**
|
|
1770
|
+
|
|
1693
1771
|
### moveCursorTo
|
|
1694
1772
|
|
|
1695
1773
|
Moves cursor to element matched by locator.
|
|
@@ -1708,6 +1786,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1708
1786
|
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset. (optional, default `0`)
|
|
1709
1787
|
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset. (optional, default `0`)
|
|
1710
1788
|
|
|
1789
|
+
Returns **[Promise][4]<any>**
|
|
1790
|
+
|
|
1711
1791
|
### saveElementScreenshot
|
|
1712
1792
|
|
|
1713
1793
|
Saves screenshot of the specified locator to ouput folder (set in codecept.json or codecept.conf.js).
|
|
@@ -1722,6 +1802,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1722
1802
|
- `locator` **([string][5] \| [object][8])** element located by CSS|XPath|strict locator.
|
|
1723
1803
|
- `fileName` **[string][5]** file name to save.
|
|
1724
1804
|
|
|
1805
|
+
Returns **[Promise][4]<any>**
|
|
1806
|
+
|
|
1725
1807
|
### type
|
|
1726
1808
|
|
|
1727
1809
|
Types out the given text into an active field.
|
|
@@ -1745,6 +1827,8 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1745
1827
|
- `delay` **[number][10]?** (optional) delay in ms between key presses (optional, default `null`)
|
|
1746
1828
|
- `key` **([string][5] \| [Array][6]<[string][5]>)** or array of keys to type.
|
|
1747
1829
|
|
|
1830
|
+
Returns **[Promise][4]<any>**
|
|
1831
|
+
|
|
1748
1832
|
### dragAndDrop
|
|
1749
1833
|
|
|
1750
1834
|
Drag an item to a destination element.
|
|
@@ -1756,7 +1840,9 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
1756
1840
|
#### Parameters
|
|
1757
1841
|
|
|
1758
1842
|
- `srcElement` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1759
|
-
- `destElement` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1843
|
+
- `destElement` **([string][5] \| [object][8])** located by CSS|XPath|strict locator.
|
|
1844
|
+
|
|
1845
|
+
Returns **[Promise][4]<any>** Appium: not tested
|
|
1760
1846
|
|
|
1761
1847
|
### dragSlider
|
|
1762
1848
|
|
|
@@ -1773,6 +1859,8 @@ I.dragSlider('#slider', -70);
|
|
|
1773
1859
|
- `locator` **([string][5] \| [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1774
1860
|
- `offsetX` **[number][10]** position to drag. (optional, default `0`)
|
|
1775
1861
|
|
|
1862
|
+
Returns **[Promise][4]<any>**
|
|
1863
|
+
|
|
1776
1864
|
### grabAllWindowHandles
|
|
1777
1865
|
|
|
1778
1866
|
Get all Window Handles.
|
|
@@ -1821,6 +1909,8 @@ Close all tabs except for the current one.
|
|
|
1821
1909
|
I.closeOtherTabs();
|
|
1822
1910
|
```
|
|
1823
1911
|
|
|
1912
|
+
Returns **[Promise][4]<any>**
|
|
1913
|
+
|
|
1824
1914
|
### switchTo
|
|
1825
1915
|
|
|
1826
1916
|
Switches frame or in case of null locator reverts to parent.
|
|
@@ -1834,6 +1924,8 @@ I.switchTo(); // switch back to main page
|
|
|
1834
1924
|
|
|
1835
1925
|
- `locator` **([string][5]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator. (optional, default `null`)
|
|
1836
1926
|
|
|
1927
|
+
Returns **[Promise][4]<any>**
|
|
1928
|
+
|
|
1837
1929
|
### grabNumberOfOpenTabs
|
|
1838
1930
|
|
|
1839
1931
|
Grab number of open tabs.
|
|
@@ -1853,6 +1945,8 @@ Scroll page to the top.
|
|
|
1853
1945
|
I.scrollPageToTop();
|
|
1854
1946
|
```
|
|
1855
1947
|
|
|
1948
|
+
Returns **[Promise][4]<any>**
|
|
1949
|
+
|
|
1856
1950
|
### scrollPageToBottom
|
|
1857
1951
|
|
|
1858
1952
|
Scroll page to the bottom.
|
|
@@ -1861,6 +1955,8 @@ Scroll page to the bottom.
|
|
|
1861
1955
|
I.scrollPageToBottom();
|
|
1862
1956
|
```
|
|
1863
1957
|
|
|
1958
|
+
Returns **[Promise][4]<any>**
|
|
1959
|
+
|
|
1864
1960
|
### grabPageScrollPosition
|
|
1865
1961
|
|
|
1866
1962
|
Retrieves a page scroll position and returns it to test.
|
|
@@ -1887,6 +1983,8 @@ I.setGeoLocation(121.21, 11.56, 10);
|
|
|
1887
1983
|
- `longitude` **[number][10]** to set
|
|
1888
1984
|
- `altitude` **[number][10]?** (optional, null by default) to set (optional, default `null`)
|
|
1889
1985
|
|
|
1986
|
+
Returns **[Promise][4]<any>**
|
|
1987
|
+
|
|
1890
1988
|
### grabGeoLocation
|
|
1891
1989
|
|
|
1892
1990
|
Return the current geo location
|
package/docs/helpers/GraphQL.md
CHANGED
|
@@ -66,6 +66,8 @@ Prepares request for axios call
|
|
|
66
66
|
- `operation` **[object][2]**
|
|
67
67
|
- `headers` **[object][2]**
|
|
68
68
|
|
|
69
|
+
Returns **[object][2]** graphQLRequest
|
|
70
|
+
|
|
69
71
|
### sendMutation
|
|
70
72
|
|
|
71
73
|
Send query to GraphQL endpoint over http
|
|
@@ -95,6 +97,8 @@ I.sendMutation(`
|
|
|
95
97
|
- `options` **[object][2]** are additional query options
|
|
96
98
|
- `headers` **[object][2]**
|
|
97
99
|
|
|
100
|
+
Returns **any** Promise<any>
|
|
101
|
+
|
|
98
102
|
### sendQuery
|
|
99
103
|
|
|
100
104
|
Send query to GraphQL endpoint over http.
|
|
@@ -117,6 +121,8 @@ const user = response.data.data;
|
|
|
117
121
|
- `options` **[object][2]** are additional query options
|
|
118
122
|
- `headers` **[object][2]**
|
|
119
123
|
|
|
124
|
+
Returns **any** Promise<any>
|
|
125
|
+
|
|
120
126
|
[1]: https://github.com/axios/axios
|
|
121
127
|
|
|
122
128
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
@@ -43,7 +43,7 @@ To make this work you need
|
|
|
43
43
|
Install [Rosie][1] and [Faker][2] libraries.
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
npm i rosie faker --save-dev
|
|
46
|
+
npm i rosie @faker-js/faker --save-dev
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Create a factory file for a resource.
|
|
@@ -53,8 +53,8 @@ See the example for Users factories:
|
|
|
53
53
|
```js
|
|
54
54
|
// tests/factories/users.js
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const Factory = require('rosie').Factory;
|
|
57
|
+
const faker = require('@faker-js/faker');
|
|
58
58
|
|
|
59
59
|
// Used with a constructor function passed to Factory, so that the final build
|
|
60
60
|
// object matches the necessary pattern to be sent as the variables object.
|
|
@@ -207,7 +207,7 @@ Executes a callback function passing in `response` object and chai assertions wi
|
|
|
207
207
|
Use it to perform custom checks of response data
|
|
208
208
|
|
|
209
209
|
```js
|
|
210
|
-
I.seeResponseValidByCallback({ data, status, expect } => {
|
|
210
|
+
I.seeResponseValidByCallback(({ data, status, expect }) => {
|
|
211
211
|
expect(status).to.eql(200);
|
|
212
212
|
expect(data).keys.to.include(['user', 'company']);
|
|
213
213
|
});
|