codeceptjs 3.6.4-beta.2 → 3.6.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codecept.js +84 -63
- package/lib/ai.js +47 -1
- package/lib/assert/empty.js +19 -19
- package/lib/assert/equal.js +32 -30
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +42 -42
- package/lib/assert/throws.js +13 -11
- package/lib/assert/truth.js +17 -18
- package/lib/command/configMigrate.js +57 -52
- package/lib/command/definitions.js +88 -88
- package/lib/command/dryRun.js +65 -63
- package/lib/command/generate.js +191 -181
- package/lib/command/info.js +39 -37
- package/lib/command/init.js +289 -286
- package/lib/command/interactive.js +32 -32
- package/lib/command/list.js +26 -26
- package/lib/command/run-multiple.js +113 -93
- package/lib/command/run-rerun.js +22 -22
- package/lib/command/run-workers.js +63 -63
- package/lib/command/run.js +24 -26
- package/lib/command/utils.js +64 -63
- package/lib/data/context.js +60 -60
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +29 -29
- package/lib/data/table.js +26 -20
- package/lib/helper/AI.js +114 -35
- package/lib/helper/ApiDataFactory.js +72 -69
- package/lib/helper/Appium.js +409 -379
- package/lib/helper/ExpectHelper.js +214 -248
- package/lib/helper/FileSystem.js +77 -78
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +49 -50
- package/lib/helper/JSONResponse.js +64 -62
- package/lib/helper/Mochawesome.js +28 -28
- package/lib/helper/MockServer.js +12 -12
- package/lib/helper/Nightmare.js +664 -572
- package/lib/helper/Playwright.js +1320 -1211
- package/lib/helper/Protractor.js +663 -629
- package/lib/helper/Puppeteer.js +1232 -1124
- package/lib/helper/REST.js +115 -69
- package/lib/helper/TestCafe.js +490 -491
- package/lib/helper/WebDriver.js +1294 -1156
- package/lib/history.js +16 -3
- package/lib/interfaces/bdd.js +38 -51
- package/lib/interfaces/featureConfig.js +19 -19
- package/lib/interfaces/gherkin.js +122 -111
- package/lib/interfaces/scenarioConfig.js +29 -29
- package/lib/listener/artifacts.js +9 -9
- package/lib/listener/config.js +24 -23
- package/lib/listener/exit.js +12 -12
- package/lib/listener/helpers.js +42 -42
- package/lib/listener/mocha.js +11 -11
- package/lib/listener/retry.js +32 -30
- package/lib/listener/steps.js +50 -51
- package/lib/listener/timeout.js +53 -53
- package/lib/pause.js +17 -3
- package/lib/plugin/allure.js +14 -14
- package/lib/plugin/autoDelay.js +29 -36
- package/lib/plugin/autoLogin.js +70 -66
- package/lib/plugin/commentStep.js +18 -18
- package/lib/plugin/coverage.js +92 -77
- package/lib/plugin/customLocator.js +20 -19
- package/lib/plugin/debugErrors.js +24 -24
- package/lib/plugin/eachElement.js +37 -37
- package/lib/plugin/fakerTransform.js +6 -6
- package/lib/plugin/heal.js +66 -63
- package/lib/plugin/pauseOnFail.js +10 -10
- package/lib/plugin/retryFailedStep.js +31 -38
- package/lib/plugin/retryTo.js +28 -28
- package/lib/plugin/screenshotOnFail.js +107 -86
- package/lib/plugin/selenoid.js +131 -117
- package/lib/plugin/standardActingHelpers.js +2 -8
- package/lib/plugin/stepByStepReport.js +102 -92
- package/lib/plugin/stepTimeout.js +23 -22
- package/lib/plugin/subtitles.js +34 -34
- package/lib/plugin/tryTo.js +39 -29
- package/lib/plugin/wdio.js +77 -72
- package/lib/template/heal.js +11 -14
- package/package.json +5 -3
- package/translations/de-DE.js +1 -1
- package/translations/fr-FR.js +1 -1
- package/translations/index.js +9 -9
- package/translations/it-IT.js +1 -1
- package/translations/ja-JP.js +1 -1
- package/translations/pl-PL.js +1 -1
- package/translations/pt-BR.js +1 -1
- package/translations/ru-RU.js +1 -1
- package/translations/zh-CN.js +1 -1
- package/translations/zh-TW.js +1 -1
- package/typings/index.d.ts +42 -19
- package/typings/promiseBasedTypes.d.ts +280 -1
- package/typings/types.d.ts +76 -1
|
@@ -5,6 +5,8 @@ declare namespace CodeceptJS {
|
|
|
5
5
|
* This helper class provides integration with the AI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
|
|
6
6
|
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
7
7
|
*
|
|
8
|
+
* Use it only in development mode. It is recommended to run it only inside pause() mode.
|
|
9
|
+
*
|
|
8
10
|
* ## Configuration
|
|
9
11
|
*
|
|
10
12
|
* This helper should be configured in codecept.json or codecept.conf.js
|
|
@@ -34,10 +36,34 @@ declare namespace CodeceptJS {
|
|
|
34
36
|
*/
|
|
35
37
|
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
36
38
|
/**
|
|
37
|
-
* Send a general request to
|
|
39
|
+
* Send a general request to AI and return response.
|
|
38
40
|
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
39
41
|
*/
|
|
40
42
|
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Generates PageObject for current page using AI.
|
|
45
|
+
*
|
|
46
|
+
* It saves the PageObject to the output directory. You can review the page object and adjust it as needed and move to pages directory.
|
|
47
|
+
* Prompt can be customized in a global config file.
|
|
48
|
+
*
|
|
49
|
+
* ```js
|
|
50
|
+
* // create page object for whole page
|
|
51
|
+
* I.askForPageObject('home');
|
|
52
|
+
*
|
|
53
|
+
* // create page object with extra prompt
|
|
54
|
+
* I.askForPageObject('home', 'implement signIn(username, password) method');
|
|
55
|
+
*
|
|
56
|
+
* // create page object for a specific element
|
|
57
|
+
* I.askForPageObject('home', null, '.detail');
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Asks for a page object based on the provided page name, locator, and extra prompt.
|
|
61
|
+
* @param pageName - The name of the page to retrieve the object for.
|
|
62
|
+
* @param [extraPrompt = null] - An optional extra prompt for additional context or information.
|
|
63
|
+
* @param [locator = null] - An optional locator to find a specific element on the page.
|
|
64
|
+
* @returns A promise that resolves to the requested page object.
|
|
65
|
+
*/
|
|
66
|
+
askForPageObject(pageName: string, extraPrompt?: string | null, locator?: string | null): Promise<object>;
|
|
41
67
|
}
|
|
42
68
|
/**
|
|
43
69
|
* Helper for managing remote data using REST API.
|
|
@@ -1155,6 +1181,8 @@ declare namespace CodeceptJS {
|
|
|
1155
1181
|
* ## Methods
|
|
1156
1182
|
*/
|
|
1157
1183
|
// @ts-ignore
|
|
1184
|
+
// @ts-ignore
|
|
1185
|
+
// @ts-ignore
|
|
1158
1186
|
class ExpectHelper {
|
|
1159
1187
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1160
1188
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1267,6 +1295,8 @@ declare namespace CodeceptJS {
|
|
|
1267
1295
|
* ## Methods
|
|
1268
1296
|
*/
|
|
1269
1297
|
// @ts-ignore
|
|
1298
|
+
// @ts-ignore
|
|
1299
|
+
// @ts-ignore
|
|
1270
1300
|
class ExpectHelper {
|
|
1271
1301
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1272
1302
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1939,6 +1969,8 @@ declare namespace CodeceptJS {
|
|
|
1939
1969
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1940
1970
|
*/
|
|
1941
1971
|
// @ts-ignore
|
|
1972
|
+
// @ts-ignore
|
|
1973
|
+
// @ts-ignore
|
|
1942
1974
|
type MockServerConfig = {
|
|
1943
1975
|
port?: number;
|
|
1944
1976
|
host?: string;
|
|
@@ -2064,6 +2096,8 @@ declare namespace CodeceptJS {
|
|
|
2064
2096
|
* ## Methods
|
|
2065
2097
|
*/
|
|
2066
2098
|
// @ts-ignore
|
|
2099
|
+
// @ts-ignore
|
|
2100
|
+
// @ts-ignore
|
|
2067
2101
|
class MockServer {
|
|
2068
2102
|
/**
|
|
2069
2103
|
* Start the mock server
|
|
@@ -3093,6 +3127,91 @@ declare namespace CodeceptJS {
|
|
|
3093
3127
|
*/
|
|
3094
3128
|
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
3095
3129
|
}
|
|
3130
|
+
/**
|
|
3131
|
+
* ## Configuration
|
|
3132
|
+
*
|
|
3133
|
+
* This helper should be configured in codecept.conf.(js|ts)
|
|
3134
|
+
* @property [url] - base url of website to be tested
|
|
3135
|
+
* @property [browser = 'chromium'] - a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
3136
|
+
* @property [show = true] - show browser window.
|
|
3137
|
+
* @property [restart = false] - restart strategy between tests. Possible values:
|
|
3138
|
+
* * 'context' or **false** - restarts [browser context](https://playwright.dev/docs/api/class-browsercontext) but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
3139
|
+
* * 'browser' or **true** - closes browser and opens it again between tests.
|
|
3140
|
+
* * 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
3141
|
+
* @property [timeout = 1000] - - [timeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout) in ms of all Playwright actions .
|
|
3142
|
+
* @property [disableScreenshots = false] - don't save screenshot on failure.
|
|
3143
|
+
* @property [emulate] - browser in device emulation mode.
|
|
3144
|
+
* @property [video = false] - enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
3145
|
+
* @property [keepVideoForPassedTests = false] - save videos for passed tests; videos are saved into `output/videos` folder
|
|
3146
|
+
* @property [trace = false] - record [tracing information](https://playwright.dev/docs/trace-viewer) with screenshots and snapshots.
|
|
3147
|
+
* @property [keepTraceForPassedTests = false] - save trace for passed tests.
|
|
3148
|
+
* @property [fullPageScreenshots = false] - make full page screenshots on failure.
|
|
3149
|
+
* @property [uniqueScreenshotNames = false] - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
3150
|
+
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to 'session'.
|
|
3151
|
+
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to 'session'.
|
|
3152
|
+
* @property [waitForAction] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
3153
|
+
* @property [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-url).
|
|
3154
|
+
* @property [pressKeyDelay = 10] - Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
3155
|
+
* @property [getPageTimeout] - config option to set maximum navigation time in milliseconds.
|
|
3156
|
+
* @property [waitForTimeout] - default wait* timeout in ms. Default: 1000.
|
|
3157
|
+
* @property [basicAuth] - the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
3158
|
+
* @property [windowSize] - default window size. Set a dimension like `640x480`.
|
|
3159
|
+
* @property [colorScheme] - default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
3160
|
+
* @property [userAgent] - user-agent string.
|
|
3161
|
+
* @property [locale] - locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
3162
|
+
* @property [manualStart] - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
3163
|
+
* @property [chromium] - pass additional chromium options
|
|
3164
|
+
* @property [firefox] - pass additional firefox options
|
|
3165
|
+
* @property [electron] - (pass additional electron options
|
|
3166
|
+
* @property [channel] - (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge](https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge).
|
|
3167
|
+
* @property [ignoreLog] - An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values](https://playwright.dev/docs/api/class-consolemessage#console-message-type).
|
|
3168
|
+
* @property [ignoreHTTPSErrors] - Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
3169
|
+
* @property [bypassCSP] - bypass Content Security Policy or CSP
|
|
3170
|
+
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
3171
|
+
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
3172
|
+
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3173
|
+
*/
|
|
3174
|
+
// @ts-ignore
|
|
3175
|
+
// @ts-ignore
|
|
3176
|
+
// @ts-ignore
|
|
3177
|
+
type PlaywrightConfig = {
|
|
3178
|
+
url?: string;
|
|
3179
|
+
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
3180
|
+
show?: boolean;
|
|
3181
|
+
restart?: string | boolean;
|
|
3182
|
+
timeout?: number;
|
|
3183
|
+
disableScreenshots?: boolean;
|
|
3184
|
+
emulate?: any;
|
|
3185
|
+
video?: boolean;
|
|
3186
|
+
keepVideoForPassedTests?: boolean;
|
|
3187
|
+
trace?: boolean;
|
|
3188
|
+
keepTraceForPassedTests?: boolean;
|
|
3189
|
+
fullPageScreenshots?: boolean;
|
|
3190
|
+
uniqueScreenshotNames?: boolean;
|
|
3191
|
+
keepBrowserState?: boolean;
|
|
3192
|
+
keepCookies?: boolean;
|
|
3193
|
+
waitForAction?: number;
|
|
3194
|
+
waitForNavigation?: 'load' | 'domcontentloaded' | 'commit';
|
|
3195
|
+
pressKeyDelay?: number;
|
|
3196
|
+
getPageTimeout?: number;
|
|
3197
|
+
waitForTimeout?: number;
|
|
3198
|
+
basicAuth?: any;
|
|
3199
|
+
windowSize?: string;
|
|
3200
|
+
colorScheme?: 'dark' | 'light' | 'no-preference';
|
|
3201
|
+
userAgent?: string;
|
|
3202
|
+
locale?: string;
|
|
3203
|
+
manualStart?: boolean;
|
|
3204
|
+
chromium?: any;
|
|
3205
|
+
firefox?: any;
|
|
3206
|
+
electron?: any;
|
|
3207
|
+
channel?: any;
|
|
3208
|
+
ignoreLog?: string[];
|
|
3209
|
+
ignoreHTTPSErrors?: boolean;
|
|
3210
|
+
bypassCSP?: boolean;
|
|
3211
|
+
highlightElement?: boolean;
|
|
3212
|
+
recordHar?: any;
|
|
3213
|
+
testIdAttribute?: string;
|
|
3214
|
+
};
|
|
3096
3215
|
/**
|
|
3097
3216
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
3098
3217
|
*
|
|
@@ -4648,6 +4767,13 @@ declare namespace CodeceptJS {
|
|
|
4648
4767
|
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4649
4768
|
*/
|
|
4650
4769
|
waitForEnabled(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4770
|
+
/**
|
|
4771
|
+
* Waits for element to become disabled (by default waits for 1sec).
|
|
4772
|
+
* Element can be located by CSS or XPath.
|
|
4773
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
4774
|
+
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4775
|
+
*/
|
|
4776
|
+
waitForDisabled(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4651
4777
|
/**
|
|
4652
4778
|
* Waits for the specified value to be in value attribute.
|
|
4653
4779
|
*
|
|
@@ -6397,6 +6523,60 @@ declare namespace CodeceptJS {
|
|
|
6397
6523
|
*/
|
|
6398
6524
|
setCookie(cookie: Cookie | Cookie[]): Promise<any>;
|
|
6399
6525
|
}
|
|
6526
|
+
/**
|
|
6527
|
+
* ## Configuration
|
|
6528
|
+
*
|
|
6529
|
+
* This helper should be configured in codecept.conf.js
|
|
6530
|
+
* @property url - base url of website to be tested
|
|
6531
|
+
* @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
6532
|
+
* @property [show] - show Google Chrome window for debug.
|
|
6533
|
+
* @property [restart = true] - restart browser between tests.
|
|
6534
|
+
* @property [disableScreenshots = false] - don't save screenshot on failure.
|
|
6535
|
+
* @property [fullPageScreenshots = false] - make full page screenshots on failure.
|
|
6536
|
+
* @property [uniqueScreenshotNames = false] - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
6537
|
+
* @property [trace = false] - record [tracing information](https://pptr.dev/api/puppeteer.tracing) with screenshots.
|
|
6538
|
+
* @property [keepTraceForPassedTests = false] - save trace for passed tests.
|
|
6539
|
+
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
6540
|
+
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
6541
|
+
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
6542
|
+
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions). Array values are accepted as well.
|
|
6543
|
+
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
6544
|
+
* @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
6545
|
+
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
6546
|
+
* @property [windowSize] - default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
|
|
6547
|
+
* @property [userAgent] - user-agent string.
|
|
6548
|
+
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
6549
|
+
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
6550
|
+
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6551
|
+
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6552
|
+
*/
|
|
6553
|
+
// @ts-ignore
|
|
6554
|
+
// @ts-ignore
|
|
6555
|
+
// @ts-ignore
|
|
6556
|
+
type PuppeteerConfig = {
|
|
6557
|
+
url: string;
|
|
6558
|
+
basicAuth?: any;
|
|
6559
|
+
show?: boolean;
|
|
6560
|
+
restart?: boolean;
|
|
6561
|
+
disableScreenshots?: boolean;
|
|
6562
|
+
fullPageScreenshots?: boolean;
|
|
6563
|
+
uniqueScreenshotNames?: boolean;
|
|
6564
|
+
trace?: boolean;
|
|
6565
|
+
keepTraceForPassedTests?: boolean;
|
|
6566
|
+
keepBrowserState?: boolean;
|
|
6567
|
+
keepCookies?: boolean;
|
|
6568
|
+
waitForAction?: number;
|
|
6569
|
+
waitForNavigation?: string;
|
|
6570
|
+
pressKeyDelay?: number;
|
|
6571
|
+
getPageTimeout?: number;
|
|
6572
|
+
waitForTimeout?: number;
|
|
6573
|
+
windowSize?: string;
|
|
6574
|
+
userAgent?: string;
|
|
6575
|
+
manualStart?: boolean;
|
|
6576
|
+
browser?: string;
|
|
6577
|
+
chrome?: any;
|
|
6578
|
+
highlightElement?: boolean;
|
|
6579
|
+
};
|
|
6400
6580
|
/**
|
|
6401
6581
|
* Uses [Google Chrome's Puppeteer](https://github.com/GoogleChrome/puppeteer) library to run tests inside headless Chrome.
|
|
6402
6582
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
@@ -8167,6 +8347,32 @@ declare namespace CodeceptJS {
|
|
|
8167
8347
|
*/
|
|
8168
8348
|
flushWebSocketMessages(): Promise<any>;
|
|
8169
8349
|
}
|
|
8350
|
+
/**
|
|
8351
|
+
* ## Configuration
|
|
8352
|
+
* @property [endpoint] - API base URL
|
|
8353
|
+
* @property [prettyPrintJson = false] - pretty print json for response/request on console logs.
|
|
8354
|
+
* @property [printCurl = false] - print cURL request on console logs. False by default.
|
|
8355
|
+
* @property [timeout = 1000] - timeout for requests in milliseconds. 10000ms by default.
|
|
8356
|
+
* @property [defaultHeaders] - a list of default headers.
|
|
8357
|
+
* @property [httpAgent] - create an agent with SSL certificate
|
|
8358
|
+
* @property [onRequest] - an async function which can update request object.
|
|
8359
|
+
* @property [onResponse] - an async function which can update response object.
|
|
8360
|
+
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8361
|
+
*/
|
|
8362
|
+
// @ts-ignore
|
|
8363
|
+
// @ts-ignore
|
|
8364
|
+
// @ts-ignore
|
|
8365
|
+
type RESTConfig = {
|
|
8366
|
+
endpoint?: string;
|
|
8367
|
+
prettyPrintJson?: boolean;
|
|
8368
|
+
printCurl?: boolean;
|
|
8369
|
+
timeout?: number;
|
|
8370
|
+
defaultHeaders?: any;
|
|
8371
|
+
httpAgent?: any;
|
|
8372
|
+
onRequest?: (...params: any[]) => any;
|
|
8373
|
+
onResponse?: (...params: any[]) => any;
|
|
8374
|
+
maxUploadFileSize?: number;
|
|
8375
|
+
};
|
|
8170
8376
|
/**
|
|
8171
8377
|
* REST helper allows to send additional requests to the REST API during acceptance tests.
|
|
8172
8378
|
* [Axios](https://github.com/axios/axios) library is used to perform requests.
|
|
@@ -8189,6 +8395,25 @@ declare namespace CodeceptJS {
|
|
|
8189
8395
|
* }
|
|
8190
8396
|
* ```
|
|
8191
8397
|
*
|
|
8398
|
+
* With httpAgent
|
|
8399
|
+
*
|
|
8400
|
+
* ```js
|
|
8401
|
+
* {
|
|
8402
|
+
* helpers: {
|
|
8403
|
+
* REST: {
|
|
8404
|
+
* endpoint: 'http://site.com/api',
|
|
8405
|
+
* prettyPrintJson: true,
|
|
8406
|
+
* httpAgent: {
|
|
8407
|
+
* key: fs.readFileSync(__dirname + '/path/to/keyfile.key'),
|
|
8408
|
+
* cert: fs.readFileSync(__dirname + '/path/to/certfile.cert'),
|
|
8409
|
+
* rejectUnauthorized: false,
|
|
8410
|
+
* keepAlive: true
|
|
8411
|
+
* }
|
|
8412
|
+
* }
|
|
8413
|
+
* }
|
|
8414
|
+
* }
|
|
8415
|
+
* ```
|
|
8416
|
+
*
|
|
8192
8417
|
* ## Access From Helpers
|
|
8193
8418
|
*
|
|
8194
8419
|
* Send REST requests by accessing `_executeRequest` method:
|
|
@@ -9228,6 +9453,60 @@ declare namespace CodeceptJS {
|
|
|
9228
9453
|
*/
|
|
9229
9454
|
waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9230
9455
|
}
|
|
9456
|
+
/**
|
|
9457
|
+
* ## Configuration
|
|
9458
|
+
*
|
|
9459
|
+
* This helper should be configured in codecept.conf.js
|
|
9460
|
+
* @property url - base url of website to be tested.
|
|
9461
|
+
* @property browser - Browser in which to perform testing.
|
|
9462
|
+
* @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
9463
|
+
* @property [host = localhost] - WebDriver host to connect.
|
|
9464
|
+
* @property [port = 4444] - WebDriver port to connect.
|
|
9465
|
+
* @property [protocol = http] - protocol for WebDriver server.
|
|
9466
|
+
* @property [path = /wd/hub] - path to WebDriver server.
|
|
9467
|
+
* @property [restart = true] - restart browser between tests.
|
|
9468
|
+
* @property [smartWait = false] - **enables [SmartWait](http://codecept.io/acceptance/#smartwait)**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
9469
|
+
* @property [disableScreenshots = false] - don't save screenshots on failure.
|
|
9470
|
+
* @property [fullPageScreenshots = false] - (optional - make full page screenshots on failure.
|
|
9471
|
+
* @property [uniqueScreenshotNames = false] - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
9472
|
+
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
9473
|
+
* @property [keepCookies = false] - keep cookies between tests when `restart` set to false.
|
|
9474
|
+
* @property [windowSize = window] - default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
9475
|
+
* @property [waitForTimeout = 1000] - sets default wait time in *ms* for all `wait*` functions.
|
|
9476
|
+
* @property [desiredCapabilities] - Selenium's [desired capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities).
|
|
9477
|
+
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
9478
|
+
* @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
9479
|
+
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9480
|
+
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9481
|
+
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9482
|
+
*/
|
|
9483
|
+
// @ts-ignore
|
|
9484
|
+
// @ts-ignore
|
|
9485
|
+
// @ts-ignore
|
|
9486
|
+
type WebDriverConfig = {
|
|
9487
|
+
url: string;
|
|
9488
|
+
browser: string;
|
|
9489
|
+
basicAuth?: string;
|
|
9490
|
+
host?: string;
|
|
9491
|
+
port?: number;
|
|
9492
|
+
protocol?: string;
|
|
9493
|
+
path?: string;
|
|
9494
|
+
restart?: boolean;
|
|
9495
|
+
smartWait?: boolean | number;
|
|
9496
|
+
disableScreenshots?: boolean;
|
|
9497
|
+
fullPageScreenshots?: boolean;
|
|
9498
|
+
uniqueScreenshotNames?: boolean;
|
|
9499
|
+
keepBrowserState?: boolean;
|
|
9500
|
+
keepCookies?: boolean;
|
|
9501
|
+
windowSize?: string;
|
|
9502
|
+
waitForTimeout?: number;
|
|
9503
|
+
desiredCapabilities?: any;
|
|
9504
|
+
manualStart?: boolean;
|
|
9505
|
+
timeouts?: any;
|
|
9506
|
+
highlightElement?: boolean;
|
|
9507
|
+
logLevel?: string;
|
|
9508
|
+
devtoolsProtocol?: boolean;
|
|
9509
|
+
};
|
|
9231
9510
|
/**
|
|
9232
9511
|
* WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
|
|
9233
9512
|
* manipulate browser using Selenium WebDriver or PhantomJS.
|
package/typings/types.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ declare namespace CodeceptJS {
|
|
|
5
5
|
* This helper class provides integration with the AI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
|
|
6
6
|
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
7
7
|
*
|
|
8
|
+
* Use it only in development mode. It is recommended to run it only inside pause() mode.
|
|
9
|
+
*
|
|
8
10
|
* ## Configuration
|
|
9
11
|
*
|
|
10
12
|
* This helper should be configured in codecept.json or codecept.conf.js
|
|
@@ -34,10 +36,34 @@ declare namespace CodeceptJS {
|
|
|
34
36
|
*/
|
|
35
37
|
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
36
38
|
/**
|
|
37
|
-
* Send a general request to
|
|
39
|
+
* Send a general request to AI and return response.
|
|
38
40
|
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
39
41
|
*/
|
|
40
42
|
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Generates PageObject for current page using AI.
|
|
45
|
+
*
|
|
46
|
+
* It saves the PageObject to the output directory. You can review the page object and adjust it as needed and move to pages directory.
|
|
47
|
+
* Prompt can be customized in a global config file.
|
|
48
|
+
*
|
|
49
|
+
* ```js
|
|
50
|
+
* // create page object for whole page
|
|
51
|
+
* I.askForPageObject('home');
|
|
52
|
+
*
|
|
53
|
+
* // create page object with extra prompt
|
|
54
|
+
* I.askForPageObject('home', 'implement signIn(username, password) method');
|
|
55
|
+
*
|
|
56
|
+
* // create page object for a specific element
|
|
57
|
+
* I.askForPageObject('home', null, '.detail');
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Asks for a page object based on the provided page name, locator, and extra prompt.
|
|
61
|
+
* @param pageName - The name of the page to retrieve the object for.
|
|
62
|
+
* @param [extraPrompt = null] - An optional extra prompt for additional context or information.
|
|
63
|
+
* @param [locator = null] - An optional locator to find a specific element on the page.
|
|
64
|
+
* @returns A promise that resolves to the requested page object.
|
|
65
|
+
*/
|
|
66
|
+
askForPageObject(pageName: string, extraPrompt?: string | null, locator?: string | null): Promise<object>;
|
|
41
67
|
}
|
|
42
68
|
/**
|
|
43
69
|
* Helper for managing remote data using REST API.
|
|
@@ -1179,6 +1205,8 @@ declare namespace CodeceptJS {
|
|
|
1179
1205
|
* ## Methods
|
|
1180
1206
|
*/
|
|
1181
1207
|
// @ts-ignore
|
|
1208
|
+
// @ts-ignore
|
|
1209
|
+
// @ts-ignore
|
|
1182
1210
|
class ExpectHelper {
|
|
1183
1211
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1184
1212
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1291,6 +1319,8 @@ declare namespace CodeceptJS {
|
|
|
1291
1319
|
* ## Methods
|
|
1292
1320
|
*/
|
|
1293
1321
|
// @ts-ignore
|
|
1322
|
+
// @ts-ignore
|
|
1323
|
+
// @ts-ignore
|
|
1294
1324
|
class ExpectHelper {
|
|
1295
1325
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1296
1326
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1966,6 +1996,8 @@ declare namespace CodeceptJS {
|
|
|
1966
1996
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1967
1997
|
*/
|
|
1968
1998
|
// @ts-ignore
|
|
1999
|
+
// @ts-ignore
|
|
2000
|
+
// @ts-ignore
|
|
1969
2001
|
type MockServerConfig = {
|
|
1970
2002
|
port?: number;
|
|
1971
2003
|
host?: string;
|
|
@@ -2091,6 +2123,8 @@ declare namespace CodeceptJS {
|
|
|
2091
2123
|
* ## Methods
|
|
2092
2124
|
*/
|
|
2093
2125
|
// @ts-ignore
|
|
2126
|
+
// @ts-ignore
|
|
2127
|
+
// @ts-ignore
|
|
2094
2128
|
class MockServer {
|
|
2095
2129
|
/**
|
|
2096
2130
|
* Start the mock server
|
|
@@ -3230,6 +3264,9 @@ declare namespace CodeceptJS {
|
|
|
3230
3264
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
3231
3265
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3232
3266
|
*/
|
|
3267
|
+
// @ts-ignore
|
|
3268
|
+
// @ts-ignore
|
|
3269
|
+
// @ts-ignore
|
|
3233
3270
|
type PlaywrightConfig = {
|
|
3234
3271
|
url?: string;
|
|
3235
3272
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -4882,6 +4919,14 @@ declare namespace CodeceptJS {
|
|
|
4882
4919
|
* @returns automatically synchronized promise through #recorder
|
|
4883
4920
|
*/
|
|
4884
4921
|
waitForEnabled(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4922
|
+
/**
|
|
4923
|
+
* Waits for element to become disabled (by default waits for 1sec).
|
|
4924
|
+
* Element can be located by CSS or XPath.
|
|
4925
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
4926
|
+
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4927
|
+
* @returns automatically synchronized promise through #recorder
|
|
4928
|
+
*/
|
|
4929
|
+
waitForDisabled(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4885
4930
|
/**
|
|
4886
4931
|
* Waits for the specified value to be in value attribute.
|
|
4887
4932
|
*
|
|
@@ -6749,6 +6794,9 @@ declare namespace CodeceptJS {
|
|
|
6749
6794
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6750
6795
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6751
6796
|
*/
|
|
6797
|
+
// @ts-ignore
|
|
6798
|
+
// @ts-ignore
|
|
6799
|
+
// @ts-ignore
|
|
6752
6800
|
type PuppeteerConfig = {
|
|
6753
6801
|
url: string;
|
|
6754
6802
|
basicAuth?: any;
|
|
@@ -8686,16 +8734,21 @@ declare namespace CodeceptJS {
|
|
|
8686
8734
|
* @property [printCurl = false] - print cURL request on console logs. False by default.
|
|
8687
8735
|
* @property [timeout = 1000] - timeout for requests in milliseconds. 10000ms by default.
|
|
8688
8736
|
* @property [defaultHeaders] - a list of default headers.
|
|
8737
|
+
* @property [httpAgent] - create an agent with SSL certificate
|
|
8689
8738
|
* @property [onRequest] - an async function which can update request object.
|
|
8690
8739
|
* @property [onResponse] - an async function which can update response object.
|
|
8691
8740
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8692
8741
|
*/
|
|
8742
|
+
// @ts-ignore
|
|
8743
|
+
// @ts-ignore
|
|
8744
|
+
// @ts-ignore
|
|
8693
8745
|
type RESTConfig = {
|
|
8694
8746
|
endpoint?: string;
|
|
8695
8747
|
prettyPrintJson?: boolean;
|
|
8696
8748
|
printCurl?: boolean;
|
|
8697
8749
|
timeout?: number;
|
|
8698
8750
|
defaultHeaders?: any;
|
|
8751
|
+
httpAgent?: any;
|
|
8699
8752
|
onRequest?: (...params: any[]) => any;
|
|
8700
8753
|
onResponse?: (...params: any[]) => any;
|
|
8701
8754
|
maxUploadFileSize?: number;
|
|
@@ -8722,6 +8775,25 @@ declare namespace CodeceptJS {
|
|
|
8722
8775
|
* }
|
|
8723
8776
|
* ```
|
|
8724
8777
|
*
|
|
8778
|
+
* With httpAgent
|
|
8779
|
+
*
|
|
8780
|
+
* ```js
|
|
8781
|
+
* {
|
|
8782
|
+
* helpers: {
|
|
8783
|
+
* REST: {
|
|
8784
|
+
* endpoint: 'http://site.com/api',
|
|
8785
|
+
* prettyPrintJson: true,
|
|
8786
|
+
* httpAgent: {
|
|
8787
|
+
* key: fs.readFileSync(__dirname + '/path/to/keyfile.key'),
|
|
8788
|
+
* cert: fs.readFileSync(__dirname + '/path/to/certfile.cert'),
|
|
8789
|
+
* rejectUnauthorized: false,
|
|
8790
|
+
* keepAlive: true
|
|
8791
|
+
* }
|
|
8792
|
+
* }
|
|
8793
|
+
* }
|
|
8794
|
+
* }
|
|
8795
|
+
* ```
|
|
8796
|
+
*
|
|
8725
8797
|
* ## Access From Helpers
|
|
8726
8798
|
*
|
|
8727
8799
|
* Send REST requests by accessing `_executeRequest` method:
|
|
@@ -9848,6 +9920,9 @@ declare namespace CodeceptJS {
|
|
|
9848
9920
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9849
9921
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9850
9922
|
*/
|
|
9923
|
+
// @ts-ignore
|
|
9924
|
+
// @ts-ignore
|
|
9925
|
+
// @ts-ignore
|
|
9851
9926
|
type WebDriverConfig = {
|
|
9852
9927
|
url: string;
|
|
9853
9928
|
browser: string;
|