codeceptjs 3.5.4 → 3.5.6
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/docs/build/Appium.js +40 -1
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +4 -0
- package/docs/build/Playwright.js +59 -41
- package/docs/build/Protractor.js +4 -0
- package/docs/build/Puppeteer.js +21 -10
- package/docs/build/TestCafe.js +2 -0
- package/docs/build/WebDriver.js +8 -4
- package/docs/changelog.md +1 -170
- package/docs/community-helpers.md +4 -8
- package/docs/examples.md +2 -8
- package/docs/helpers/Appium.md +37 -0
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +26 -24
- package/docs/helpers/Playwright.md +1 -1
- package/docs/helpers/Protractor.md +4 -2
- package/docs/helpers/Puppeteer.md +29 -27
- package/docs/helpers/TestCafe.md +16 -15
- package/docs/helpers/WebDriver.md +32 -30
- package/docs/webapi/executeAsyncScript.mustache +2 -0
- package/docs/webapi/executeScript.mustache +2 -0
- package/lib/codecept.js +4 -0
- package/lib/command/info.js +24 -0
- package/lib/command/init.js +40 -4
- package/lib/command/run-workers.js +5 -0
- package/lib/command/run.js +7 -0
- package/lib/data/context.js +14 -6
- package/lib/helper/Appium.js +40 -1
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Playwright.js +58 -40
- package/lib/helper/Puppeteer.js +17 -10
- package/lib/helper/WebDriver.js +4 -4
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/pause.js +1 -2
- package/lib/plugin/autoLogin.js +0 -5
- package/lib/plugin/retryTo.js +0 -2
- package/lib/plugin/tryTo.js +0 -3
- package/lib/session.js +1 -1
- package/package.json +88 -88
- package/translations/fr-FR.js +13 -1
- package/typings/promiseBasedTypes.d.ts +19 -1
- package/typings/types.d.ts +36 -16
package/docs/changelog.md
CHANGED
|
@@ -7,180 +7,11 @@ layout: Section
|
|
|
7
7
|
|
|
8
8
|
# Releases
|
|
9
9
|
|
|
10
|
-
## 3.5.4
|
|
11
|
-
|
|
12
|
-
🐛 Bug Fixes:
|
|
13
|
-
* **[Playwright]** When passing `userDataDir`, it throws error after test execution ([#3814](https://github.com/codeceptjs/CodeceptJS/issues/3814)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
14
|
-
* [CodeceptJS-CLI] Improve command to generate types ([#3788](https://github.com/codeceptjs/CodeceptJS/issues/3788)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
15
|
-
* Heal plugin fix ([#3820](https://github.com/codeceptjs/CodeceptJS/issues/3820)) - by **[davert](https://github.com/davert)**
|
|
16
|
-
* Fix for error in using `all` with `run-workers` ([#3805](https://github.com/codeceptjs/CodeceptJS/issues/3805)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
17
|
-
```js
|
|
18
|
-
helpers: {
|
|
19
|
-
Playwright: {
|
|
20
|
-
url: 'https://github.com',
|
|
21
|
-
show: false,
|
|
22
|
-
browser: 'chromium',
|
|
23
|
-
waitForNavigation: 'load',
|
|
24
|
-
waitForTimeout: 30_000,
|
|
25
|
-
trace: true,
|
|
26
|
-
keepTraceForPassedTests: true
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
multiple: {
|
|
30
|
-
profile1: {
|
|
31
|
-
browsers: [
|
|
32
|
-
{
|
|
33
|
-
browser: "chromium",
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
```
|
|
39
|
-
* Highlight elements issues ([#3779](https://github.com/codeceptjs/CodeceptJS/issues/3779)) ([#3778](https://github.com/codeceptjs/CodeceptJS/issues/3778)) - by **[philkas](https://github.com/philkas)**
|
|
40
|
-
* Support ` ` symbol in `I.see` method ([#3815](https://github.com/codeceptjs/CodeceptJS/issues/3815)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
// HTML code uses instead of space
|
|
44
|
-
<div class="dJHe_" style="color: rgb(255, 255, 255);">My Text!</div>
|
|
45
|
-
|
|
46
|
-
I.see("My Text!") // this test would work with both and space
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
📖 Documentation
|
|
50
|
-
* Improve the configuration of electron testing when the app is build with electron-forge ([#3802](https://github.com/codeceptjs/CodeceptJS/issues/3802)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
51
|
-
|
|
52
|
-
```js
|
|
53
|
-
const path = require("path");
|
|
54
|
-
|
|
55
|
-
exports.config = {
|
|
56
|
-
helpers: {
|
|
57
|
-
Playwright: {
|
|
58
|
-
browser: "electron",
|
|
59
|
-
electron: {
|
|
60
|
-
executablePath: require("electron"),
|
|
61
|
-
args: [path.join(__dirname, ".webpack/main/index.js")],
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
// rest of config
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
🛩️ Features
|
|
70
|
-
|
|
71
|
-
#### **[Playwright]** new features and improvements
|
|
72
|
-
* Parse the response in recording network steps ([#3771](https://github.com/codeceptjs/CodeceptJS/issues/3771)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
const traffics = await I.grabRecordedNetworkTraffics();
|
|
76
|
-
expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
77
|
-
expect(traffics[0].response.status).to.equal(200);
|
|
78
|
-
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
79
|
-
|
|
80
|
-
expect(traffics[1].url).to.equal('https://reqres.in/api/comments/1');
|
|
81
|
-
expect(traffics[1].response.status).to.equal(200);
|
|
82
|
-
expect(traffics[1].response.body).to.contain({ name: 'this was another mocked' });
|
|
83
|
-
```
|
|
84
|
-
* Grab metrics ([#3809](https://github.com/codeceptjs/CodeceptJS/issues/3809)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
85
|
-
|
|
86
|
-
```js
|
|
87
|
-
const metrics = await I.grabMetrics();
|
|
88
|
-
|
|
89
|
-
// returned metrics
|
|
90
|
-
|
|
91
|
-
[
|
|
92
|
-
{ name: 'Timestamp', value: 1584904.203473 },
|
|
93
|
-
{ name: 'AudioHandlers', value: 0 },
|
|
94
|
-
{ name: 'AudioWorkletProcessors', value: 0 },
|
|
95
|
-
{ name: 'Documents', value: 22 },
|
|
96
|
-
{ name: 'Frames', value: 10 },
|
|
97
|
-
{ name: 'JSEventListeners', value: 366 },
|
|
98
|
-
{ name: 'LayoutObjects', value: 1240 },
|
|
99
|
-
{ name: 'MediaKeySessions', value: 0 },
|
|
100
|
-
{ name: 'MediaKeys', value: 0 },
|
|
101
|
-
{ name: 'Nodes', value: 4505 },
|
|
102
|
-
{ name: 'Resources', value: 141 },
|
|
103
|
-
{ name: 'ContextLifecycleStateObservers', value: 34 },
|
|
104
|
-
{ name: 'V8PerContextDatas', value: 4 },
|
|
105
|
-
{ name: 'WorkerGlobalScopes', value: 0 },
|
|
106
|
-
{ name: 'UACSSResources', value: 0 },
|
|
107
|
-
{ name: 'RTCPeerConnections', value: 0 },
|
|
108
|
-
{ name: 'ResourceFetchers', value: 22 },
|
|
109
|
-
{ name: 'AdSubframes', value: 0 },
|
|
110
|
-
{ name: 'DetachedScriptStates', value: 2 },
|
|
111
|
-
{ name: 'ArrayBufferContents', value: 1 },
|
|
112
|
-
{ name: 'LayoutCount', value: 0 },
|
|
113
|
-
{ name: 'RecalcStyleCount', value: 0 },
|
|
114
|
-
{ name: 'LayoutDuration', value: 0 },
|
|
115
|
-
{ name: 'RecalcStyleDuration', value: 0 },
|
|
116
|
-
{ name: 'DevToolsCommandDuration', value: 0.000013 },
|
|
117
|
-
{ name: 'ScriptDuration', value: 0 },
|
|
118
|
-
{ name: 'V8CompileDuration', value: 0 },
|
|
119
|
-
{ name: 'TaskDuration', value: 0.000014 },
|
|
120
|
-
{ name: 'TaskOtherDuration', value: 0.000001 },
|
|
121
|
-
{ name: 'ThreadTime', value: 0.000046 },
|
|
122
|
-
{ name: 'ProcessTime', value: 0.616852 },
|
|
123
|
-
{ name: 'JSHeapUsedSize', value: 19004908 },
|
|
124
|
-
{ name: 'JSHeapTotalSize', value: 26820608 },
|
|
125
|
-
{ name: 'FirstMeaningfulPaint', value: 0 },
|
|
126
|
-
{ name: 'DomContentLoaded', value: 1584903.690491 },
|
|
127
|
-
{ name: 'NavigationStart', value: 1584902.841845 }
|
|
128
|
-
]
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
* Grab WebSocket (WS) messages ([#3789](https://github.com/codeceptjs/CodeceptJS/issues/3789)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
132
|
-
* `flushWebSocketMessages`
|
|
133
|
-
* `grabWebSocketMessages`
|
|
134
|
-
* `startRecordingWebSocketMessages`
|
|
135
|
-
* `stopRecordingWebSocketMessages`
|
|
136
|
-
|
|
137
|
-
```js
|
|
138
|
-
await I.startRecordingWebSocketMessages();
|
|
139
|
-
I.amOnPage('https://websocketstest.com/');
|
|
140
|
-
I.waitForText('Work for You!');
|
|
141
|
-
I.flushNetworkTraffics();
|
|
142
|
-
const wsMessages = I.grabWebSocketMessages();
|
|
143
|
-
expect(wsMessages.length).to.equal(0);
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
```js
|
|
147
|
-
await I.startRecordingWebSocketMessages();
|
|
148
|
-
await I.amOnPage('https://websocketstest.com/');
|
|
149
|
-
I.waitForText('Work for You!');
|
|
150
|
-
const wsMessages = I.grabWebSocketMessages();
|
|
151
|
-
expect(wsMessages.length).to.greaterThan(0);
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
```js
|
|
155
|
-
await I.startRecordingWebSocketMessages();
|
|
156
|
-
await I.amOnPage('https://websocketstest.com/');
|
|
157
|
-
I.waitForText('Work for You!');
|
|
158
|
-
const wsMessages = I.grabWebSocketMessages();
|
|
159
|
-
await I.stopRecordingWebSocketMessages();
|
|
160
|
-
await I.amOnPage('https://websocketstest.com/');
|
|
161
|
-
I.waitForText('Work for You!');
|
|
162
|
-
const afterWsMessages = I.grabWebSocketMessages();
|
|
163
|
-
expect(wsMessages.length).to.equal(afterWsMessages.length);
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
* Move from `ElementHandle` to `Locator`. This change is quite major, but it happened under hood, so should not affect your code. ([#3738](https://github.com/codeceptjs/CodeceptJS/issues/3738)) - by **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
167
|
-
|
|
168
10
|
## 3.5.3
|
|
169
11
|
|
|
170
12
|
🛩️ Features
|
|
171
13
|
|
|
172
|
-
* **[Playwright]**
|
|
173
|
-
* `startRecordingTraffic`
|
|
174
|
-
* `grabRecordedNetworkTraffics`
|
|
175
|
-
* `blockTraffic`
|
|
176
|
-
* `mockTraffic`
|
|
177
|
-
* `flushNetworkTraffics`
|
|
178
|
-
* `stopRecordingTraffic`
|
|
179
|
-
* `seeTraffic`
|
|
180
|
-
* `grabTrafficUrl`
|
|
181
|
-
* `dontSeeTraffic`
|
|
182
|
-
|
|
183
|
-
Examples:
|
|
14
|
+
* **[Playwright]** Provide new steps to check network traffic [#3748](https://github.com/codeceptjs/CodeceptJS/issues/3748) - by **[ngraf](https://github.com/ngraf)** **[KobeNguyenT](https://github.com/KobeNguyenT)**
|
|
184
15
|
|
|
185
16
|
```js
|
|
186
17
|
// recording traffics and verify the traffic
|
|
@@ -31,6 +31,9 @@ Please **add your own** by editing this page.
|
|
|
31
31
|
* [codeceptjs-bshelper](https://github.com/PeterNgTr/codeceptjs-bshelper) - a helper which updates `Test Names` & `Test Results` on Browserstack
|
|
32
32
|
* [codeceptjs-tbhelper](https://github.com/testingbot/codeceptjs-tbhelper) - a helper which updates `Test Names` & `Test Results` on TestingBot
|
|
33
33
|
|
|
34
|
+
## Integrations
|
|
35
|
+
* [codeceptjs-testrail](https://github.com/PeterNgTr/codeceptjs-testrail) - a plugin to integrate with [Testrail](https://www.gurock.com/testrail)
|
|
36
|
+
|
|
34
37
|
## Visual-Testing
|
|
35
38
|
* [codeceptjs-resemblehelper](https://github.com/puneet0191/codeceptjs-resemblehelper) - a helper which helps with visual testing using resemble.js.
|
|
36
39
|
* [codeceptjs-applitoolshelper](https://www.npmjs.com/package/codeceptjs-applitoolshelper) - a helper which helps interaction with [Applitools](https://applitools.com)
|
|
@@ -39,10 +42,8 @@ Please **add your own** by editing this page.
|
|
|
39
42
|
## Reporters
|
|
40
43
|
* [codeceptjs-rphelper](https://github.com/reportportal/agent-js-codecept) is a CodeceptJS helper which can publish tests results on ReportPortal after execution.
|
|
41
44
|
* [codeceptjs-xray-helper](https://www.npmjs.com/package/codeceptjs-xray-helper) is a CodeceptJS helper which can publish tests results on [XRAY](https://confluence.xpand-it.com/display/XRAYCLOUD/Import+Execution+Results+-+REST).
|
|
42
|
-
* [codeceptjs-xray-cloud-helper](https://www.npmjs.com/package/codeceptjs-xray-cloud-helper) is a helper that automatically retrieves the result of CodeceptJS tests and sends them to XRAY/JIRA(cloud version) via [XRAY Cloud API](https://docs.getxray.app/display/XRAYCLOUD/Import+Execution+Results+-+REST+v2#ImportExecutionResultsRESTv2-XrayJSONresults).
|
|
43
45
|
* [codeceptjs-slack-reporter](https://www.npmjs.com/package/codeceptjs-slack-reporter) Get a Slack notification when one or more scenarios fail.
|
|
44
46
|
* [codeceptjs-browserlogs-plugin](https://github.com/pavkam/codeceptjs-browserlogs-plugin) Record the browser logs for failed tests.
|
|
45
|
-
* [codeceptjs-testrail](https://github.com/PeterNgTr/codeceptjs-testrail) - a plugin to integrate with [Testrail](https://www.gurock.com/testrail)
|
|
46
47
|
|
|
47
48
|
## Browser request control
|
|
48
49
|
* [codeceptjs-resources-check](https://github.com/luarmr/codeceptjs-resources-check) Load a URL with Puppeteer and listen to the requests while the page is loading. Enabling count the number or check the sizes of the requests.
|
|
@@ -54,9 +55,4 @@ Please **add your own** by editing this page.
|
|
|
54
55
|
## Other
|
|
55
56
|
|
|
56
57
|
* [codeceptjs-cmdhelper](https://github.com/thiagodp/codeceptjs-cmdhelper) allows you to run commands in the terminal/console
|
|
57
|
-
* [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
|
|
58
|
-
* [codeceptjs-datalayer-helper](https://github.com/kobenguyent/codeceptjs-datalayer-helper) CodeceptJS DataLayer helper helps you to get the datalayer JavaScript array that is used to store information and send this data to the tag manager.
|
|
59
|
-
* [codeceptjs-a11y-helper](https://github.com/kobenguyent/codeceptjs-a11y-helper) accessibility tests integrated with CodeceptJS - Playwright-axe
|
|
60
|
-
* [codeceptjs-lighthouse-helper](https://github.com/kobenguyent/codeceptjs-lighthouse-helper) lighthouse audit integrated with CodeceptJS - Playwright
|
|
61
|
-
* [Snowplow Data analytics](https://www.npmjs.com/package/@viasat/codeceptjs-snowplow-helper) - Test your Snowplow events implementations with CodeceptJS and Snowplow Micro.
|
|
62
|
-
* [codeceptjs-failure-logger](https://github.com/kobenguyent/codeceptjs-failure-logger) - Log failed CodeceptJS tests to file
|
|
58
|
+
* [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
|
package/docs/examples.md
CHANGED
|
@@ -16,7 +16,6 @@ Playground repository where you can run tests in different helpers on a basic si
|
|
|
16
16
|
|
|
17
17
|
Tests repository demonstrate usage of
|
|
18
18
|
|
|
19
|
-
* Playwright helper
|
|
20
19
|
* Puppeteer helper
|
|
21
20
|
* WebDriver helper
|
|
22
21
|
* TestCafe plugin
|
|
@@ -29,6 +28,7 @@ Tests repository demonstrate usage of
|
|
|
29
28
|
CodeceptJS repo contains basic tests (both failing and passing) just to show how it works.
|
|
30
29
|
Our team uses it to test new features and run simple scenarios.
|
|
31
30
|
|
|
31
|
+
|
|
32
32
|
## [CodeceptJS Cucumber E2E Framework](https://github.com/gkushang/codeceptjs-e2e)
|
|
33
33
|
|
|
34
34
|
This repository contains complete E2E framework for CodeceptJS with Cucumber and SauceLabs Integration
|
|
@@ -146,10 +146,4 @@ This is necessary if all integrations with TMS and CI/CD are already configured,
|
|
|
146
146
|
* HTTP request client with session support and unit tests
|
|
147
147
|
* Exemplary code control
|
|
148
148
|
* Ready to launch in a CI/CD system as is
|
|
149
|
-
* OOP, Test data models and builders, endpoint decorators
|
|
150
|
-
|
|
151
|
-
## [Playwright fun with CodeceptJS](https://github.com/PeterNgTr/codeceptjs-playwright-fun)
|
|
152
|
-
* Tests are written in TS
|
|
153
|
-
* CI/CD with Github Actions
|
|
154
|
-
* Page Object Model is applied
|
|
155
|
-
* ReportPortal Integration
|
|
149
|
+
* OOP, Test data models and builders, endpoint decorators
|
package/docs/helpers/Appium.md
CHANGED
|
@@ -99,6 +99,43 @@ helpers: {
|
|
|
99
99
|
}
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
Example Android App using Appiumv2 on BrowserStack:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
{
|
|
106
|
+
helpers: {
|
|
107
|
+
Appium: {
|
|
108
|
+
appiumV2: true,
|
|
109
|
+
host: "hub-cloud.browserstack.com",
|
|
110
|
+
port: 4444,
|
|
111
|
+
user: process.env.BROWSERSTACK_USER,
|
|
112
|
+
key: process.env.BROWSERSTACK_KEY,
|
|
113
|
+
app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
|
|
114
|
+
browser: '',
|
|
115
|
+
desiredCapabilities: {
|
|
116
|
+
'appPackage': data.packageName,
|
|
117
|
+
'deviceName': process.env.DEVICE || 'Google Pixel 3',
|
|
118
|
+
'platformName': process.env.PLATFORM || 'android',
|
|
119
|
+
'platformVersion': process.env.OS_VERSION || '10.0',
|
|
120
|
+
'automationName': process.env.ENGINE || 'UIAutomator2',
|
|
121
|
+
'newCommandTimeout': 300000,
|
|
122
|
+
'androidDeviceReadyTimeout': 300000,
|
|
123
|
+
'androidInstallTimeout': 90000,
|
|
124
|
+
'appWaitDuration': 300000,
|
|
125
|
+
'autoGrantPermissions': true,
|
|
126
|
+
'gpsEnabled': true,
|
|
127
|
+
'isHeadless': false,
|
|
128
|
+
'noReset': false,
|
|
129
|
+
'noSign': true,
|
|
130
|
+
'bstack:options' : {
|
|
131
|
+
"appiumVersion" : "2.0.1",
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
102
139
|
Additional configuration params can be used from [https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md][4]
|
|
103
140
|
|
|
104
141
|
## Access From Helpers
|
|
@@ -379,9 +379,10 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
379
379
|
#### Parameters
|
|
380
380
|
|
|
381
381
|
- `args` **...any** to be passed to function.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
- `fn` **([string][3] | [function][7])** function to be executed in browser context.
|
|
383
|
+
|
|
384
|
+
Returns **[Promise][8]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderWrapper for asynchronous [evaluate][9].
|
|
385
|
+
Unlike NightmareJS implementation calling `done` will return its first argument.
|
|
385
386
|
|
|
386
387
|
### executeScript
|
|
387
388
|
|
|
@@ -412,8 +413,9 @@ let date = await I.executeScript(function(el) {
|
|
|
412
413
|
#### Parameters
|
|
413
414
|
|
|
414
415
|
- `args` **...any** to be passed to function.
|
|
415
|
-
|
|
416
|
-
|
|
416
|
+
- `fn` **([string][3] | [function][7])** function to be executed in browser context.
|
|
417
|
+
|
|
418
|
+
Returns **[Promise][8]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderWrapper for synchronous [evaluate][9]
|
|
417
419
|
|
|
418
420
|
### fillField
|
|
419
421
|
|
|
@@ -452,7 +454,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
452
454
|
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
453
455
|
- `attr` **[string][3]** attribute name.
|
|
454
456
|
|
|
455
|
-
Returns **[Promise][
|
|
457
|
+
Returns **[Promise][8]<[string][3]>** attribute value
|
|
456
458
|
|
|
457
459
|
### grabAttributeFromAll
|
|
458
460
|
|
|
@@ -468,7 +470,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
468
470
|
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
469
471
|
- `attr` **[string][3]** attribute name.
|
|
470
472
|
|
|
471
|
-
Returns **[Promise][
|
|
473
|
+
Returns **[Promise][8]<[Array][10]<[string][3]>>** attribute value
|
|
472
474
|
|
|
473
475
|
### grabCookie
|
|
474
476
|
|
|
@@ -485,7 +487,7 @@ assert(cookie.value, '123456');
|
|
|
485
487
|
|
|
486
488
|
- `name` **[string][3]?** cookie name.
|
|
487
489
|
|
|
488
|
-
Returns **([Promise][
|
|
490
|
+
Returns **([Promise][8]<[string][3]> | [Promise][8]<[Array][10]<[string][3]>>)** attribute valueCookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
|
|
489
491
|
|
|
490
492
|
### grabCssPropertyFrom
|
|
491
493
|
|
|
@@ -502,7 +504,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
502
504
|
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
503
505
|
- `cssProperty` **[string][3]** CSS property name.
|
|
504
506
|
|
|
505
|
-
Returns **[Promise][
|
|
507
|
+
Returns **[Promise][8]<[string][3]>** CSS value
|
|
506
508
|
|
|
507
509
|
### grabCurrentUrl
|
|
508
510
|
|
|
@@ -514,7 +516,7 @@ let url = await I.grabCurrentUrl();
|
|
|
514
516
|
console.log(`Current URL is [${url}]`);
|
|
515
517
|
```
|
|
516
518
|
|
|
517
|
-
Returns **[Promise][
|
|
519
|
+
Returns **[Promise][8]<[string][3]>** current URL
|
|
518
520
|
|
|
519
521
|
### grabElementBoundingRect
|
|
520
522
|
|
|
@@ -542,7 +544,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
542
544
|
- `prop`
|
|
543
545
|
- `elementSize` **[string][3]?** x, y, width or height of the given element.
|
|
544
546
|
|
|
545
|
-
Returns **([Promise][
|
|
547
|
+
Returns **([Promise][8]<DOMRect> | [Promise][8]<[number][11]>)** Element bounding rectangle
|
|
546
548
|
|
|
547
549
|
### grabHAR
|
|
548
550
|
|
|
@@ -568,7 +570,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
568
570
|
- `locator`
|
|
569
571
|
- `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
570
572
|
|
|
571
|
-
Returns **[Promise][
|
|
573
|
+
Returns **[Promise][8]<[string][3]>** HTML code for an element
|
|
572
574
|
|
|
573
575
|
### grabHTMLFromAll
|
|
574
576
|
|
|
@@ -584,7 +586,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
584
586
|
- `locator`
|
|
585
587
|
- `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
586
588
|
|
|
587
|
-
Returns **[Promise][
|
|
589
|
+
Returns **[Promise][8]<[Array][10]<[string][3]>>** HTML code for an element
|
|
588
590
|
|
|
589
591
|
### grabNumberOfVisibleElements
|
|
590
592
|
|
|
@@ -599,7 +601,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
599
601
|
|
|
600
602
|
- `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
601
603
|
|
|
602
|
-
Returns **[Promise][
|
|
604
|
+
Returns **[Promise][8]<[number][11]>** number of visible elements
|
|
603
605
|
|
|
604
606
|
### grabPageScrollPosition
|
|
605
607
|
|
|
@@ -610,7 +612,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
610
612
|
let { x, y } = await I.grabPageScrollPosition();
|
|
611
613
|
```
|
|
612
614
|
|
|
613
|
-
Returns **[Promise][
|
|
615
|
+
Returns **[Promise][8]<PageScrollPosition>** scroll position
|
|
614
616
|
|
|
615
617
|
### grabTextFrom
|
|
616
618
|
|
|
@@ -627,7 +629,7 @@ If multiple elements found returns first element.
|
|
|
627
629
|
|
|
628
630
|
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
629
631
|
|
|
630
|
-
Returns **[Promise][
|
|
632
|
+
Returns **[Promise][8]<[string][3]>** attribute value
|
|
631
633
|
|
|
632
634
|
### grabTextFromAll
|
|
633
635
|
|
|
@@ -642,7 +644,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
642
644
|
|
|
643
645
|
- `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
644
646
|
|
|
645
|
-
Returns **[Promise][
|
|
647
|
+
Returns **[Promise][8]<[Array][10]<[string][3]>>** attribute value
|
|
646
648
|
|
|
647
649
|
### grabTitle
|
|
648
650
|
|
|
@@ -653,7 +655,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
653
655
|
let title = await I.grabTitle();
|
|
654
656
|
```
|
|
655
657
|
|
|
656
|
-
Returns **[Promise][
|
|
658
|
+
Returns **[Promise][8]<[string][3]>** title
|
|
657
659
|
|
|
658
660
|
### grabValueFrom
|
|
659
661
|
|
|
@@ -669,7 +671,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
669
671
|
|
|
670
672
|
- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
671
673
|
|
|
672
|
-
Returns **[Promise][
|
|
674
|
+
Returns **[Promise][8]<[string][3]>** attribute value
|
|
673
675
|
|
|
674
676
|
### grabValueFromAll
|
|
675
677
|
|
|
@@ -684,7 +686,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
684
686
|
|
|
685
687
|
- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
686
688
|
|
|
687
|
-
Returns **[Promise][
|
|
689
|
+
Returns **[Promise][8]<[Array][10]<[string][3]>>** attribute value
|
|
688
690
|
|
|
689
691
|
### haveHeader
|
|
690
692
|
|
|
@@ -1159,7 +1161,7 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1159
1161
|
|
|
1160
1162
|
#### Parameters
|
|
1161
1163
|
|
|
1162
|
-
- `fn` **([string][3] | [function][
|
|
1164
|
+
- `fn` **([string][3] | [function][7])** to be executed in browser context.
|
|
1163
1165
|
- `argsOrSec` **([Array][10]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
1164
1166
|
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1165
1167
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
@@ -1239,11 +1241,11 @@ I.waitToHide('#popup');
|
|
|
1239
1241
|
|
|
1240
1242
|
[6]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
1241
1243
|
|
|
1242
|
-
[7]: https://
|
|
1244
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1243
1245
|
|
|
1244
|
-
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1246
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1245
1247
|
|
|
1246
|
-
[9]: https://
|
|
1248
|
+
[9]: https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2
|
|
1247
1249
|
|
|
1248
1250
|
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1249
1251
|
|
|
@@ -74,7 +74,7 @@ Type: [object][5]
|
|
|
74
74
|
- `ignoreLog` **[Array][9]<[string][8]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][44].
|
|
75
75
|
- `ignoreHTTPSErrors` **[boolean][32]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
76
|
- `bypassCSP` **[boolean][32]?** bypass Content Security Policy or CSP
|
|
77
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
77
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -530,7 +530,8 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
530
530
|
|
|
531
531
|
- `fn` **([string][9] | [function][12])** function to be executed in browser context.
|
|
532
532
|
- `args` **...any** to be passed to function.
|
|
533
|
-
|
|
533
|
+
|
|
534
|
+
Returns **[Promise][13]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
534
535
|
|
|
535
536
|
### executeScript
|
|
536
537
|
|
|
@@ -562,7 +563,8 @@ let date = await I.executeScript(function(el) {
|
|
|
562
563
|
|
|
563
564
|
- `fn` **([string][9] | [function][12])** function to be executed in browser context.
|
|
564
565
|
- `args` **...any** to be passed to function.
|
|
565
|
-
|
|
566
|
+
|
|
567
|
+
Returns **[Promise][13]<any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
566
568
|
|
|
567
569
|
### fillField
|
|
568
570
|
|