codeceptjs 3.5.4-beta.1 → 3.5.5
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 +368 -0
- package/README.md +0 -2
- package/docs/build/Appium.js +48 -7
- package/docs/build/GraphQL.js +25 -0
- package/docs/build/Nightmare.js +15 -6
- package/docs/build/Playwright.js +436 -197
- package/docs/build/Protractor.js +17 -8
- package/docs/build/Puppeteer.js +37 -20
- package/docs/build/TestCafe.js +19 -10
- package/docs/build/WebDriver.js +45 -37
- package/docs/changelog.md +375 -0
- package/docs/community-helpers.md +8 -4
- package/docs/examples.md +8 -2
- package/docs/helpers/Appium.md +39 -2
- package/docs/helpers/GraphQL.md +21 -0
- package/docs/helpers/Nightmare.md +1260 -0
- package/docs/helpers/Playwright.md +223 -119
- package/docs/helpers/Protractor.md +1711 -0
- package/docs/helpers/Puppeteer.md +31 -29
- package/docs/helpers/TestCafe.md +18 -17
- package/docs/helpers/WebDriver.md +34 -32
- package/docs/playwright.md +24 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -0
- package/docs/webapi/executeScript.mustache +2 -0
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/wiki/Books-&-Posts.md +0 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
- package/docs/wiki/Examples.md +8 -2
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
- package/docs/wiki/Home.md +0 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
- package/docs/wiki/Release-Process.md +0 -0
- package/docs/wiki/Roadmap.md +0 -0
- package/docs/wiki/Tests.md +0 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
- package/docs/wiki/Videos.md +0 -0
- package/lib/codecept.js +1 -0
- package/lib/command/definitions.js +2 -7
- package/lib/command/init.js +40 -4
- package/lib/command/run-multiple/collection.js +17 -5
- package/lib/command/run-workers.js +4 -0
- package/lib/command/run.js +6 -0
- package/lib/helper/Appium.js +46 -5
- package/lib/helper/GraphQL.js +25 -0
- package/lib/helper/Nightmare.js +1415 -0
- package/lib/helper/Playwright.js +336 -62
- package/lib/helper/Protractor.js +1837 -0
- package/lib/helper/Puppeteer.js +31 -18
- package/lib/helper/TestCafe.js +15 -8
- package/lib/helper/WebDriver.js +39 -35
- package/lib/helper/clientscripts/nightmare.js +213 -0
- package/lib/helper/errors/ElementNotFound.js +2 -1
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/interfaces/bdd.js +1 -1
- package/lib/mochaFactory.js +2 -1
- package/lib/pause.js +6 -4
- package/lib/plugin/heal.js +2 -3
- package/lib/plugin/selenoid.js +6 -1
- package/lib/step.js +27 -10
- package/lib/utils.js +4 -0
- package/lib/workers.js +3 -1
- package/package.json +87 -87
- package/typings/promiseBasedTypes.d.ts +163 -126
- package/typings/types.d.ts +183 -144
- package/docs/build/Polly.js +0 -42
- package/docs/build/SeleniumWebdriver.js +0 -76
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,371 @@
|
|
|
1
|
+
## 3.5.5
|
|
2
|
+
|
|
3
|
+
🐛 Bug Fixes
|
|
4
|
+
* fix(browserstack): issue with vendor prefix (#3845) - by @KobeNguyenT
|
|
5
|
+
```
|
|
6
|
+
export const caps = {
|
|
7
|
+
androidCaps: {
|
|
8
|
+
appiumV2: true,
|
|
9
|
+
host: "hub-cloud.browserstack.com",
|
|
10
|
+
port: 4444,
|
|
11
|
+
user: process.env.BROWSERSTACK_USER,
|
|
12
|
+
key: process.env.BROWSERSTACK_KEY,
|
|
13
|
+
'app': `bs://c700ce60cf13ae8ed97705a55b8e022f1hjhkjh3c5827c`,
|
|
14
|
+
browser: '',
|
|
15
|
+
desiredCapabilities: {
|
|
16
|
+
'appPackage': data.packageName,
|
|
17
|
+
'deviceName': process.env.DEVICE || 'Google Pixel 3',
|
|
18
|
+
'platformName': process.env.PLATFORM || 'android',
|
|
19
|
+
'platformVersion': process.env.OS_VERSION || '10.0',
|
|
20
|
+
'automationName': process.env.ENGINE || 'UIAutomator2',
|
|
21
|
+
'newCommandTimeout': 300000,
|
|
22
|
+
'androidDeviceReadyTimeout': 300000,
|
|
23
|
+
'androidInstallTimeout': 90000,
|
|
24
|
+
'appWaitDuration': 300000,
|
|
25
|
+
'autoGrantPermissions': true,
|
|
26
|
+
'gpsEnabled': true,
|
|
27
|
+
'isHeadless': false,
|
|
28
|
+
'noReset': false,
|
|
29
|
+
'noSign': true,
|
|
30
|
+
'bstack:options' : {
|
|
31
|
+
"appiumVersion" : "2.0.1",
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
* switchTo/within now supports strict locator (#3847) - by @KobeNguyenT
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
I.switchTo({ css: 'iframe[id^=number-frame]' }) // support the strict locator
|
|
42
|
+
|
|
43
|
+
I.amOnPage('/iframe');
|
|
44
|
+
within({
|
|
45
|
+
frame: { css: '#number-frame-1234' }, // support the strict locator
|
|
46
|
+
}, () => {
|
|
47
|
+
I.fillField('user[login]', 'User');
|
|
48
|
+
I.fillField('user[email]', 'user@user.com');
|
|
49
|
+
I.fillField('user[password]', 'user@user.com');
|
|
50
|
+
I.click('button');
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
* Improve the IntelliSense when using other languages (#3848) - by @andonary
|
|
55
|
+
```
|
|
56
|
+
include: {
|
|
57
|
+
Je: './steps_file.js'
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
* bypassCSP support for Playwright helper (#3865) - by @sammeel
|
|
62
|
+
```
|
|
63
|
+
helpers: {
|
|
64
|
+
Playwright: {
|
|
65
|
+
bypassCSP: true
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
* fix: missing requests when recording network (#3834) - by @KobeNguyenT
|
|
69
|
+
|
|
70
|
+
🛩️ Features and Improvements
|
|
71
|
+
* Show environment info in verbose mode (#3858) - by @KobeNguyenT
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Environment information:-
|
|
75
|
+
|
|
76
|
+
codeceptVersion: "3.5.4"
|
|
77
|
+
nodeInfo: 18.16.0
|
|
78
|
+
osInfo: macOS 13.5
|
|
79
|
+
cpuInfo: (8) arm64 Apple M1 Pro
|
|
80
|
+
chromeInfo: 116.0.5845.179
|
|
81
|
+
edgeInfo: 116.0.1938.69
|
|
82
|
+
firefoxInfo: Not Found
|
|
83
|
+
safariInfo: 16.6
|
|
84
|
+
helpers: {
|
|
85
|
+
"Playwright": {
|
|
86
|
+
"url": "https://github.com",
|
|
87
|
+
"show": false,
|
|
88
|
+
"browser": "chromium",
|
|
89
|
+
"waitForNavigation": "load",
|
|
90
|
+
"waitForTimeout": 30000,
|
|
91
|
+
"trace": false,
|
|
92
|
+
"keepTraceForPassedTests": true
|
|
93
|
+
},
|
|
94
|
+
"CDPHelper": {
|
|
95
|
+
"require": "./helpers/CDPHelper.ts"
|
|
96
|
+
},
|
|
97
|
+
"OpenAI": {
|
|
98
|
+
"chunkSize": 8000
|
|
99
|
+
},
|
|
100
|
+
"ExpectHelper": {
|
|
101
|
+
"require": "codeceptjs-expect"
|
|
102
|
+
},
|
|
103
|
+
"REST": {
|
|
104
|
+
"endpoint": "https://reqres.in",
|
|
105
|
+
"timeout": 20000
|
|
106
|
+
},
|
|
107
|
+
"AllureHelper": {
|
|
108
|
+
"require": "./helpers/AllureHelper.ts"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
plugins: {
|
|
112
|
+
"screenshotOnFail": {
|
|
113
|
+
"enabled": true
|
|
114
|
+
},
|
|
115
|
+
"tryTo": {
|
|
116
|
+
"enabled": true
|
|
117
|
+
},
|
|
118
|
+
"retryFailedStep": {
|
|
119
|
+
"enabled": true
|
|
120
|
+
},
|
|
121
|
+
"retryTo": {
|
|
122
|
+
"enabled": true
|
|
123
|
+
},
|
|
124
|
+
"eachElement": {
|
|
125
|
+
"enabled": true
|
|
126
|
+
},
|
|
127
|
+
"pauseOnFail": {}
|
|
128
|
+
}
|
|
129
|
+
***************************************
|
|
130
|
+
If you have questions ask them in our Slack: http://bit.ly/chat-codeceptjs
|
|
131
|
+
Or ask them on our discussion board: https://codecept.discourse.group/
|
|
132
|
+
Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues
|
|
133
|
+
***************************************
|
|
134
|
+
CodeceptJS v3.5.4 #StandWithUkraine
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
* some typings improvements (#3855) - by @nikzupancic
|
|
138
|
+
* support the puppeteer 21.1.1 (#3856) - by @KobeNguyenT
|
|
139
|
+
* fix: support secret value for some methods (#3837) - by @KobeNguyenT
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
await I.amOnPage('/form/field_values');
|
|
143
|
+
await I.dontSeeInField('checkbox[]', secret('not seen one'));
|
|
144
|
+
await I.seeInField('checkbox[]', secret('see test one'));
|
|
145
|
+
await I.dontSeeInField('checkbox[]', secret('not seen two'));
|
|
146
|
+
await I.seeInField('checkbox[]', secret('see test two'));
|
|
147
|
+
await I.dontSeeInField('checkbox[]', secret('not seen three'));
|
|
148
|
+
await I.seeInField('checkbox[]', secret('see test three'));
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
🛩️ **Several bugfixes and improvements for Codecept-UI**
|
|
152
|
+
* Mask the secret value in UI
|
|
153
|
+
* Improve UX/UI
|
|
154
|
+
* PageObjects are now showing in UI
|
|
155
|
+
|
|
156
|
+
## 3.5.4
|
|
157
|
+
|
|
158
|
+
🐛 Bug Fixes:
|
|
159
|
+
* [Playwright] When passing `userDataDir`, it throws error after test execution (#3814) - by @KobeNguyenT
|
|
160
|
+
* [CodeceptJS-CLI] Improve command to generate types (#3788) - by @KobeNguyenT
|
|
161
|
+
* Heal plugin fix (#3820) - by @davert
|
|
162
|
+
* Fix for error in using `all` with `run-workers` (#3805) - by @KobeNguyenT
|
|
163
|
+
```js
|
|
164
|
+
helpers: {
|
|
165
|
+
Playwright: {
|
|
166
|
+
url: 'https://github.com',
|
|
167
|
+
show: false,
|
|
168
|
+
browser: 'chromium',
|
|
169
|
+
waitForNavigation: 'load',
|
|
170
|
+
waitForTimeout: 30_000,
|
|
171
|
+
trace: true,
|
|
172
|
+
keepTraceForPassedTests: true
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
multiple: {
|
|
176
|
+
profile1: {
|
|
177
|
+
browsers: [
|
|
178
|
+
{
|
|
179
|
+
browser: "chromium",
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
```
|
|
185
|
+
* Highlight elements issues (#3779) (#3778) - by @philkas
|
|
186
|
+
* Support ` ` symbol in `I.see` method (#3815) - by @KobeNguyenT
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
// HTML code uses instead of space
|
|
190
|
+
<div class="dJHe_" style="color: rgb(255, 255, 255);">My Text!</div>
|
|
191
|
+
|
|
192
|
+
I.see("My Text!") // this test would work with both and space
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
📖 Documentation
|
|
196
|
+
* Improve the configuration of electron testing when the app is build with electron-forge (#3802) - by @KobeNguyenT
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
const path = require("path");
|
|
200
|
+
|
|
201
|
+
exports.config = {
|
|
202
|
+
helpers: {
|
|
203
|
+
Playwright: {
|
|
204
|
+
browser: "electron",
|
|
205
|
+
electron: {
|
|
206
|
+
executablePath: require("electron"),
|
|
207
|
+
args: [path.join(__dirname, ".webpack/main/index.js")],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
// rest of config
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
🛩️ Features
|
|
216
|
+
|
|
217
|
+
#### [Playwright] new features and improvements
|
|
218
|
+
* Parse the response in recording network steps (#3771) - by @KobeNguyenT
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
const traffics = await I.grabRecordedNetworkTraffics();
|
|
222
|
+
expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
223
|
+
expect(traffics[0].response.status).to.equal(200);
|
|
224
|
+
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
225
|
+
|
|
226
|
+
expect(traffics[1].url).to.equal('https://reqres.in/api/comments/1');
|
|
227
|
+
expect(traffics[1].response.status).to.equal(200);
|
|
228
|
+
expect(traffics[1].response.body).to.contain({ name: 'this was another mocked' });
|
|
229
|
+
```
|
|
230
|
+
* Grab metrics (#3809) - by @KobeNguyenT
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
const metrics = await I.grabMetrics();
|
|
234
|
+
|
|
235
|
+
// returned metrics
|
|
236
|
+
|
|
237
|
+
[
|
|
238
|
+
{ name: 'Timestamp', value: 1584904.203473 },
|
|
239
|
+
{ name: 'AudioHandlers', value: 0 },
|
|
240
|
+
{ name: 'AudioWorkletProcessors', value: 0 },
|
|
241
|
+
{ name: 'Documents', value: 22 },
|
|
242
|
+
{ name: 'Frames', value: 10 },
|
|
243
|
+
{ name: 'JSEventListeners', value: 366 },
|
|
244
|
+
{ name: 'LayoutObjects', value: 1240 },
|
|
245
|
+
{ name: 'MediaKeySessions', value: 0 },
|
|
246
|
+
{ name: 'MediaKeys', value: 0 },
|
|
247
|
+
{ name: 'Nodes', value: 4505 },
|
|
248
|
+
{ name: 'Resources', value: 141 },
|
|
249
|
+
{ name: 'ContextLifecycleStateObservers', value: 34 },
|
|
250
|
+
{ name: 'V8PerContextDatas', value: 4 },
|
|
251
|
+
{ name: 'WorkerGlobalScopes', value: 0 },
|
|
252
|
+
{ name: 'UACSSResources', value: 0 },
|
|
253
|
+
{ name: 'RTCPeerConnections', value: 0 },
|
|
254
|
+
{ name: 'ResourceFetchers', value: 22 },
|
|
255
|
+
{ name: 'AdSubframes', value: 0 },
|
|
256
|
+
{ name: 'DetachedScriptStates', value: 2 },
|
|
257
|
+
{ name: 'ArrayBufferContents', value: 1 },
|
|
258
|
+
{ name: 'LayoutCount', value: 0 },
|
|
259
|
+
{ name: 'RecalcStyleCount', value: 0 },
|
|
260
|
+
{ name: 'LayoutDuration', value: 0 },
|
|
261
|
+
{ name: 'RecalcStyleDuration', value: 0 },
|
|
262
|
+
{ name: 'DevToolsCommandDuration', value: 0.000013 },
|
|
263
|
+
{ name: 'ScriptDuration', value: 0 },
|
|
264
|
+
{ name: 'V8CompileDuration', value: 0 },
|
|
265
|
+
{ name: 'TaskDuration', value: 0.000014 },
|
|
266
|
+
{ name: 'TaskOtherDuration', value: 0.000001 },
|
|
267
|
+
{ name: 'ThreadTime', value: 0.000046 },
|
|
268
|
+
{ name: 'ProcessTime', value: 0.616852 },
|
|
269
|
+
{ name: 'JSHeapUsedSize', value: 19004908 },
|
|
270
|
+
{ name: 'JSHeapTotalSize', value: 26820608 },
|
|
271
|
+
{ name: 'FirstMeaningfulPaint', value: 0 },
|
|
272
|
+
{ name: 'DomContentLoaded', value: 1584903.690491 },
|
|
273
|
+
{ name: 'NavigationStart', value: 1584902.841845 }
|
|
274
|
+
]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
* Grab WebSocket (WS) messages (#3789) - by @KobeNguyenT
|
|
278
|
+
* `flushWebSocketMessages`
|
|
279
|
+
* `grabWebSocketMessages`
|
|
280
|
+
* `startRecordingWebSocketMessages`
|
|
281
|
+
* `stopRecordingWebSocketMessages`
|
|
282
|
+
|
|
283
|
+
```js
|
|
284
|
+
await I.startRecordingWebSocketMessages();
|
|
285
|
+
I.amOnPage('https://websocketstest.com/');
|
|
286
|
+
I.waitForText('Work for You!');
|
|
287
|
+
I.flushNetworkTraffics();
|
|
288
|
+
const wsMessages = I.grabWebSocketMessages();
|
|
289
|
+
expect(wsMessages.length).to.equal(0);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```js
|
|
293
|
+
await I.startRecordingWebSocketMessages();
|
|
294
|
+
await I.amOnPage('https://websocketstest.com/');
|
|
295
|
+
I.waitForText('Work for You!');
|
|
296
|
+
const wsMessages = I.grabWebSocketMessages();
|
|
297
|
+
expect(wsMessages.length).to.greaterThan(0);
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
```js
|
|
301
|
+
await I.startRecordingWebSocketMessages();
|
|
302
|
+
await I.amOnPage('https://websocketstest.com/');
|
|
303
|
+
I.waitForText('Work for You!');
|
|
304
|
+
const wsMessages = I.grabWebSocketMessages();
|
|
305
|
+
await I.stopRecordingWebSocketMessages();
|
|
306
|
+
await I.amOnPage('https://websocketstest.com/');
|
|
307
|
+
I.waitForText('Work for You!');
|
|
308
|
+
const afterWsMessages = I.grabWebSocketMessages();
|
|
309
|
+
expect(wsMessages.length).to.equal(afterWsMessages.length);
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
* Move from `ElementHandle` to `Locator`. This change is quite major, but it happened under hood, so should not affect your code. (#3738) - by @KobeNguyenT
|
|
313
|
+
|
|
314
|
+
## 3.5.3
|
|
315
|
+
|
|
316
|
+
🛩️ Features
|
|
317
|
+
|
|
318
|
+
* [Playwright] Added commands to check network traffic #3748 - by @ngraf @KobeNguyenT
|
|
319
|
+
* `startRecordingTraffic`
|
|
320
|
+
* `grabRecordedNetworkTraffics`
|
|
321
|
+
* `blockTraffic`
|
|
322
|
+
* `mockTraffic`
|
|
323
|
+
* `flushNetworkTraffics`
|
|
324
|
+
* `stopRecordingTraffic`
|
|
325
|
+
* `seeTraffic`
|
|
326
|
+
* `grabTrafficUrl`
|
|
327
|
+
* `dontSeeTraffic`
|
|
328
|
+
|
|
329
|
+
Examples:
|
|
330
|
+
|
|
331
|
+
```js
|
|
332
|
+
// recording traffics and verify the traffic
|
|
333
|
+
await I.startRecordingTraffic();
|
|
334
|
+
I.amOnPage('https://codecept.io/');
|
|
335
|
+
await I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' });
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
```js
|
|
339
|
+
// block the traffic
|
|
340
|
+
I.blockTraffic('https://reqres.in/api/comments/*');
|
|
341
|
+
await I.amOnPage('/form/fetch_call');
|
|
342
|
+
await I.startRecordingTraffic();
|
|
343
|
+
await I.click('GET COMMENTS');
|
|
344
|
+
await I.see('Can not load data!');
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
```js
|
|
348
|
+
// check the traffic with advanced params
|
|
349
|
+
I.amOnPage('https://openai.com/blog/chatgpt');
|
|
350
|
+
await I.startRecordingTraffic();
|
|
351
|
+
await I.seeTraffic({
|
|
352
|
+
name: 'sentry event',
|
|
353
|
+
url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
354
|
+
parameters: {
|
|
355
|
+
width: '1919',
|
|
356
|
+
height: '1138',
|
|
357
|
+
},
|
|
358
|
+
});
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
🐛 Bugfix
|
|
362
|
+
|
|
363
|
+
* [retryStepPlugin] Fix retry step when using global retry #3768 - by @KobeNguyenT
|
|
364
|
+
|
|
365
|
+
🗑 Deprecated
|
|
366
|
+
|
|
367
|
+
* Nightmare and Protractor helpers have been deprecated
|
|
368
|
+
|
|
1
369
|
## 3.5.2
|
|
2
370
|
|
|
3
371
|
🐛 Bug Fixes
|
package/README.md
CHANGED
|
@@ -305,8 +305,6 @@ Thanks all to those who are and will have contributing to this awesome project!
|
|
|
305
305
|
<a href="https://github.com/Georgegriff"><img src="https://avatars.githubusercontent.com/u/9056958?v=4" title="Georgegriff" width="80" height="80"></a>
|
|
306
306
|
<a href="https://github.com/mirao"><img src="https://avatars.githubusercontent.com/u/12584138?v=4" title="mirao" width="80" height="80"></a>
|
|
307
307
|
<a href="https://github.com/KMKoushik"><img src="https://avatars.githubusercontent.com/u/24666922?v=4" title="KMKoushik" width="80" height="80"></a>
|
|
308
|
-
<a href="https://github.com/actions-user"><img src="https://avatars.githubusercontent.com/u/65916846?v=4" title="actions-user" width="80" height="80"></a>
|
|
309
|
-
<a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4" title="dependabot[bot]" width="80" height="80"></a>
|
|
310
308
|
<a href="https://github.com/nikocanvacom"><img src="https://avatars.githubusercontent.com/u/83254493?v=4" title="nikocanvacom" width="80" height="80"></a>
|
|
311
309
|
<a href="https://github.com/elukoyanov"><img src="https://avatars.githubusercontent.com/u/11647141?v=4" title="elukoyanov" width="80" height="80"></a>
|
|
312
310
|
<a href="https://github.com/gkushang"><img src="https://avatars.githubusercontent.com/u/3663389?v=4" title="gkushang" width="80" height="80"></a>
|
package/docs/build/Appium.js
CHANGED
|
@@ -117,6 +117,43 @@ const vendorPrefix = {
|
|
|
117
117
|
* }
|
|
118
118
|
* ```
|
|
119
119
|
*
|
|
120
|
+
* Example Android App using Appiumv2 on BrowserStack:
|
|
121
|
+
*
|
|
122
|
+
* ```js
|
|
123
|
+
* {
|
|
124
|
+
* helpers: {
|
|
125
|
+
* Appium: {
|
|
126
|
+
* appiumV2: true,
|
|
127
|
+
* host: "hub-cloud.browserstack.com",
|
|
128
|
+
* port: 4444,
|
|
129
|
+
* user: process.env.BROWSERSTACK_USER,
|
|
130
|
+
* key: process.env.BROWSERSTACK_KEY,
|
|
131
|
+
* app: `bs://c700ce60cf1gjhgjh3ae8ed9770ghjg5a55b8e022f13c5827cg`,
|
|
132
|
+
* browser: '',
|
|
133
|
+
* desiredCapabilities: {
|
|
134
|
+
* 'appPackage': data.packageName,
|
|
135
|
+
* 'deviceName': process.env.DEVICE || 'Google Pixel 3',
|
|
136
|
+
* 'platformName': process.env.PLATFORM || 'android',
|
|
137
|
+
* 'platformVersion': process.env.OS_VERSION || '10.0',
|
|
138
|
+
* 'automationName': process.env.ENGINE || 'UIAutomator2',
|
|
139
|
+
* 'newCommandTimeout': 300000,
|
|
140
|
+
* 'androidDeviceReadyTimeout': 300000,
|
|
141
|
+
* 'androidInstallTimeout': 90000,
|
|
142
|
+
* 'appWaitDuration': 300000,
|
|
143
|
+
* 'autoGrantPermissions': true,
|
|
144
|
+
* 'gpsEnabled': true,
|
|
145
|
+
* 'isHeadless': false,
|
|
146
|
+
* 'noReset': false,
|
|
147
|
+
* 'noSign': true,
|
|
148
|
+
* 'bstack:options' : {
|
|
149
|
+
* "appiumVersion" : "2.0.1",
|
|
150
|
+
* },
|
|
151
|
+
* }
|
|
152
|
+
* }
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
120
157
|
* Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md>
|
|
121
158
|
*
|
|
122
159
|
* ## Access From Helpers
|
|
@@ -234,7 +271,9 @@ class Appium extends Webdriver {
|
|
|
234
271
|
const _convertedCaps = {};
|
|
235
272
|
for (const [key, value] of Object.entries(capabilities)) {
|
|
236
273
|
if (!key.startsWith(vendorPrefix.appium)) {
|
|
237
|
-
|
|
274
|
+
if (key !== 'platformName') {
|
|
275
|
+
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
|
|
276
|
+
}
|
|
238
277
|
} else {
|
|
239
278
|
_convertedCaps[`${key}`] = value;
|
|
240
279
|
}
|
|
@@ -1505,14 +1544,15 @@ class Appium extends Webdriver {
|
|
|
1505
1544
|
* ```
|
|
1506
1545
|
*
|
|
1507
1546
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1508
|
-
* @param {
|
|
1547
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1509
1548
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1510
1549
|
*
|
|
1511
1550
|
*
|
|
1512
1551
|
*/
|
|
1513
1552
|
async dontSeeInField(field, value) {
|
|
1514
|
-
|
|
1515
|
-
return super.dontSeeInField(
|
|
1553
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1554
|
+
if (this.isWeb) return super.dontSeeInField(field, _value);
|
|
1555
|
+
return super.dontSeeInField(parseLocator.call(this, field), _value);
|
|
1516
1556
|
}
|
|
1517
1557
|
|
|
1518
1558
|
/**
|
|
@@ -1768,14 +1808,15 @@ class Appium extends Webdriver {
|
|
|
1768
1808
|
* I.seeInField('#searchform input','Search');
|
|
1769
1809
|
* ```
|
|
1770
1810
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1771
|
-
* @param {
|
|
1811
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1772
1812
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1773
1813
|
*
|
|
1774
1814
|
*
|
|
1775
1815
|
*/
|
|
1776
1816
|
async seeInField(field, value) {
|
|
1777
|
-
|
|
1778
|
-
return super.seeInField(
|
|
1817
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1818
|
+
if (this.isWeb) return super.seeInField(field, _value);
|
|
1819
|
+
return super.seeInField(parseLocator.call(this, field), _value);
|
|
1779
1820
|
}
|
|
1780
1821
|
|
|
1781
1822
|
/**
|
package/docs/build/GraphQL.js
CHANGED
|
@@ -81,6 +81,8 @@ class GraphQL extends Helper {
|
|
|
81
81
|
'Content-Type': 'application/json',
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
request.headers = { ...this.headers, ...request.headers };
|
|
85
|
+
|
|
84
86
|
if (this.config.onRequest) {
|
|
85
87
|
await this.config.onRequest(request);
|
|
86
88
|
}
|
|
@@ -200,5 +202,28 @@ class GraphQL extends Helper {
|
|
|
200
202
|
_setRequestTimeout(newTimeout) {
|
|
201
203
|
this.options.timeout = newTimeout;
|
|
202
204
|
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Sets request headers for all requests of this test
|
|
208
|
+
*
|
|
209
|
+
* @param {object} headers headers list
|
|
210
|
+
*/
|
|
211
|
+
haveRequestHeaders(headers) {
|
|
212
|
+
this.headers = { ...this.headers, ...headers };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Adds a header for Bearer authentication
|
|
217
|
+
*
|
|
218
|
+
* ```js
|
|
219
|
+
* // we use secret function to hide token from logs
|
|
220
|
+
* I.amBearerAuthenticated(secret('heregoestoken'))
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* @param {string | CodeceptJS.Secret} accessToken Bearer access token
|
|
224
|
+
*/
|
|
225
|
+
amBearerAuthenticated(accessToken) {
|
|
226
|
+
this.haveRequestHeaders({ Authorization: `Bearer ${accessToken}` });
|
|
227
|
+
}
|
|
203
228
|
}
|
|
204
229
|
module.exports = GraphQL;
|
package/docs/build/Nightmare.js
CHANGED
|
@@ -882,6 +882,8 @@ class Nightmare extends Helper {
|
|
|
882
882
|
*
|
|
883
883
|
* @param {string|function} fn function to be executed in browser context.
|
|
884
884
|
* @param {...any} args to be passed to function.
|
|
885
|
+
* @returns {Promise<any>} script return value
|
|
886
|
+
*
|
|
885
887
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
886
888
|
*
|
|
887
889
|
*
|
|
@@ -916,6 +918,8 @@ class Nightmare extends Helper {
|
|
|
916
918
|
*
|
|
917
919
|
* @param {string|function} fn function to be executed in browser context.
|
|
918
920
|
* @param {...any} args to be passed to function.
|
|
921
|
+
* @returns {Promise<any>} script return value
|
|
922
|
+
*
|
|
919
923
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
920
924
|
*
|
|
921
925
|
*
|
|
@@ -1063,12 +1067,13 @@ class Nightmare extends Helper {
|
|
|
1063
1067
|
* I.seeInField('#searchform input','Search');
|
|
1064
1068
|
* ```
|
|
1065
1069
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1066
|
-
* @param {
|
|
1070
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1067
1071
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1068
1072
|
*
|
|
1069
1073
|
*/
|
|
1070
1074
|
async seeInField(field, value) {
|
|
1071
|
-
|
|
1075
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1076
|
+
return proceedSeeInField.call(this, 'assert', field, _value);
|
|
1072
1077
|
}
|
|
1073
1078
|
|
|
1074
1079
|
/**
|
|
@@ -1081,12 +1086,13 @@ class Nightmare extends Helper {
|
|
|
1081
1086
|
* ```
|
|
1082
1087
|
*
|
|
1083
1088
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1084
|
-
* @param {
|
|
1089
|
+
* @param {CodeceptJS.StringOrSecret} value value to check.
|
|
1085
1090
|
* ⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1086
1091
|
*
|
|
1087
1092
|
*/
|
|
1088
1093
|
async dontSeeInField(field, value) {
|
|
1089
|
-
|
|
1094
|
+
const _value = (typeof value === 'boolean') ? value : value.toString();
|
|
1095
|
+
return proceedSeeInField.call(this, 'negate', field, _value);
|
|
1090
1096
|
}
|
|
1091
1097
|
|
|
1092
1098
|
/**
|
|
@@ -1990,8 +1996,11 @@ class Nightmare extends Helper {
|
|
|
1990
1996
|
const body = document.body;
|
|
1991
1997
|
const html = document.documentElement;
|
|
1992
1998
|
window.scrollTo(0, Math.max(
|
|
1993
|
-
body.scrollHeight,
|
|
1994
|
-
|
|
1999
|
+
body.scrollHeight,
|
|
2000
|
+
body.offsetHeight,
|
|
2001
|
+
html.clientHeight,
|
|
2002
|
+
html.scrollHeight,
|
|
2003
|
+
html.offsetHeight
|
|
1995
2004
|
));
|
|
1996
2005
|
});
|
|
1997
2006
|
/* eslint-enable */
|