codeceptjs 4.0.0-beta.1 → 4.0.0-beta.10.esm-aria
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 +133 -120
- package/bin/codecept.js +107 -96
- package/bin/test-server.js +64 -0
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +5 -1
- package/lib/actor.js +71 -103
- package/lib/ai.js +159 -188
- package/lib/assert/empty.js +22 -24
- package/lib/assert/equal.js +30 -37
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +43 -48
- package/lib/assert/throws.js +11 -11
- package/lib/assert/truth.js +22 -22
- package/lib/assert.js +20 -18
- package/lib/codecept.js +238 -162
- package/lib/colorUtils.js +50 -52
- package/lib/command/check.js +206 -0
- package/lib/command/configMigrate.js +56 -51
- package/lib/command/definitions.js +96 -109
- package/lib/command/dryRun.js +77 -79
- package/lib/command/generate.js +234 -194
- package/lib/command/gherkin/init.js +42 -33
- package/lib/command/gherkin/snippets.js +76 -74
- package/lib/command/gherkin/steps.js +20 -17
- package/lib/command/info.js +74 -38
- package/lib/command/init.js +300 -290
- package/lib/command/interactive.js +41 -32
- package/lib/command/list.js +28 -27
- package/lib/command/run-multiple/chunk.js +51 -48
- package/lib/command/run-multiple/collection.js +5 -5
- package/lib/command/run-multiple/run.js +5 -1
- package/lib/command/run-multiple.js +97 -97
- package/lib/command/run-rerun.js +19 -25
- package/lib/command/run-workers.js +68 -92
- package/lib/command/run.js +39 -27
- package/lib/command/utils.js +80 -64
- package/lib/command/workers/runTests.js +388 -226
- package/lib/config.js +124 -50
- package/lib/container.js +751 -260
- package/lib/data/context.js +60 -61
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +32 -32
- package/lib/data/table.js +22 -22
- package/lib/effects.js +307 -0
- package/lib/element/WebElement.js +327 -0
- package/lib/els.js +160 -0
- package/lib/event.js +173 -163
- package/lib/globals.js +141 -0
- package/lib/heal.js +89 -85
- package/lib/helper/AI.js +131 -41
- package/lib/helper/ApiDataFactory.js +107 -75
- package/lib/helper/Appium.js +542 -404
- package/lib/helper/FileSystem.js +100 -79
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +52 -52
- package/lib/helper/JSONResponse.js +126 -88
- package/lib/helper/Mochawesome.js +54 -29
- package/lib/helper/Playwright.js +2547 -1316
- package/lib/helper/Puppeteer.js +1578 -1181
- package/lib/helper/REST.js +209 -68
- package/lib/helper/WebDriver.js +1482 -1342
- package/lib/helper/errors/ConnectionRefused.js +6 -6
- package/lib/helper/errors/ElementAssertion.js +11 -16
- package/lib/helper/errors/ElementNotFound.js +5 -9
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
- package/lib/helper/extras/Console.js +11 -11
- package/lib/helper/extras/PlaywrightLocator.js +110 -0
- package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
- package/lib/helper/extras/PlaywrightReactVueLocator.js +17 -8
- package/lib/helper/extras/PlaywrightRestartOpts.js +25 -11
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/helper/extras/React.js +27 -28
- package/lib/helper/network/actions.js +36 -42
- package/lib/helper/network/utils.js +78 -84
- package/lib/helper/scripts/blurElement.js +5 -5
- package/lib/helper/scripts/focusElement.js +5 -5
- package/lib/helper/scripts/highlightElement.js +8 -8
- package/lib/helper/scripts/isElementClickable.js +34 -34
- package/lib/helper.js +2 -3
- package/lib/history.js +23 -19
- package/lib/hooks.js +8 -8
- package/lib/html.js +94 -104
- package/lib/index.js +38 -27
- package/lib/listener/config.js +30 -23
- package/lib/listener/emptyRun.js +54 -0
- package/lib/listener/enhancedGlobalRetry.js +110 -0
- package/lib/listener/exit.js +16 -18
- package/lib/listener/globalRetry.js +70 -0
- package/lib/listener/globalTimeout.js +181 -0
- package/lib/listener/helpers.js +76 -51
- package/lib/listener/mocha.js +10 -11
- package/lib/listener/result.js +11 -0
- package/lib/listener/retryEnhancer.js +85 -0
- package/lib/listener/steps.js +71 -59
- package/lib/listener/store.js +20 -0
- package/lib/locator.js +214 -197
- package/lib/mocha/asyncWrapper.js +274 -0
- package/lib/mocha/bdd.js +167 -0
- package/lib/mocha/cli.js +341 -0
- package/lib/mocha/factory.js +163 -0
- package/lib/mocha/featureConfig.js +89 -0
- package/lib/mocha/gherkin.js +231 -0
- package/lib/mocha/hooks.js +121 -0
- package/lib/mocha/index.js +21 -0
- package/lib/mocha/inject.js +46 -0
- package/lib/{interfaces → mocha}/scenarioConfig.js +58 -34
- package/lib/mocha/suite.js +89 -0
- package/lib/mocha/test.js +184 -0
- package/lib/mocha/types.d.ts +42 -0
- package/lib/mocha/ui.js +242 -0
- package/lib/output.js +141 -71
- package/lib/parser.js +47 -44
- package/lib/pause.js +173 -145
- package/lib/plugin/analyze.js +403 -0
- package/lib/plugin/{autoLogin.js → auth.js} +178 -79
- package/lib/plugin/autoDelay.js +36 -40
- package/lib/plugin/coverage.js +131 -78
- package/lib/plugin/customLocator.js +22 -21
- package/lib/plugin/customReporter.js +53 -0
- package/lib/plugin/enhancedRetryFailedStep.js +99 -0
- package/lib/plugin/heal.js +101 -110
- package/lib/plugin/htmlReporter.js +3648 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/pauseOnFail.js +12 -11
- package/lib/plugin/retryFailedStep.js +82 -47
- package/lib/plugin/screenshotOnFail.js +111 -92
- package/lib/plugin/stepByStepReport.js +159 -101
- package/lib/plugin/stepTimeout.js +20 -25
- package/lib/plugin/subtitles.js +38 -38
- package/lib/recorder.js +193 -130
- package/lib/rerun.js +94 -49
- package/lib/result.js +238 -0
- package/lib/retryCoordinator.js +207 -0
- package/lib/secret.js +20 -18
- package/lib/session.js +95 -89
- 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 +18 -329
- package/lib/steps.js +54 -0
- package/lib/store.js +38 -7
- package/lib/template/heal.js +3 -12
- package/lib/template/prompts/generatePageObject.js +31 -0
- package/lib/template/prompts/healStep.js +13 -0
- package/lib/template/prompts/writeStep.js +9 -0
- package/lib/test-server.js +334 -0
- package/lib/timeout.js +60 -0
- package/lib/transform.js +8 -8
- package/lib/translation.js +34 -21
- package/lib/utils/mask_data.js +47 -0
- package/lib/utils.js +411 -228
- package/lib/workerStorage.js +37 -34
- package/lib/workers.js +532 -296
- package/package.json +115 -95
- package/translations/de-DE.js +5 -3
- package/translations/fr-FR.js +5 -4
- package/translations/index.js +22 -12
- 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 +10 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/index.d.ts +546 -185
- package/typings/promiseBasedTypes.d.ts +150 -879
- package/typings/types.d.ts +547 -996
- package/lib/cli.js +0 -249
- package/lib/dirname.js +0 -5
- package/lib/helper/Expect.js +0 -425
- package/lib/helper/ExpectHelper.js +0 -399
- package/lib/helper/MockServer.js +0 -223
- package/lib/helper/Nightmare.js +0 -1411
- package/lib/helper/Protractor.js +0 -1835
- package/lib/helper/SoftExpectHelper.js +0 -381
- package/lib/helper/TestCafe.js +0 -1410
- package/lib/helper/clientscripts/nightmare.js +0 -213
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -63
- package/lib/interfaces/bdd.js +0 -98
- package/lib/interfaces/featureConfig.js +0 -69
- package/lib/interfaces/gherkin.js +0 -195
- package/lib/listener/artifacts.js +0 -19
- package/lib/listener/retry.js +0 -68
- package/lib/listener/timeout.js +0 -109
- package/lib/mochaFactory.js +0 -110
- package/lib/plugin/allure.js +0 -15
- package/lib/plugin/commentStep.js +0 -136
- package/lib/plugin/debugErrors.js +0 -67
- package/lib/plugin/eachElement.js +0 -127
- package/lib/plugin/fakerTransform.js +0 -49
- package/lib/plugin/retryTo.js +0 -121
- package/lib/plugin/selenoid.js +0 -371
- package/lib/plugin/standardActingHelpers.js +0 -9
- package/lib/plugin/tryTo.js +0 -105
- package/lib/plugin/wdio.js +0 -246
- package/lib/scenario.js +0 -222
- package/lib/ui.js +0 -238
- package/lib/within.js +0 -70
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" />
|
|
@@ -7,137 +8,453 @@
|
|
|
7
8
|
/// <reference types="playwright" />
|
|
8
9
|
|
|
9
10
|
declare namespace CodeceptJS {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
type WithTranslation<T> = T &
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import('./utils').Translate<T, Translation.Actions>
|
|
12
14
|
|
|
13
|
-
// Cookie Type
|
|
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
|
-
// Retry Configuration
|
|
22
22
|
type RetryConfig = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
/** Filter tests by string or regexp pattern */
|
|
24
|
+
grep?: string | RegExp
|
|
25
|
+
/** Number of times to repeat scenarios of a Feature */
|
|
26
|
+
Feature?: number
|
|
27
|
+
/** Number of times to repeat scenarios */
|
|
28
|
+
Scenario?: number
|
|
29
|
+
/** Number of times to repeat Before hook */
|
|
30
|
+
Before?: number
|
|
31
|
+
/** Number of times to repeat After hook */
|
|
32
|
+
After?: number
|
|
33
|
+
/** Number of times to repeat BeforeSuite hook */
|
|
34
|
+
BeforeSuite?: number
|
|
35
|
+
/** Number of times to repeat AfterSuite hook */
|
|
36
|
+
AfterSuite?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
type TimeoutConfig = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
/** Filter tests by string or regexp pattern */
|
|
41
|
+
grep: string | RegExp
|
|
42
|
+
/** Set timeout for a scenarios of a Feature */
|
|
43
|
+
Feature: number
|
|
44
|
+
/** Set timeout for scenarios */
|
|
45
|
+
Scenario: number
|
|
46
|
+
}
|
|
38
47
|
|
|
39
|
-
// AI Configuration
|
|
40
48
|
type AiPrompt = {
|
|
41
|
-
role: string
|
|
42
|
-
content: string
|
|
43
|
-
}
|
|
49
|
+
role: string
|
|
50
|
+
content: string
|
|
51
|
+
}
|
|
44
52
|
|
|
45
53
|
type AiConfig = {
|
|
46
|
-
request
|
|
54
|
+
/** request function to send prompts to AI provider */
|
|
55
|
+
request: (messages: any) => Promise<string>
|
|
56
|
+
|
|
57
|
+
/** custom prompts */
|
|
47
58
|
prompts?: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
/** Returns prompt to write CodeceptJS steps inside pause mode */
|
|
60
|
+
writeStep?: (html: string, input: string) => Array<AiPrompt>
|
|
61
|
+
/** Returns prompt to heal step when test fails on CI if healing is on */
|
|
62
|
+
healStep?: (html: string, object) => Array<AiPrompt>
|
|
63
|
+
/** Returns prompt to generate page object inside pause mode */
|
|
64
|
+
generatePageObject?: (html: string, extraPrompt?: string, rootLocator?: string) => Array<AiPrompt>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** max tokens to use */
|
|
68
|
+
maxTokens?: number
|
|
69
|
+
|
|
70
|
+
/** configuration for processing HTML for GPT */
|
|
57
71
|
html?: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
/** max size of HTML to be sent to OpenAI to avoid token limit */
|
|
73
|
+
maxLength?: number
|
|
74
|
+
/** should HTML be changed by removing non-interactive elements */
|
|
75
|
+
simplify?: boolean
|
|
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>
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
69
85
|
type MainConfig = {
|
|
70
|
-
tests
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
/** Pattern to locate CodeceptJS tests.
|
|
87
|
+
* Allows to enter glob pattern or an Array<string> of patterns to match tests / test file names.
|
|
88
|
+
*
|
|
89
|
+
* For tests in JavaScript:
|
|
90
|
+
*
|
|
91
|
+
* ```js
|
|
92
|
+
* tests: 'tests/**.test.js'
|
|
93
|
+
* ```
|
|
94
|
+
* For tests in TypeScript:
|
|
95
|
+
*
|
|
96
|
+
* ```js
|
|
97
|
+
* tests: 'tests/**.test.ts'
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
tests: string | string[]
|
|
101
|
+
/**
|
|
102
|
+
* Where to store failure screenshots, artifacts, etc
|
|
103
|
+
*
|
|
104
|
+
* ```js
|
|
105
|
+
* output: './output'
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
output: string
|
|
109
|
+
/**
|
|
110
|
+
* empty output folder for next run
|
|
111
|
+
*
|
|
112
|
+
* ```js
|
|
113
|
+
* emptyOutputFolder: true
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
emptyOutputFolder?: boolean
|
|
117
|
+
/**
|
|
118
|
+
* mask sensitive data in output logs
|
|
119
|
+
*
|
|
120
|
+
* ```js
|
|
121
|
+
* maskSensitiveData: true
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
maskSensitiveData?: boolean
|
|
125
|
+
/**
|
|
126
|
+
* Pattern to filter tests by name.
|
|
127
|
+
* This option is useful if you plan to use multiple configs for different environments.
|
|
128
|
+
*
|
|
129
|
+
* To execute only tests with @firefox tag
|
|
130
|
+
*
|
|
131
|
+
* ```js
|
|
132
|
+
* grep: '@firefox'
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
grep?: string
|
|
136
|
+
/**
|
|
137
|
+
* Enable and configure helpers:
|
|
138
|
+
*
|
|
139
|
+
* ```js
|
|
140
|
+
* helpers: {
|
|
141
|
+
* Playwright: {
|
|
142
|
+
* url: 'https://mysite.com',
|
|
143
|
+
* browser: 'firefox'
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
74
148
|
helpers?: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Run web tests controlling browsers via Playwright engine.
|
|
151
|
+
*
|
|
152
|
+
* https://codecept.io/helpers/playwright
|
|
153
|
+
*
|
|
154
|
+
* Available commands:
|
|
155
|
+
* ```js
|
|
156
|
+
* I.amOnPage('/');
|
|
157
|
+
* I.click('Open');
|
|
158
|
+
* I.see('Welcome');
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
Playwright?: PlaywrightConfig
|
|
162
|
+
/**
|
|
163
|
+
* Run web tests controlling browsers via Puppeteer engine.
|
|
164
|
+
*
|
|
165
|
+
* https://codecept.io/helpers/puppeteer
|
|
166
|
+
*
|
|
167
|
+
* Available commands:
|
|
168
|
+
* ```js
|
|
169
|
+
* I.amOnPage('/');
|
|
170
|
+
* I.click('Open');
|
|
171
|
+
* I.see('Welcome');
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
Puppeteer?: PuppeteerConfig
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Run web tests controlling browsers via WebDriver engine.
|
|
178
|
+
*
|
|
179
|
+
* Available commands:
|
|
180
|
+
* ```js
|
|
181
|
+
* I.amOnPage('/');
|
|
182
|
+
* I.click('Open');
|
|
183
|
+
* I.see('Welcome');
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* https://codecept.io/helpers/webdriver
|
|
187
|
+
*/
|
|
188
|
+
WebDriver?: WebDriverConfig
|
|
189
|
+
/**
|
|
190
|
+
* Execute REST API requests for API testing or to assist web testing.
|
|
191
|
+
*
|
|
192
|
+
* https://codecept.io/helpers/REST
|
|
193
|
+
*
|
|
194
|
+
* Available commands:
|
|
195
|
+
* ```js
|
|
196
|
+
* I.sendGetRequest('/');
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
REST?: RESTConfig
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Use JSON assertions for API testing.
|
|
203
|
+
* Can be paired with REST or GraphQL helpers.
|
|
204
|
+
*
|
|
205
|
+
* https://codecept.io/helpers/JSONResponse
|
|
206
|
+
*
|
|
207
|
+
* Available commands:
|
|
208
|
+
* ```js
|
|
209
|
+
* I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } });
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
JSONResponse?: any
|
|
213
|
+
|
|
214
|
+
/** Enable AI features for development purposes */
|
|
215
|
+
AI?: any
|
|
216
|
+
|
|
217
|
+
[key: string]: any
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Enable CodeceptJS plugins.
|
|
221
|
+
*
|
|
222
|
+
* https://codecept.io/plugins/
|
|
223
|
+
*
|
|
224
|
+
* Plugins listen to test events and extend functionality of CodeceptJS.
|
|
225
|
+
*
|
|
226
|
+
* Example:
|
|
227
|
+
*
|
|
228
|
+
* ```js
|
|
229
|
+
* plugins: {
|
|
230
|
+
* autoDelay: {
|
|
231
|
+
* enabled: true
|
|
232
|
+
* }
|
|
233
|
+
}
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
plugins?: any
|
|
237
|
+
/**
|
|
238
|
+
* Include page objects to access them via dependency injection
|
|
239
|
+
*
|
|
240
|
+
* ```js
|
|
241
|
+
* I: "./custom_steps.js",
|
|
242
|
+
* loginPage: "./pages/Login.js",
|
|
243
|
+
* User: "./pages/User.js",
|
|
244
|
+
* ```
|
|
245
|
+
* Configured modules can be injected by name in a Scenario:
|
|
246
|
+
*
|
|
247
|
+
* ```js
|
|
248
|
+
* Scenario('test', { I, loginPage, User })
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
include?: any
|
|
252
|
+
/**
|
|
253
|
+
* Set default tests timeout in seconds.
|
|
254
|
+
* Tests will be killed on no response after timeout.
|
|
255
|
+
*
|
|
256
|
+
* ```js
|
|
257
|
+
* timeout: 20,
|
|
258
|
+
* ```
|
|
259
|
+
*
|
|
260
|
+
* Can be customized to use different timeouts for a subset of tests:
|
|
261
|
+
*
|
|
262
|
+
* ```js
|
|
263
|
+
* timeout: [
|
|
264
|
+
* 10,
|
|
265
|
+
* {
|
|
266
|
+
* grep: '@slow',
|
|
267
|
+
* Scenario: 20
|
|
268
|
+
* }
|
|
269
|
+
* ]
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
timeout?: number | Array<TimeoutConfig> | TimeoutConfig
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Configure retry strategy for tests
|
|
276
|
+
*
|
|
277
|
+
* To retry all tests 3 times:
|
|
278
|
+
*
|
|
279
|
+
* ```js
|
|
280
|
+
* retry: 3
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* To retry only Before hook 3 times:
|
|
284
|
+
*
|
|
285
|
+
* ```js
|
|
286
|
+
* retry: {
|
|
287
|
+
* Before: 3
|
|
288
|
+
* }
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* To retry tests marked as flaky 3 times, other 1 time:
|
|
292
|
+
*
|
|
293
|
+
* ```js
|
|
294
|
+
* retry: [
|
|
295
|
+
* {
|
|
296
|
+
* Scenario: 1,
|
|
297
|
+
* Before: 1
|
|
298
|
+
* },
|
|
299
|
+
* {
|
|
300
|
+
* grep: '@flaky',
|
|
301
|
+
* Scenario: 3
|
|
302
|
+
* Before: 3
|
|
303
|
+
* }
|
|
304
|
+
* ]
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
retry?: number | Array<RetryConfig> | RetryConfig
|
|
308
|
+
|
|
309
|
+
/** Disable registering global functions (Before, Scenario, etc). Not recommended */
|
|
310
|
+
noGlobals?: boolean
|
|
311
|
+
/**
|
|
312
|
+
* [Mocha test runner options](https://mochajs.org/#configuring-mocha-nodejs), additional [reporters](https://codecept.io/reports/#xml) can be configured here.
|
|
313
|
+
*
|
|
314
|
+
* Example:
|
|
315
|
+
*
|
|
316
|
+
* ```js
|
|
317
|
+
* mocha: {
|
|
318
|
+
* "mocha-junit-reporter": {
|
|
319
|
+
* stdout: "./output/console.log",
|
|
320
|
+
* options: {
|
|
321
|
+
* mochaFile: "./output/result.xml",
|
|
322
|
+
* attachments: true //add screenshot for a failed test
|
|
323
|
+
* }
|
|
324
|
+
* }
|
|
325
|
+
* }
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
mocha?: any
|
|
329
|
+
/**
|
|
330
|
+
* [Execute code before](https://codecept.io/bootstrap/) tests are run.
|
|
331
|
+
*
|
|
332
|
+
* Can be either JS module file or async function:
|
|
333
|
+
*
|
|
334
|
+
* ```js
|
|
335
|
+
* bootstrap: async () => server.launch(),
|
|
336
|
+
* ```
|
|
337
|
+
* or
|
|
338
|
+
* ```js
|
|
339
|
+
* bootstrap: 'bootstrap.js',
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
bootstrap?: (() => Promise<void>) | boolean | string
|
|
343
|
+
/**
|
|
344
|
+
* [Execute code after tests](https://codecept.io/bootstrap/) finished.
|
|
345
|
+
*
|
|
346
|
+
* Can be either JS module file or async function:
|
|
347
|
+
*
|
|
348
|
+
* ```js
|
|
349
|
+
* teardown: async () => server.stop(),
|
|
350
|
+
* ```
|
|
351
|
+
* or
|
|
352
|
+
* ```js
|
|
353
|
+
* teardown: 'teardown.js',
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
teardown?: (() => Promise<void>) | boolean | string
|
|
357
|
+
/**
|
|
358
|
+
* [Execute code before launching tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall)
|
|
359
|
+
*
|
|
360
|
+
*/
|
|
361
|
+
bootstrapAll?: (() => Promise<void>) | boolean | string
|
|
362
|
+
/**
|
|
363
|
+
* [Execute JS code after finishing tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall)
|
|
364
|
+
*/
|
|
365
|
+
teardownAll?: (() => Promise<void>) | boolean | string
|
|
366
|
+
|
|
367
|
+
/** Enable [localized test commands](https://codecept.io/translation/) */
|
|
368
|
+
translation?: string
|
|
369
|
+
|
|
370
|
+
/** Additional vocabularies for [localication](https://codecept.io/translation/) */
|
|
371
|
+
vocabularies?: Array<string>
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* [Require additional JS modules](https://codecept.io/configuration/#require)
|
|
375
|
+
*
|
|
376
|
+
* Example:
|
|
377
|
+
* ```
|
|
378
|
+
* require: ["should"]
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
require?: Array<string>
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Enable [BDD features](https://codecept.io/bdd/#configuration).
|
|
385
|
+
*
|
|
386
|
+
* Sample configuration:
|
|
387
|
+
* ```js
|
|
388
|
+
* gherkin: {
|
|
389
|
+
* features: "./features/*.feature",
|
|
390
|
+
* steps: ["./step_definitions/steps.js"]
|
|
391
|
+
* }
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
96
394
|
gherkin?: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
395
|
+
/** load feature files by pattern. Multiple patterns can be specified as array */
|
|
396
|
+
features: string | Array<string>
|
|
397
|
+
/** load step definitions from JS files */
|
|
398
|
+
steps: string | Array<string>
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* [AI](https://codecept.io/ai/) features configuration.
|
|
403
|
+
*/
|
|
404
|
+
ai?: AiConfig
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Enable full promise-based helper methods for [TypeScript](https://codecept.io/typescript/) project.
|
|
408
|
+
* If true, all helper methods are typed as asynchronous;
|
|
409
|
+
* Otherwise, it remains as it works in versions prior to 3.3.6
|
|
410
|
+
*/
|
|
411
|
+
fullPromiseBased?: boolean
|
|
412
|
+
|
|
413
|
+
[key: string]: any
|
|
414
|
+
}
|
|
415
|
+
|
|
106
416
|
type MockRequest = {
|
|
107
|
-
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | string
|
|
108
|
-
path: string
|
|
109
|
-
queryParams?: object
|
|
110
|
-
}
|
|
417
|
+
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | string
|
|
418
|
+
path: string
|
|
419
|
+
queryParams?: object
|
|
420
|
+
}
|
|
111
421
|
|
|
112
422
|
type MockResponse = {
|
|
113
|
-
status: number
|
|
114
|
-
body?: object
|
|
115
|
-
}
|
|
423
|
+
status: number
|
|
424
|
+
body?: object
|
|
425
|
+
}
|
|
116
426
|
|
|
117
427
|
type MockInteraction = {
|
|
118
|
-
request: MockRequest
|
|
119
|
-
response: MockResponse
|
|
120
|
-
}
|
|
428
|
+
request: MockRequest
|
|
429
|
+
response: MockResponse
|
|
430
|
+
}
|
|
121
431
|
|
|
122
|
-
// Page Scroll
|
|
123
432
|
interface PageScrollPosition {
|
|
124
|
-
x: number
|
|
125
|
-
y: number
|
|
433
|
+
x: number
|
|
434
|
+
y: number
|
|
126
435
|
}
|
|
127
436
|
|
|
128
|
-
//
|
|
437
|
+
// Could get extended by user generated typings
|
|
129
438
|
interface Methods extends ActorStatic {}
|
|
130
439
|
interface I {}
|
|
131
440
|
interface IHook {}
|
|
132
441
|
interface IScenario {}
|
|
133
442
|
interface IFeature {
|
|
134
|
-
(title: string): FeatureConfig
|
|
443
|
+
(title: string, opts?: { [key: string]: any }): FeatureConfig
|
|
135
444
|
}
|
|
445
|
+
interface CallbackOrder extends Array<any> {}
|
|
136
446
|
interface SupportObject {
|
|
137
|
-
I: CodeceptJS.I
|
|
447
|
+
I: CodeceptJS.I
|
|
448
|
+
}
|
|
449
|
+
namespace Translation {
|
|
450
|
+
interface Actions {}
|
|
138
451
|
}
|
|
139
452
|
|
|
140
|
-
//
|
|
453
|
+
// Extending JSDoc generated typings
|
|
454
|
+
|
|
455
|
+
// Types who are not be defined by JSDoc
|
|
456
|
+
type actor = <T extends { [action: string]: (...args: any[]) => void }>(customSteps?: T & ThisType<WithTranslation<Methods & T>>) => WithTranslation<Methods & T>
|
|
457
|
+
|
|
141
458
|
type ILocator =
|
|
142
459
|
| { id: string }
|
|
143
460
|
| { xpath: string }
|
|
@@ -146,144 +463,188 @@ declare namespace CodeceptJS {
|
|
|
146
463
|
| { frame: string }
|
|
147
464
|
| { android: string }
|
|
148
465
|
| { ios: string }
|
|
466
|
+
| { android: string; ios: string }
|
|
149
467
|
| { react: string }
|
|
150
468
|
| { vue: string }
|
|
151
469
|
| { shadow: string[] }
|
|
152
470
|
| { custom: string }
|
|
153
|
-
| { pw: string }
|
|
154
|
-
|
|
155
|
-
|
|
471
|
+
| { pw: string }
|
|
472
|
+
interface CustomLocators {}
|
|
473
|
+
interface OtherLocators {
|
|
474
|
+
props?: object
|
|
475
|
+
}
|
|
476
|
+
type LocatorOrString = string | ILocator | Locator | OtherLocators | CustomLocators[keyof CustomLocators]
|
|
156
477
|
|
|
157
|
-
type StringOrSecret = string | CodeceptJS.Secret
|
|
478
|
+
type StringOrSecret = string | CodeceptJS.Secret
|
|
158
479
|
|
|
159
|
-
// Hook and Scenario Callbacks
|
|
160
480
|
interface HookCallback {
|
|
161
|
-
(args: SupportObject): void | Promise<void
|
|
481
|
+
(args: SupportObject): void | Promise<void>
|
|
162
482
|
}
|
|
163
|
-
|
|
164
483
|
interface Scenario extends IScenario {
|
|
165
|
-
only: IScenario
|
|
166
|
-
skip: IScenario
|
|
167
|
-
todo: IScenario
|
|
484
|
+
only: IScenario
|
|
485
|
+
skip: IScenario
|
|
486
|
+
todo: IScenario
|
|
168
487
|
}
|
|
169
|
-
|
|
170
488
|
interface Feature extends IFeature {
|
|
171
|
-
|
|
489
|
+
only: IFeature
|
|
490
|
+
skip: IFeature
|
|
172
491
|
}
|
|
173
|
-
|
|
174
492
|
interface IData {
|
|
175
|
-
Scenario: IScenario
|
|
176
|
-
only: { Scenario: IScenario }
|
|
493
|
+
Scenario: IScenario
|
|
494
|
+
only: { Scenario: IScenario }
|
|
177
495
|
}
|
|
178
496
|
|
|
179
|
-
// Scenario Interface
|
|
180
497
|
interface IScenario {
|
|
181
|
-
|
|
182
|
-
(
|
|
183
|
-
|
|
184
|
-
opts: { [key: string]: any },
|
|
185
|
-
callback: HookCallback
|
|
186
|
-
): ScenarioConfig;
|
|
498
|
+
// Scenario.todo can be called only with a title.
|
|
499
|
+
(title: string, callback?: HookCallback): ScenarioConfig
|
|
500
|
+
(title: string, opts: { [key: string]: any }, callback: HookCallback): ScenarioConfig
|
|
187
501
|
}
|
|
188
|
-
|
|
189
502
|
interface IHook {
|
|
190
|
-
(callback: HookCallback):
|
|
503
|
+
(callback: HookCallback): HookConfig
|
|
191
504
|
}
|
|
192
505
|
|
|
193
|
-
// Global Utilities
|
|
194
506
|
interface Globals {
|
|
195
|
-
codeceptjs: typeof codeceptjs
|
|
507
|
+
codeceptjs: typeof codeceptjs
|
|
196
508
|
}
|
|
197
509
|
|
|
198
|
-
// BDD Parameter Types
|
|
199
510
|
interface IParameterTypeDefinition<T> {
|
|
200
|
-
name: string
|
|
201
|
-
regexp: readonly RegExp[] | readonly string[] | RegExp | string
|
|
202
|
-
transformer: (...match: string[]) => T
|
|
203
|
-
useForSnippets?: boolean
|
|
204
|
-
preferForRegexpMatch?: boolean
|
|
511
|
+
name: string
|
|
512
|
+
regexp: readonly RegExp[] | readonly string[] | RegExp | string
|
|
513
|
+
transformer: (...match: string[]) => T
|
|
514
|
+
useForSnippets?: boolean
|
|
515
|
+
preferForRegexpMatch?: boolean
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
interface HookConfig {
|
|
519
|
+
retry(retries?: number): HookConfig
|
|
205
520
|
}
|
|
521
|
+
|
|
522
|
+
function addStep(step: string, fn: Function): Promise<void>
|
|
206
523
|
}
|
|
207
524
|
|
|
525
|
+
type TryTo = <T>(fn: () => Promise<T> | T) => Promise<T | false>
|
|
526
|
+
type HopeThat = <T>(fn: () => Promise<T> | T) => Promise<T | false>
|
|
527
|
+
type RetryTo = <T>(fn: () => Promise<T> | T, retries?: number) => Promise<T>
|
|
528
|
+
|
|
208
529
|
// Globals
|
|
209
|
-
declare const codecept_dir: string
|
|
210
|
-
declare const output_dir: string
|
|
211
|
-
declare
|
|
212
|
-
declare
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
declare const
|
|
216
|
-
declare const
|
|
217
|
-
declare const
|
|
218
|
-
declare const
|
|
219
|
-
declare const
|
|
220
|
-
declare const
|
|
221
|
-
declare const
|
|
530
|
+
declare const codecept_dir: string
|
|
531
|
+
declare const output_dir: string
|
|
532
|
+
declare const tryTo: TryTo
|
|
533
|
+
declare const retryTo: RetryTo
|
|
534
|
+
declare const hopeThat: HopeThat
|
|
535
|
+
|
|
536
|
+
declare const actor: CodeceptJS.actor
|
|
537
|
+
declare const codecept_actor: CodeceptJS.actor
|
|
538
|
+
declare const Helper: typeof CodeceptJS.Helper
|
|
539
|
+
declare const codecept_helper: typeof CodeceptJS.Helper
|
|
540
|
+
declare const pause: typeof CodeceptJS.pause
|
|
541
|
+
declare const within: typeof CodeceptJS.within
|
|
542
|
+
declare const session: typeof CodeceptJS.session
|
|
543
|
+
declare const DataTable: typeof CodeceptJS.DataTable
|
|
544
|
+
declare const DataTableArgument: typeof CodeceptJS.DataTableArgument
|
|
545
|
+
declare const codeceptjs: typeof CodeceptJS
|
|
546
|
+
declare const locate: typeof CodeceptJS.Locator.build
|
|
547
|
+
declare function inject(): CodeceptJS.SupportObject
|
|
548
|
+
declare function inject<T extends keyof CodeceptJS.SupportObject>(name: T): CodeceptJS.SupportObject[T]
|
|
549
|
+
declare const secret: typeof CodeceptJS.Secret.secret
|
|
222
550
|
|
|
223
551
|
// BDD
|
|
224
|
-
declare const Given: typeof CodeceptJS.addStep
|
|
225
|
-
declare const When: typeof CodeceptJS.addStep
|
|
226
|
-
declare const Then: typeof CodeceptJS.addStep
|
|
552
|
+
declare const Given: typeof CodeceptJS.addStep
|
|
553
|
+
declare const When: typeof CodeceptJS.addStep
|
|
554
|
+
declare const Then: typeof CodeceptJS.addStep
|
|
555
|
+
|
|
556
|
+
declare const Feature: CodeceptJS.Feature
|
|
557
|
+
declare const Scenario: CodeceptJS.Scenario
|
|
558
|
+
declare const xScenario: CodeceptJS.IScenario
|
|
559
|
+
declare const xFeature: CodeceptJS.IFeature
|
|
560
|
+
declare function Data(data: any): CodeceptJS.IData
|
|
561
|
+
declare function xData(data: any): CodeceptJS.IData
|
|
562
|
+
declare function DefineParameterType(options: CodeceptJS.IParameterTypeDefinition<any>): void
|
|
227
563
|
|
|
228
564
|
// Hooks
|
|
229
|
-
declare const BeforeSuite: CodeceptJS.IHook
|
|
230
|
-
declare const AfterSuite: CodeceptJS.IHook
|
|
231
|
-
declare const
|
|
232
|
-
declare const
|
|
565
|
+
declare const BeforeSuite: CodeceptJS.IHook
|
|
566
|
+
declare const AfterSuite: CodeceptJS.IHook
|
|
567
|
+
declare const Background: CodeceptJS.IHook
|
|
568
|
+
declare const Before: CodeceptJS.IHook
|
|
569
|
+
declare const After: CodeceptJS.IHook
|
|
570
|
+
|
|
571
|
+
// Plugins
|
|
572
|
+
declare const __: any
|
|
573
|
+
|
|
574
|
+
interface Window {
|
|
575
|
+
resq: any
|
|
576
|
+
}
|
|
233
577
|
|
|
234
|
-
// Process Interface
|
|
235
578
|
declare namespace NodeJS {
|
|
236
579
|
interface Process {
|
|
237
|
-
profile
|
|
238
|
-
env?: {
|
|
239
|
-
[key: string]: string | undefined;
|
|
240
|
-
};
|
|
580
|
+
profile: string
|
|
241
581
|
}
|
|
242
582
|
|
|
243
583
|
interface Global extends CodeceptJS.Globals {
|
|
244
|
-
codecept_dir: typeof codecept_dir
|
|
245
|
-
output_dir: typeof output_dir
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
584
|
+
codecept_dir: typeof codecept_dir
|
|
585
|
+
output_dir: typeof output_dir
|
|
586
|
+
|
|
587
|
+
actor: typeof actor
|
|
588
|
+
codecept_actor: typeof codecept_actor
|
|
589
|
+
Helper: typeof Helper
|
|
590
|
+
codecept_helper: typeof codecept_helper
|
|
591
|
+
pause: typeof pause
|
|
592
|
+
within: typeof within
|
|
593
|
+
session: typeof session
|
|
594
|
+
DataTable: typeof DataTable
|
|
595
|
+
DataTableArgument: typeof DataTableArgument
|
|
596
|
+
locate: typeof locate
|
|
597
|
+
inject: typeof inject
|
|
598
|
+
secret: typeof secret
|
|
599
|
+
// plugins
|
|
600
|
+
tryTo: typeof tryTo
|
|
601
|
+
retryTo: typeof retryTo
|
|
602
|
+
|
|
603
|
+
// BDD
|
|
604
|
+
Given: typeof Given
|
|
605
|
+
When: typeof When
|
|
606
|
+
Then: typeof Then
|
|
607
|
+
DefineParameterType: typeof DefineParameterType
|
|
259
608
|
}
|
|
260
609
|
}
|
|
261
610
|
|
|
262
611
|
declare namespace Mocha {
|
|
263
612
|
interface MochaGlobals {
|
|
264
|
-
Feature: typeof Feature
|
|
265
|
-
Scenario: typeof Scenario
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
613
|
+
Feature: typeof Feature
|
|
614
|
+
Scenario: typeof Scenario
|
|
615
|
+
xFeature: typeof xFeature
|
|
616
|
+
xScenario: typeof xScenario
|
|
617
|
+
Data: typeof Data
|
|
618
|
+
xData: typeof xData
|
|
619
|
+
BeforeSuite: typeof BeforeSuite
|
|
620
|
+
AfterSuite: typeof AfterSuite
|
|
621
|
+
Background: typeof Background
|
|
622
|
+
Before: typeof Before
|
|
623
|
+
After: typeof After
|
|
270
624
|
}
|
|
271
625
|
|
|
272
626
|
interface Suite extends SuiteRunnable {
|
|
273
|
-
tags
|
|
274
|
-
|
|
627
|
+
tags: any[]
|
|
628
|
+
comment: string
|
|
629
|
+
feature: any
|
|
275
630
|
}
|
|
276
631
|
|
|
277
632
|
interface Test extends Runnable {
|
|
278
|
-
artifacts
|
|
279
|
-
tags
|
|
633
|
+
artifacts: []
|
|
634
|
+
tags: any[]
|
|
280
635
|
}
|
|
281
636
|
}
|
|
282
637
|
|
|
283
|
-
declare module
|
|
284
|
-
export
|
|
638
|
+
declare module 'codeceptjs' {
|
|
639
|
+
export default codeceptjs
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
declare module '@codeceptjs/helper' {
|
|
643
|
+
export default CodeceptJS.Helper
|
|
285
644
|
}
|
|
286
645
|
|
|
287
|
-
declare module
|
|
288
|
-
export
|
|
646
|
+
declare module 'codeceptjs/effects' {
|
|
647
|
+
export const tryTo: TryTo
|
|
648
|
+
export const retryTo: RetryTo
|
|
649
|
+
export const hopeThat: HopeThat
|
|
289
650
|
}
|