codeceptjs 4.0.0-beta.4 → 4.0.0-beta.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/README.md +134 -119
- package/bin/codecept.js +12 -2
- package/bin/test-server.js +53 -0
- package/docs/webapi/clearCookie.mustache +1 -1
- package/lib/actor.js +66 -102
- package/lib/ai.js +130 -121
- package/lib/assert/empty.js +3 -5
- package/lib/assert/equal.js +4 -7
- package/lib/assert/include.js +4 -6
- package/lib/assert/throws.js +2 -4
- package/lib/assert/truth.js +2 -2
- package/lib/codecept.js +139 -87
- package/lib/command/check.js +201 -0
- package/lib/command/configMigrate.js +2 -4
- package/lib/command/definitions.js +8 -26
- package/lib/command/generate.js +10 -14
- package/lib/command/gherkin/snippets.js +75 -73
- package/lib/command/gherkin/steps.js +1 -1
- package/lib/command/info.js +42 -8
- package/lib/command/init.js +13 -12
- package/lib/command/interactive.js +10 -2
- package/lib/command/list.js +1 -1
- package/lib/command/run-multiple/chunk.js +48 -45
- package/lib/command/run-multiple.js +12 -35
- package/lib/command/run-workers.js +21 -58
- package/lib/command/utils.js +5 -6
- package/lib/command/workers/runTests.js +262 -220
- package/lib/container.js +386 -238
- package/lib/data/context.js +10 -13
- package/lib/data/dataScenarioConfig.js +8 -8
- package/lib/data/dataTableArgument.js +6 -6
- package/lib/data/table.js +5 -11
- package/lib/effects.js +223 -0
- package/lib/element/WebElement.js +327 -0
- package/lib/els.js +158 -0
- package/lib/event.js +21 -17
- package/lib/heal.js +88 -80
- package/lib/helper/AI.js +2 -1
- package/lib/helper/ApiDataFactory.js +3 -6
- package/lib/helper/Appium.js +47 -51
- package/lib/helper/FileSystem.js +3 -3
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +75 -37
- package/lib/helper/Mochawesome.js +31 -9
- package/lib/helper/Nightmare.js +35 -53
- package/lib/helper/Playwright.js +262 -267
- package/lib/helper/Protractor.js +54 -77
- package/lib/helper/Puppeteer.js +246 -260
- package/lib/helper/REST.js +5 -17
- package/lib/helper/TestCafe.js +21 -44
- package/lib/helper/WebDriver.js +151 -170
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/helper/testcafe/testcafe-utils.js +26 -27
- package/lib/listener/emptyRun.js +55 -0
- package/lib/listener/exit.js +7 -10
- package/lib/listener/{retry.js → globalRetry.js} +5 -5
- package/lib/listener/globalTimeout.js +165 -0
- package/lib/listener/helpers.js +15 -15
- package/lib/listener/mocha.js +1 -1
- package/lib/listener/result.js +12 -0
- package/lib/listener/retryEnhancer.js +85 -0
- package/lib/listener/steps.js +32 -18
- package/lib/listener/store.js +20 -0
- package/lib/mocha/asyncWrapper.js +231 -0
- package/lib/{interfaces → mocha}/bdd.js +3 -3
- package/lib/mocha/cli.js +308 -0
- package/lib/mocha/factory.js +104 -0
- package/lib/{interfaces → mocha}/featureConfig.js +32 -12
- package/lib/{interfaces → mocha}/gherkin.js +26 -28
- package/lib/mocha/hooks.js +112 -0
- package/lib/mocha/index.js +12 -0
- package/lib/mocha/inject.js +29 -0
- package/lib/{interfaces → mocha}/scenarioConfig.js +31 -7
- package/lib/mocha/suite.js +82 -0
- package/lib/mocha/test.js +181 -0
- package/lib/mocha/types.d.ts +42 -0
- package/lib/mocha/ui.js +232 -0
- package/lib/output.js +82 -62
- package/lib/pause.js +160 -138
- package/lib/plugin/analyze.js +396 -0
- package/lib/plugin/auth.js +435 -0
- package/lib/plugin/autoDelay.js +8 -8
- package/lib/plugin/autoLogin.js +3 -338
- package/lib/plugin/commentStep.js +6 -1
- package/lib/plugin/coverage.js +10 -19
- package/lib/plugin/customLocator.js +3 -3
- package/lib/plugin/customReporter.js +52 -0
- package/lib/plugin/eachElement.js +1 -1
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/heal.js +36 -9
- package/lib/plugin/htmlReporter.js +1947 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/retryFailedStep.js +17 -18
- package/lib/plugin/retryTo.js +2 -113
- package/lib/plugin/screenshotOnFail.js +17 -58
- package/lib/plugin/selenoid.js +15 -35
- package/lib/plugin/standardActingHelpers.js +4 -1
- package/lib/plugin/stepByStepReport.js +56 -17
- package/lib/plugin/stepTimeout.js +5 -12
- package/lib/plugin/subtitles.js +4 -4
- package/lib/plugin/tryTo.js +3 -102
- package/lib/plugin/wdio.js +8 -10
- package/lib/recorder.js +155 -124
- package/lib/rerun.js +43 -42
- package/lib/result.js +161 -0
- package/lib/secret.js +1 -1
- package/lib/step/base.js +239 -0
- package/lib/step/comment.js +10 -0
- package/lib/step/config.js +50 -0
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +50 -0
- package/lib/step/meta.js +99 -0
- package/lib/step/record.js +74 -0
- package/lib/step/retry.js +11 -0
- package/lib/step/section.js +55 -0
- package/lib/step.js +21 -332
- package/lib/steps.js +50 -0
- package/lib/store.js +37 -5
- package/lib/template/heal.js +2 -11
- package/lib/test-server.js +323 -0
- package/lib/timeout.js +66 -0
- package/lib/utils.js +351 -218
- package/lib/within.js +75 -55
- package/lib/workerStorage.js +2 -1
- package/lib/workers.js +386 -276
- package/package.json +76 -70
- package/translations/de-DE.js +4 -3
- package/translations/fr-FR.js +4 -3
- package/translations/index.js +1 -0
- package/translations/it-IT.js +4 -3
- package/translations/ja-JP.js +4 -3
- package/translations/nl-NL.js +76 -0
- package/translations/pl-PL.js +4 -3
- package/translations/pt-BR.js +4 -3
- package/translations/ru-RU.js +4 -3
- package/translations/utils.js +9 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/index.d.ts +188 -186
- package/typings/promiseBasedTypes.d.ts +18 -705
- package/typings/types.d.ts +301 -804
- package/lib/cli.js +0 -256
- package/lib/helper/ExpectHelper.js +0 -391
- package/lib/helper/SoftExpectHelper.js +0 -381
- package/lib/listener/artifacts.js +0 -19
- package/lib/listener/timeout.js +0 -109
- package/lib/mochaFactory.js +0 -113
- package/lib/plugin/debugErrors.js +0 -67
- package/lib/scenario.js +0 -224
- package/lib/ui.js +0 -236
package/typings/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Project: https://github.com/codeception/codeceptjs/
|
|
2
2
|
/// <reference path="./types.d.ts" />
|
|
3
|
+
/// <reference path="../lib/mocha/types.d.ts" />
|
|
3
4
|
/// <reference path="./promiseBasedTypes.d.ts" />
|
|
4
5
|
/// <reference types="webdriverio" />
|
|
5
6
|
/// <reference path="./Mocha.d.ts" />
|
|
@@ -9,76 +10,75 @@
|
|
|
9
10
|
declare namespace CodeceptJS {
|
|
10
11
|
type WithTranslation<T> = T &
|
|
11
12
|
// @ts-ignore
|
|
12
|
-
import(
|
|
13
|
+
import('./utils').Translate<T, Translation.Actions>
|
|
13
14
|
|
|
14
15
|
type Cookie = {
|
|
15
|
-
name: string
|
|
16
|
-
value: string | boolean
|
|
17
|
-
domain?: string
|
|
18
|
-
path?: string
|
|
19
|
-
}
|
|
16
|
+
name: string
|
|
17
|
+
value: string | boolean
|
|
18
|
+
domain?: string
|
|
19
|
+
path?: string
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
type RetryConfig = {
|
|
22
23
|
/** Filter tests by string or regexp pattern */
|
|
23
|
-
grep?: string | RegExp
|
|
24
|
+
grep?: string | RegExp
|
|
24
25
|
/** Number of times to repeat scenarios of a Feature */
|
|
25
|
-
Feature?: number
|
|
26
|
+
Feature?: number
|
|
26
27
|
/** Number of times to repeat scenarios */
|
|
27
|
-
Scenario?: number
|
|
28
|
+
Scenario?: number
|
|
28
29
|
/** Number of times to repeat Before hook */
|
|
29
|
-
Before?: number
|
|
30
|
+
Before?: number
|
|
30
31
|
/** Number of times to repeat After hook */
|
|
31
|
-
After?: number
|
|
32
|
+
After?: number
|
|
32
33
|
/** Number of times to repeat BeforeSuite hook */
|
|
33
|
-
BeforeSuite?: number
|
|
34
|
+
BeforeSuite?: number
|
|
34
35
|
/** Number of times to repeat AfterSuite hook */
|
|
35
|
-
AfterSuite?: number
|
|
36
|
-
}
|
|
36
|
+
AfterSuite?: number
|
|
37
|
+
}
|
|
37
38
|
|
|
38
39
|
type TimeoutConfig = {
|
|
39
40
|
/** Filter tests by string or regexp pattern */
|
|
40
|
-
grep: string | RegExp
|
|
41
|
+
grep: string | RegExp
|
|
41
42
|
/** Set timeout for a scenarios of a Feature */
|
|
42
|
-
Feature: number
|
|
43
|
+
Feature: number
|
|
43
44
|
/** Set timeout for scenarios */
|
|
44
|
-
Scenario: number
|
|
45
|
-
}
|
|
45
|
+
Scenario: number
|
|
46
|
+
}
|
|
46
47
|
|
|
47
48
|
type AiPrompt = {
|
|
48
|
-
role: string
|
|
49
|
-
content: string
|
|
49
|
+
role: string
|
|
50
|
+
content: string
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
type AiConfig = {
|
|
53
54
|
/** request function to send prompts to AI provider */
|
|
54
|
-
request: (messages: any) => Promise<string
|
|
55
|
+
request: (messages: any) => Promise<string>
|
|
55
56
|
|
|
56
57
|
/** custom prompts */
|
|
57
58
|
prompts?: {
|
|
58
59
|
/** Returns prompt to write CodeceptJS steps inside pause mode */
|
|
59
|
-
writeStep?: (html: string, input: string) => Array<AiPrompt
|
|
60
|
+
writeStep?: (html: string, input: string) => Array<AiPrompt>
|
|
60
61
|
/** Returns prompt to heal step when test fails on CI if healing is on */
|
|
61
|
-
healStep?: (html: string, object) => Array<AiPrompt
|
|
62
|
+
healStep?: (html: string, object) => Array<AiPrompt>
|
|
62
63
|
/** Returns prompt to generate page object inside pause mode */
|
|
63
|
-
generatePageObject?: (html: string, extraPrompt?: string, rootLocator?: string) => Array<AiPrompt
|
|
64
|
-
}
|
|
64
|
+
generatePageObject?: (html: string, extraPrompt?: string, rootLocator?: string) => Array<AiPrompt>
|
|
65
|
+
}
|
|
65
66
|
|
|
66
67
|
/** max tokens to use */
|
|
67
|
-
maxTokens?: number
|
|
68
|
-
|
|
68
|
+
maxTokens?: number
|
|
69
69
|
|
|
70
70
|
/** configuration for processing HTML for GPT */
|
|
71
71
|
html?: {
|
|
72
72
|
/** max size of HTML to be sent to OpenAI to avoid token limit */
|
|
73
|
-
maxLength?: number
|
|
73
|
+
maxLength?: number
|
|
74
74
|
/** should HTML be changed by removing non-interactive elements */
|
|
75
|
-
simplify?: boolean
|
|
75
|
+
simplify?: boolean
|
|
76
76
|
/** should HTML be minified before sending */
|
|
77
|
-
minify?: boolean
|
|
78
|
-
interactiveElements?: Array<string
|
|
79
|
-
textElements?: Array<string
|
|
80
|
-
allowedAttrs?: Array<string
|
|
81
|
-
allowedRoles?: Array<string
|
|
77
|
+
minify?: boolean
|
|
78
|
+
interactiveElements?: Array<string>
|
|
79
|
+
textElements?: Array<string>
|
|
80
|
+
allowedAttrs?: Array<string>
|
|
81
|
+
allowedRoles?: Array<string>
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -97,7 +97,7 @@ declare namespace CodeceptJS {
|
|
|
97
97
|
* tests: 'tests/**.test.ts'
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
|
-
tests: string
|
|
100
|
+
tests: string
|
|
101
101
|
/**
|
|
102
102
|
* Where to store failure screenshots, artifacts, etc
|
|
103
103
|
*
|
|
@@ -105,7 +105,7 @@ declare namespace CodeceptJS {
|
|
|
105
105
|
* output: './output'
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
108
|
-
output: string
|
|
108
|
+
output: string
|
|
109
109
|
/**
|
|
110
110
|
* empty output folder for next run
|
|
111
111
|
*
|
|
@@ -113,7 +113,7 @@ declare namespace CodeceptJS {
|
|
|
113
113
|
* emptyOutputFolder: true
|
|
114
114
|
* ```
|
|
115
115
|
*/
|
|
116
|
-
emptyOutputFolder?: boolean
|
|
116
|
+
emptyOutputFolder?: boolean
|
|
117
117
|
/**
|
|
118
118
|
* mask sensitive data in output logs
|
|
119
119
|
*
|
|
@@ -121,7 +121,7 @@ declare namespace CodeceptJS {
|
|
|
121
121
|
* maskSensitiveData: true
|
|
122
122
|
* ```
|
|
123
123
|
*/
|
|
124
|
-
maskSensitiveData?: boolean
|
|
124
|
+
maskSensitiveData?: boolean
|
|
125
125
|
/**
|
|
126
126
|
* Pattern to filter tests by name.
|
|
127
127
|
* This option is useful if you plan to use multiple configs for different environments.
|
|
@@ -132,7 +132,7 @@ declare namespace CodeceptJS {
|
|
|
132
132
|
* grep: '@firefox'
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
|
-
grep?: string
|
|
135
|
+
grep?: string
|
|
136
136
|
/**
|
|
137
137
|
* Enable and configure helpers:
|
|
138
138
|
*
|
|
@@ -158,7 +158,7 @@ declare namespace CodeceptJS {
|
|
|
158
158
|
* I.see('Welcome');
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
|
-
Playwright?: PlaywrightConfig
|
|
161
|
+
Playwright?: PlaywrightConfig
|
|
162
162
|
/**
|
|
163
163
|
* Run web tests controlling browsers via Puppeteer engine.
|
|
164
164
|
*
|
|
@@ -171,7 +171,7 @@ declare namespace CodeceptJS {
|
|
|
171
171
|
* I.see('Welcome');
|
|
172
172
|
* ```
|
|
173
173
|
*/
|
|
174
|
-
Puppeteer?: PuppeteerConfig
|
|
174
|
+
Puppeteer?: PuppeteerConfig
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* Run web tests controlling browsers via WebDriver engine.
|
|
@@ -185,7 +185,7 @@ declare namespace CodeceptJS {
|
|
|
185
185
|
*
|
|
186
186
|
* https://codecept.io/helpers/webdriver
|
|
187
187
|
*/
|
|
188
|
-
WebDriver?: WebDriverConfig
|
|
188
|
+
WebDriver?: WebDriverConfig
|
|
189
189
|
/**
|
|
190
190
|
* Execute REST API requests for API testing or to assist web testing.
|
|
191
191
|
*
|
|
@@ -196,7 +196,7 @@ declare namespace CodeceptJS {
|
|
|
196
196
|
* I.sendGetRequest('/');
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
|
-
REST?: RESTConfig
|
|
199
|
+
REST?: RESTConfig
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Use JSON assertions for API testing.
|
|
@@ -209,13 +209,13 @@ declare namespace CodeceptJS {
|
|
|
209
209
|
* I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } });
|
|
210
210
|
* ```
|
|
211
211
|
*/
|
|
212
|
-
JSONResponse?: any
|
|
212
|
+
JSONResponse?: any
|
|
213
213
|
|
|
214
214
|
/** Enable AI features for development purposes */
|
|
215
|
-
AI?: any
|
|
215
|
+
AI?: any
|
|
216
216
|
|
|
217
|
-
[key: string]: any
|
|
218
|
-
}
|
|
217
|
+
[key: string]: any
|
|
218
|
+
}
|
|
219
219
|
/**
|
|
220
220
|
* Enable CodeceptJS plugins.
|
|
221
221
|
*
|
|
@@ -233,7 +233,7 @@ declare namespace CodeceptJS {
|
|
|
233
233
|
}
|
|
234
234
|
* ```
|
|
235
235
|
*/
|
|
236
|
-
plugins?: any
|
|
236
|
+
plugins?: any
|
|
237
237
|
/**
|
|
238
238
|
* Include page objects to access them via dependency injection
|
|
239
239
|
*
|
|
@@ -248,7 +248,7 @@ declare namespace CodeceptJS {
|
|
|
248
248
|
* Scenario('test', { I, loginPage, User })
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
|
-
include?: any
|
|
251
|
+
include?: any
|
|
252
252
|
/**
|
|
253
253
|
* Set default tests timeout in seconds.
|
|
254
254
|
* Tests will be killed on no response after timeout.
|
|
@@ -269,7 +269,7 @@ declare namespace CodeceptJS {
|
|
|
269
269
|
* ]
|
|
270
270
|
* ```
|
|
271
271
|
*/
|
|
272
|
-
timeout?: number | Array<TimeoutConfig> | TimeoutConfig
|
|
272
|
+
timeout?: number | Array<TimeoutConfig> | TimeoutConfig
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
275
|
* Configure retry strategy for tests
|
|
@@ -304,11 +304,10 @@ declare namespace CodeceptJS {
|
|
|
304
304
|
* ]
|
|
305
305
|
* ```
|
|
306
306
|
*/
|
|
307
|
-
retry?: number | Array<RetryConfig> | RetryConfig
|
|
308
|
-
|
|
307
|
+
retry?: number | Array<RetryConfig> | RetryConfig
|
|
309
308
|
|
|
310
309
|
/** Disable registering global functions (Before, Scenario, etc). Not recommended */
|
|
311
|
-
noGlobals?: boolean
|
|
310
|
+
noGlobals?: boolean
|
|
312
311
|
/**
|
|
313
312
|
* [Mocha test runner options](https://mochajs.org/#configuring-mocha-nodejs), additional [reporters](https://codecept.io/reports/#xml) can be configured here.
|
|
314
313
|
*
|
|
@@ -326,7 +325,7 @@ declare namespace CodeceptJS {
|
|
|
326
325
|
* }
|
|
327
326
|
* ```
|
|
328
327
|
*/
|
|
329
|
-
mocha?: any
|
|
328
|
+
mocha?: any
|
|
330
329
|
/**
|
|
331
330
|
* [Execute code before](https://codecept.io/bootstrap/) tests are run.
|
|
332
331
|
*
|
|
@@ -340,7 +339,7 @@ declare namespace CodeceptJS {
|
|
|
340
339
|
* bootstrap: 'bootstrap.js',
|
|
341
340
|
* ```
|
|
342
341
|
*/
|
|
343
|
-
bootstrap?: (() => Promise<void>) | boolean | string
|
|
342
|
+
bootstrap?: (() => Promise<void>) | boolean | string
|
|
344
343
|
/**
|
|
345
344
|
* [Execute code after tests](https://codecept.io/bootstrap/) finished.
|
|
346
345
|
*
|
|
@@ -354,22 +353,22 @@ declare namespace CodeceptJS {
|
|
|
354
353
|
* teardown: 'teardown.js',
|
|
355
354
|
* ```
|
|
356
355
|
*/
|
|
357
|
-
teardown?: (() => Promise<void>) | boolean | string
|
|
356
|
+
teardown?: (() => Promise<void>) | boolean | string
|
|
358
357
|
/**
|
|
359
358
|
* [Execute code before launching tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall)
|
|
360
359
|
*
|
|
361
360
|
*/
|
|
362
|
-
bootstrapAll?: (() => Promise<void>) | boolean | string
|
|
361
|
+
bootstrapAll?: (() => Promise<void>) | boolean | string
|
|
363
362
|
/**
|
|
364
363
|
* [Execute JS code after finishing tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall)
|
|
365
364
|
*/
|
|
366
|
-
teardownAll?: (() => Promise<void>) | boolean | string
|
|
365
|
+
teardownAll?: (() => Promise<void>) | boolean | string
|
|
367
366
|
|
|
368
367
|
/** Enable [localized test commands](https://codecept.io/translation/) */
|
|
369
|
-
translation?: string
|
|
368
|
+
translation?: string
|
|
370
369
|
|
|
371
370
|
/** Additional vocabularies for [localication](https://codecept.io/translation/) */
|
|
372
|
-
vocabularies?: Array<string
|
|
371
|
+
vocabularies?: Array<string>
|
|
373
372
|
|
|
374
373
|
/**
|
|
375
374
|
* [Require additional JS modules](https://codecept.io/configuration/#require)
|
|
@@ -379,7 +378,7 @@ declare namespace CodeceptJS {
|
|
|
379
378
|
* require: ["should"]
|
|
380
379
|
* ```
|
|
381
380
|
*/
|
|
382
|
-
require?: Array<string
|
|
381
|
+
require?: Array<string>
|
|
383
382
|
|
|
384
383
|
/**
|
|
385
384
|
* Enable [BDD features](https://codecept.io/bdd/#configuration).
|
|
@@ -394,45 +393,45 @@ declare namespace CodeceptJS {
|
|
|
394
393
|
*/
|
|
395
394
|
gherkin?: {
|
|
396
395
|
/** load feature files by pattern. Multiple patterns can be specified as array */
|
|
397
|
-
features: string | Array<string
|
|
396
|
+
features: string | Array<string>
|
|
398
397
|
/** load step definitions from JS files */
|
|
399
398
|
steps: string | Array<string>
|
|
400
|
-
}
|
|
399
|
+
}
|
|
401
400
|
|
|
402
401
|
/**
|
|
403
402
|
* [AI](https://codecept.io/ai/) features configuration.
|
|
404
403
|
*/
|
|
405
|
-
ai?: AiConfig
|
|
404
|
+
ai?: AiConfig
|
|
406
405
|
|
|
407
406
|
/**
|
|
408
407
|
* Enable full promise-based helper methods for [TypeScript](https://codecept.io/typescript/) project.
|
|
409
408
|
* If true, all helper methods are typed as asynchronous;
|
|
410
409
|
* Otherwise, it remains as it works in versions prior to 3.3.6
|
|
411
410
|
*/
|
|
412
|
-
fullPromiseBased?: boolean
|
|
411
|
+
fullPromiseBased?: boolean
|
|
413
412
|
|
|
414
|
-
[key: string]: any
|
|
415
|
-
}
|
|
413
|
+
[key: string]: any
|
|
414
|
+
}
|
|
416
415
|
|
|
417
416
|
type MockRequest = {
|
|
418
|
-
method: 'GET'|'PUT'|'POST'|'PATCH'|'DELETE'|string
|
|
419
|
-
path: string
|
|
420
|
-
queryParams?: object
|
|
417
|
+
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | string
|
|
418
|
+
path: string
|
|
419
|
+
queryParams?: object
|
|
421
420
|
}
|
|
422
421
|
|
|
423
422
|
type MockResponse = {
|
|
424
|
-
status: number
|
|
425
|
-
body?: object
|
|
423
|
+
status: number
|
|
424
|
+
body?: object
|
|
426
425
|
}
|
|
427
426
|
|
|
428
427
|
type MockInteraction = {
|
|
429
|
-
request: MockRequest
|
|
430
|
-
response: MockResponse
|
|
428
|
+
request: MockRequest
|
|
429
|
+
response: MockResponse
|
|
431
430
|
}
|
|
432
431
|
|
|
433
432
|
interface PageScrollPosition {
|
|
434
|
-
x: number
|
|
435
|
-
y: number
|
|
433
|
+
x: number
|
|
434
|
+
y: number
|
|
436
435
|
}
|
|
437
436
|
|
|
438
437
|
// Could get extended by user generated typings
|
|
@@ -441,25 +440,20 @@ declare namespace CodeceptJS {
|
|
|
441
440
|
interface IHook {}
|
|
442
441
|
interface IScenario {}
|
|
443
442
|
interface IFeature {
|
|
444
|
-
(title: string): FeatureConfig
|
|
443
|
+
(title: string, opts?: { [key: string]: any }): FeatureConfig
|
|
445
444
|
}
|
|
446
445
|
interface CallbackOrder extends Array<any> {}
|
|
447
446
|
interface SupportObject {
|
|
448
|
-
I: CodeceptJS.I
|
|
447
|
+
I: CodeceptJS.I
|
|
449
448
|
}
|
|
450
449
|
namespace Translation {
|
|
451
450
|
interface Actions {}
|
|
452
451
|
}
|
|
453
452
|
|
|
454
453
|
// Extending JSDoc generated typings
|
|
455
|
-
interface Step {
|
|
456
|
-
isMetaStep(): this is MetaStep;
|
|
457
|
-
}
|
|
458
454
|
|
|
459
455
|
// Types who are not be defined by JSDoc
|
|
460
|
-
type actor = <T extends { [action: string]: (...args: any[]) => void }>(
|
|
461
|
-
customSteps?: T & ThisType<WithTranslation<Methods & T>>
|
|
462
|
-
) => WithTranslation<Methods & T>;
|
|
456
|
+
type actor = <T extends { [action: string]: (...args: any[]) => void }>(customSteps?: T & ThisType<WithTranslation<Methods & T>>) => WithTranslation<Methods & T>
|
|
463
457
|
|
|
464
458
|
type ILocator =
|
|
465
459
|
| { id: string }
|
|
@@ -474,49 +468,43 @@ declare namespace CodeceptJS {
|
|
|
474
468
|
| { vue: string }
|
|
475
469
|
| { shadow: string[] }
|
|
476
470
|
| { custom: string }
|
|
477
|
-
| { pw: string }
|
|
471
|
+
| { pw: string }
|
|
478
472
|
interface CustomLocators {}
|
|
479
|
-
interface OtherLocators {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
| Locator
|
|
484
|
-
| OtherLocators
|
|
485
|
-
| CustomLocators[keyof CustomLocators];
|
|
473
|
+
interface OtherLocators {
|
|
474
|
+
props?: object
|
|
475
|
+
}
|
|
476
|
+
type LocatorOrString = string | ILocator | Locator | OtherLocators | CustomLocators[keyof CustomLocators]
|
|
486
477
|
|
|
487
|
-
type StringOrSecret = string | CodeceptJS.Secret
|
|
478
|
+
type StringOrSecret = string | CodeceptJS.Secret
|
|
488
479
|
|
|
489
480
|
interface HookCallback {
|
|
490
|
-
(args: SupportObject): void | Promise<void
|
|
481
|
+
(args: SupportObject): void | Promise<void>
|
|
491
482
|
}
|
|
492
483
|
interface Scenario extends IScenario {
|
|
493
|
-
only: IScenario
|
|
494
|
-
skip: IScenario
|
|
495
|
-
todo: IScenario
|
|
484
|
+
only: IScenario
|
|
485
|
+
skip: IScenario
|
|
486
|
+
todo: IScenario
|
|
496
487
|
}
|
|
497
488
|
interface Feature extends IFeature {
|
|
498
|
-
|
|
489
|
+
only: IFeature
|
|
490
|
+
skip: IFeature
|
|
499
491
|
}
|
|
500
492
|
interface IData {
|
|
501
|
-
Scenario: IScenario
|
|
502
|
-
only: { Scenario: IScenario }
|
|
493
|
+
Scenario: IScenario
|
|
494
|
+
only: { Scenario: IScenario }
|
|
503
495
|
}
|
|
504
496
|
|
|
505
497
|
interface IScenario {
|
|
506
498
|
// Scenario.todo can be called only with a title.
|
|
507
|
-
(title: string, callback?: HookCallback): ScenarioConfig
|
|
508
|
-
(
|
|
509
|
-
title: string,
|
|
510
|
-
opts: { [key: string]: any },
|
|
511
|
-
callback: HookCallback
|
|
512
|
-
): ScenarioConfig;
|
|
499
|
+
(title: string, callback?: HookCallback): ScenarioConfig
|
|
500
|
+
(title: string, opts: { [key: string]: any }, callback: HookCallback): ScenarioConfig
|
|
513
501
|
}
|
|
514
502
|
interface IHook {
|
|
515
|
-
(callback: HookCallback):
|
|
503
|
+
(callback: HookCallback): HookConfig
|
|
516
504
|
}
|
|
517
505
|
|
|
518
506
|
interface Globals {
|
|
519
|
-
codeceptjs: typeof codeceptjs
|
|
507
|
+
codeceptjs: typeof codeceptjs
|
|
520
508
|
}
|
|
521
509
|
|
|
522
510
|
interface IParameterTypeDefinition<T> {
|
|
@@ -526,122 +514,136 @@ declare namespace CodeceptJS {
|
|
|
526
514
|
useForSnippets?: boolean
|
|
527
515
|
preferForRegexpMatch?: boolean
|
|
528
516
|
}
|
|
517
|
+
|
|
518
|
+
interface HookConfig {
|
|
519
|
+
retry(retries?: number): HookConfig
|
|
520
|
+
}
|
|
529
521
|
}
|
|
530
522
|
|
|
523
|
+
type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
|
|
524
|
+
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>;
|
|
525
|
+
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>;
|
|
526
|
+
|
|
527
|
+
|
|
531
528
|
// Globals
|
|
532
|
-
declare const codecept_dir: string
|
|
533
|
-
declare const output_dir: string
|
|
534
|
-
declare
|
|
535
|
-
declare
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
declare const
|
|
539
|
-
declare const
|
|
540
|
-
declare const
|
|
541
|
-
declare const
|
|
542
|
-
declare const
|
|
543
|
-
declare const
|
|
544
|
-
declare const
|
|
545
|
-
declare const
|
|
546
|
-
declare const
|
|
547
|
-
declare const
|
|
548
|
-
declare
|
|
549
|
-
declare function inject
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
declare const secret: typeof CodeceptJS.Secret.secret;
|
|
529
|
+
declare const codecept_dir: string
|
|
530
|
+
declare const output_dir: string
|
|
531
|
+
declare const tryTo: TryTo;
|
|
532
|
+
declare const retryTo: RetryTo;
|
|
533
|
+
declare const hopeThat: HopeThat;
|
|
534
|
+
|
|
535
|
+
declare const actor: CodeceptJS.actor
|
|
536
|
+
declare const codecept_actor: CodeceptJS.actor
|
|
537
|
+
declare const Helper: typeof CodeceptJS.Helper
|
|
538
|
+
declare const codecept_helper: typeof CodeceptJS.Helper
|
|
539
|
+
declare const pause: typeof CodeceptJS.pause
|
|
540
|
+
declare const within: typeof CodeceptJS.within
|
|
541
|
+
declare const session: typeof CodeceptJS.session
|
|
542
|
+
declare const DataTable: typeof CodeceptJS.DataTable
|
|
543
|
+
declare const DataTableArgument: typeof CodeceptJS.DataTableArgument
|
|
544
|
+
declare const codeceptjs: typeof CodeceptJS.index
|
|
545
|
+
declare const locate: typeof CodeceptJS.Locator.build
|
|
546
|
+
declare function inject(): CodeceptJS.SupportObject
|
|
547
|
+
declare function inject<T extends keyof CodeceptJS.SupportObject>(name: T): CodeceptJS.SupportObject[T]
|
|
548
|
+
declare const secret: typeof CodeceptJS.Secret.secret
|
|
553
549
|
|
|
554
550
|
// BDD
|
|
555
|
-
declare const Given: typeof CodeceptJS.addStep
|
|
556
|
-
declare const When: typeof CodeceptJS.addStep
|
|
557
|
-
declare const Then: typeof CodeceptJS.addStep
|
|
558
|
-
|
|
559
|
-
declare const Feature:
|
|
560
|
-
declare const Scenario: CodeceptJS.Scenario
|
|
561
|
-
declare const xScenario: CodeceptJS.IScenario
|
|
562
|
-
declare const xFeature: CodeceptJS.IFeature
|
|
563
|
-
declare function Data(data: any): CodeceptJS.IData
|
|
564
|
-
declare function xData(data: any): CodeceptJS.IData
|
|
551
|
+
declare const Given: typeof CodeceptJS.addStep
|
|
552
|
+
declare const When: typeof CodeceptJS.addStep
|
|
553
|
+
declare const Then: typeof CodeceptJS.addStep
|
|
554
|
+
|
|
555
|
+
declare const Feature: CodeceptJS.Feature
|
|
556
|
+
declare const Scenario: CodeceptJS.Scenario
|
|
557
|
+
declare const xScenario: CodeceptJS.IScenario
|
|
558
|
+
declare const xFeature: CodeceptJS.IFeature
|
|
559
|
+
declare function Data(data: any): CodeceptJS.IData
|
|
560
|
+
declare function xData(data: any): CodeceptJS.IData
|
|
565
561
|
declare function DefineParameterType(options: CodeceptJS.IParameterTypeDefinition<any>): void
|
|
566
562
|
|
|
567
563
|
// Hooks
|
|
568
|
-
declare const BeforeSuite: CodeceptJS.IHook
|
|
569
|
-
declare const AfterSuite: CodeceptJS.IHook
|
|
570
|
-
declare const Background: CodeceptJS.IHook
|
|
571
|
-
declare const Before: CodeceptJS.IHook
|
|
572
|
-
declare const After: CodeceptJS.IHook
|
|
564
|
+
declare const BeforeSuite: CodeceptJS.IHook
|
|
565
|
+
declare const AfterSuite: CodeceptJS.IHook
|
|
566
|
+
declare const Background: CodeceptJS.IHook
|
|
567
|
+
declare const Before: CodeceptJS.IHook
|
|
568
|
+
declare const After: CodeceptJS.IHook
|
|
573
569
|
|
|
574
570
|
// Plugins
|
|
575
571
|
declare const __: any
|
|
576
572
|
|
|
577
573
|
interface Window {
|
|
578
|
-
resq: any
|
|
574
|
+
resq: any
|
|
579
575
|
}
|
|
580
576
|
|
|
581
577
|
declare namespace NodeJS {
|
|
582
578
|
interface Process {
|
|
583
|
-
profile: string
|
|
579
|
+
profile: string
|
|
584
580
|
}
|
|
585
581
|
|
|
586
582
|
interface Global extends CodeceptJS.Globals {
|
|
587
|
-
codecept_dir: typeof codecept_dir
|
|
588
|
-
output_dir: typeof output_dir
|
|
589
|
-
|
|
590
|
-
actor: typeof actor
|
|
591
|
-
codecept_actor: typeof codecept_actor
|
|
592
|
-
Helper: typeof Helper
|
|
593
|
-
codecept_helper: typeof codecept_helper
|
|
594
|
-
pause: typeof pause
|
|
595
|
-
within: typeof within
|
|
596
|
-
session: typeof session
|
|
597
|
-
DataTable: typeof DataTable
|
|
598
|
-
DataTableArgument: typeof DataTableArgument
|
|
599
|
-
locate: typeof locate
|
|
600
|
-
inject: typeof inject
|
|
601
|
-
secret: typeof secret
|
|
583
|
+
codecept_dir: typeof codecept_dir
|
|
584
|
+
output_dir: typeof output_dir
|
|
585
|
+
|
|
586
|
+
actor: typeof actor
|
|
587
|
+
codecept_actor: typeof codecept_actor
|
|
588
|
+
Helper: typeof Helper
|
|
589
|
+
codecept_helper: typeof codecept_helper
|
|
590
|
+
pause: typeof pause
|
|
591
|
+
within: typeof within
|
|
592
|
+
session: typeof session
|
|
593
|
+
DataTable: typeof DataTable
|
|
594
|
+
DataTableArgument: typeof DataTableArgument
|
|
595
|
+
locate: typeof locate
|
|
596
|
+
inject: typeof inject
|
|
597
|
+
secret: typeof secret
|
|
602
598
|
// plugins
|
|
603
|
-
tryTo: typeof tryTo
|
|
604
|
-
retryTo: typeof retryTo
|
|
599
|
+
tryTo: typeof tryTo
|
|
600
|
+
retryTo: typeof retryTo
|
|
605
601
|
|
|
606
602
|
// BDD
|
|
607
|
-
Given: typeof Given
|
|
608
|
-
When: typeof When
|
|
609
|
-
Then: typeof Then
|
|
603
|
+
Given: typeof Given
|
|
604
|
+
When: typeof When
|
|
605
|
+
Then: typeof Then
|
|
610
606
|
DefineParameterType: typeof DefineParameterType
|
|
611
607
|
}
|
|
612
608
|
}
|
|
613
609
|
|
|
614
610
|
declare namespace Mocha {
|
|
615
611
|
interface MochaGlobals {
|
|
616
|
-
Feature: typeof Feature
|
|
617
|
-
Scenario: typeof Scenario
|
|
618
|
-
xFeature: typeof xFeature
|
|
619
|
-
xScenario: typeof xScenario
|
|
620
|
-
Data: typeof Data
|
|
621
|
-
xData: typeof xData
|
|
622
|
-
BeforeSuite: typeof BeforeSuite
|
|
623
|
-
AfterSuite: typeof AfterSuite
|
|
624
|
-
Background: typeof Background
|
|
625
|
-
Before: typeof Before
|
|
626
|
-
After: typeof After
|
|
612
|
+
Feature: typeof Feature
|
|
613
|
+
Scenario: typeof Scenario
|
|
614
|
+
xFeature: typeof xFeature
|
|
615
|
+
xScenario: typeof xScenario
|
|
616
|
+
Data: typeof Data
|
|
617
|
+
xData: typeof xData
|
|
618
|
+
BeforeSuite: typeof BeforeSuite
|
|
619
|
+
AfterSuite: typeof AfterSuite
|
|
620
|
+
Background: typeof Background
|
|
621
|
+
Before: typeof Before
|
|
622
|
+
After: typeof After
|
|
627
623
|
}
|
|
628
624
|
|
|
629
625
|
interface Suite extends SuiteRunnable {
|
|
630
|
-
tags: any[]
|
|
631
|
-
comment: string
|
|
632
|
-
feature: any
|
|
626
|
+
tags: any[]
|
|
627
|
+
comment: string
|
|
628
|
+
feature: any
|
|
633
629
|
}
|
|
634
630
|
|
|
635
631
|
interface Test extends Runnable {
|
|
636
|
-
artifacts: []
|
|
637
|
-
tags: any[]
|
|
632
|
+
artifacts: []
|
|
633
|
+
tags: any[]
|
|
638
634
|
}
|
|
639
635
|
}
|
|
640
636
|
|
|
641
|
-
declare module
|
|
642
|
-
export = codeceptjs
|
|
637
|
+
declare module 'codeceptjs' {
|
|
638
|
+
export = codeceptjs
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
declare module '@codeceptjs/helper' {
|
|
642
|
+
export = CodeceptJS.Helper
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
-
declare module
|
|
646
|
-
export
|
|
645
|
+
declare module 'codeceptjs/effects' {
|
|
646
|
+
export const tryTo: TryTo;
|
|
647
|
+
export const retryTo: RetryTo;
|
|
648
|
+
export const hopeThat: HopeThat;
|
|
647
649
|
}
|