codeceptjs 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -3
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +94 -60
- package/docs/basics.md +1 -1
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +106 -34
- package/docs/build/FileSystem.js +1 -0
- package/docs/build/Nightmare.js +48 -48
- package/docs/build/Playwright.js +97 -94
- package/docs/build/Protractor.js +68 -81
- package/docs/build/Puppeteer.js +91 -93
- package/docs/build/REST.js +1 -0
- package/docs/build/TestCafe.js +44 -44
- package/docs/build/WebDriver.js +71 -95
- package/docs/changelog.md +144 -2
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/custom-helpers.md +1 -36
- package/docs/helpers/Appium.md +97 -95
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Playwright.md +16 -18
- package/docs/helpers/Puppeteer.md +18 -18
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +3 -19
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/playwright.md +40 -0
- package/docs/plugins.md +185 -68
- package/docs/reports.md +23 -5
- package/lib/actor.js +20 -2
- package/lib/codecept.js +15 -2
- package/lib/command/info.js +1 -1
- package/lib/config.js +13 -1
- package/lib/container.js +3 -1
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +49 -4
- package/lib/helper/FileSystem.js +1 -0
- package/lib/helper/Playwright.js +35 -22
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +20 -19
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -16
- package/lib/index.js +2 -0
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/gherkin.js +7 -1
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/helpers.js +1 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +71 -0
- package/lib/locator.js +3 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +90 -0
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +21 -8
- package/lib/step.js +7 -2
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +6 -7
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +198 -82
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
package/typings/types.d.ts
CHANGED
|
@@ -321,11 +321,11 @@ declare namespace CodeceptJS {
|
|
|
321
321
|
* ```js
|
|
322
322
|
* I.removeApp('appName', 'com.example.android.apis');
|
|
323
323
|
* ```
|
|
324
|
-
* @param bundleId - String ID of bundle
|
|
325
324
|
*
|
|
326
325
|
* Appium: support only Android
|
|
326
|
+
* @param [bundleId] - ID of bundle
|
|
327
327
|
*/
|
|
328
|
-
removeApp(appId: string, bundleId
|
|
328
|
+
removeApp(appId: string, bundleId?: string): void;
|
|
329
329
|
/**
|
|
330
330
|
* Check current activity on an Android device.
|
|
331
331
|
*
|
|
@@ -522,11 +522,12 @@ declare namespace CodeceptJS {
|
|
|
522
522
|
* // or by pressing key
|
|
523
523
|
* I.hideDeviceKeyboard('pressKey', 'Done');
|
|
524
524
|
* ```
|
|
525
|
-
* @param strategy - desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
526
525
|
*
|
|
527
526
|
* Appium: support Android and iOS
|
|
527
|
+
* @param [strategy] - Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
528
|
+
* @param [key] - Optional key
|
|
528
529
|
*/
|
|
529
|
-
hideDeviceKeyboard(strategy
|
|
530
|
+
hideDeviceKeyboard(strategy?: 'tapOutside' | 'pressKey', key?: string): void;
|
|
530
531
|
/**
|
|
531
532
|
* Send a key event to the device.
|
|
532
533
|
* List of keys: https://developer.android.com/reference/android/view/KeyEvent.html
|
|
@@ -682,8 +683,9 @@ declare namespace CodeceptJS {
|
|
|
682
683
|
* ```
|
|
683
684
|
*
|
|
684
685
|
* Appium: support Android and iOS
|
|
686
|
+
* @param actions - Array of touch actions
|
|
685
687
|
*/
|
|
686
|
-
touchPerform(): void;
|
|
688
|
+
touchPerform(actions: any[]): void;
|
|
687
689
|
/**
|
|
688
690
|
* Pulls a file from the device.
|
|
689
691
|
*
|
|
@@ -886,6 +888,45 @@ declare namespace CodeceptJS {
|
|
|
886
888
|
* @returns attribute value
|
|
887
889
|
*/
|
|
888
890
|
grabTextFrom(locator: CodeceptJS.LocatorOrString): Promise<string>;
|
|
891
|
+
/**
|
|
892
|
+
* Grab number of visible elements by locator.
|
|
893
|
+
* Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
894
|
+
*
|
|
895
|
+
* ```js
|
|
896
|
+
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
897
|
+
* ```
|
|
898
|
+
* @param locator - located by CSS|XPath|strict locator.
|
|
899
|
+
* @returns number of visible elements
|
|
900
|
+
*/
|
|
901
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
902
|
+
/**
|
|
903
|
+
* Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
904
|
+
*
|
|
905
|
+
* Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
906
|
+
* Resumes test execution, so **should be used inside async with `await`** operator.
|
|
907
|
+
* If more than one element is found - attribute of first element is returned.
|
|
908
|
+
*
|
|
909
|
+
* ```js
|
|
910
|
+
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
911
|
+
* ```
|
|
912
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
913
|
+
* @param attr - attribute name.
|
|
914
|
+
* @returns attribute value
|
|
915
|
+
*/
|
|
916
|
+
grabAttributeFrom(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string>;
|
|
917
|
+
/**
|
|
918
|
+
* Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
919
|
+
* Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
|
|
920
|
+
* Resumes test execution, so **should be used inside async with `await`** operator.
|
|
921
|
+
*
|
|
922
|
+
* ```js
|
|
923
|
+
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
924
|
+
* ```
|
|
925
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
926
|
+
* @param attr - attribute name.
|
|
927
|
+
* @returns attribute value
|
|
928
|
+
*/
|
|
929
|
+
grabAttributeFromAll(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string[]>;
|
|
889
930
|
/**
|
|
890
931
|
* Retrieves an array of value from a form located by CSS or XPath and returns it to test.
|
|
891
932
|
* Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
@@ -909,6 +950,16 @@ declare namespace CodeceptJS {
|
|
|
909
950
|
* @returns attribute value
|
|
910
951
|
*/
|
|
911
952
|
grabValueFrom(locator: CodeceptJS.LocatorOrString): Promise<string>;
|
|
953
|
+
/**
|
|
954
|
+
* Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
955
|
+
* Filename is relative to output folder.
|
|
956
|
+
*
|
|
957
|
+
* ```js
|
|
958
|
+
* I.saveScreenshot('debug.png');
|
|
959
|
+
* ```
|
|
960
|
+
* @param fileName - file name to save.
|
|
961
|
+
*/
|
|
962
|
+
saveScreenshot(fileName: string): void;
|
|
912
963
|
/**
|
|
913
964
|
* Scroll element into viewport.
|
|
914
965
|
*
|
|
@@ -1096,7 +1147,7 @@ declare namespace CodeceptJS {
|
|
|
1096
1147
|
* I.seeFileNameMatching('.pdf');
|
|
1097
1148
|
* ```
|
|
1098
1149
|
*/
|
|
1099
|
-
seeFileNameMatching(): void;
|
|
1150
|
+
seeFileNameMatching(text: string): void;
|
|
1100
1151
|
/**
|
|
1101
1152
|
* Checks that file found by `seeFile` includes a text.
|
|
1102
1153
|
*/
|
|
@@ -2368,6 +2419,8 @@ declare namespace CodeceptJS {
|
|
|
2368
2419
|
* * `restart`: (optional, default: true) - restart browser between tests.
|
|
2369
2420
|
* * `disableScreenshots`: (optional, default: false) - don't save screenshot on failure.
|
|
2370
2421
|
* * `emulate`: (optional, default: {}) launch browser in device emulation mode.
|
|
2422
|
+
* * `video`: (optional, default: false) enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
2423
|
+
* * `trace`: (optional, default: false) record [tracing information](https://playwright.dev/docs/trace-viewer) with screenshots and snapshots.
|
|
2371
2424
|
* * `fullPageScreenshots` (optional, default: false) - make full page screenshots on failure.
|
|
2372
2425
|
* * `uniqueScreenshotNames`: (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
2373
2426
|
* * `keepBrowserState`: (optional, default: false) - keep browser state between tests when `restart` is set to false.
|
|
@@ -2380,10 +2433,27 @@ declare namespace CodeceptJS {
|
|
|
2380
2433
|
* * `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
2381
2434
|
* * `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
2382
2435
|
* * `userAgent`: (optional) user-agent string.
|
|
2436
|
+
* * `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
2383
2437
|
* * `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
2384
2438
|
* * `chromium`: (optional) pass additional chromium options
|
|
2385
2439
|
* * `electron`: (optional) pass additional electron options
|
|
2386
2440
|
*
|
|
2441
|
+
* #### Video Recording Customization
|
|
2442
|
+
*
|
|
2443
|
+
* By default, video is saved to `output/video` dir. You can customize this path by passing `dir` option to `recordVideo` option.
|
|
2444
|
+
*
|
|
2445
|
+
* * `video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
2446
|
+
* * `keepVideoForPassedTests`: - save videos for passed tests
|
|
2447
|
+
* * `recordVideo`: [additional options for videos customization](https://playwright.dev/docs/next/api/class-browser#browser-new-context)
|
|
2448
|
+
*
|
|
2449
|
+
* #### Trace Recording Customization
|
|
2450
|
+
*
|
|
2451
|
+
* Trace recording provides a complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
|
|
2452
|
+
* Traces will be saved to `output/trace`
|
|
2453
|
+
*
|
|
2454
|
+
* * `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
2455
|
+
* * `keepTraceForPassedTests`: - save trace for passed tests
|
|
2456
|
+
*
|
|
2387
2457
|
* #### Example #1: Wait for 0 network connections.
|
|
2388
2458
|
*
|
|
2389
2459
|
* ```js
|
|
@@ -2435,7 +2505,7 @@ declare namespace CodeceptJS {
|
|
|
2435
2505
|
* Playwright: {
|
|
2436
2506
|
* url: "http://localhost",
|
|
2437
2507
|
* chromium: {
|
|
2438
|
-
* browserWSEndpoint:
|
|
2508
|
+
* browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a'
|
|
2439
2509
|
* }
|
|
2440
2510
|
* }
|
|
2441
2511
|
* }
|
|
@@ -2481,6 +2551,19 @@ declare namespace CodeceptJS {
|
|
|
2481
2551
|
* }
|
|
2482
2552
|
* ```
|
|
2483
2553
|
*
|
|
2554
|
+
* #### Example #7: Launch test with a specifc user locale
|
|
2555
|
+
*
|
|
2556
|
+
* ```js
|
|
2557
|
+
* {
|
|
2558
|
+
* helpers: {
|
|
2559
|
+
* Playwright : {
|
|
2560
|
+
* url: "http://localhost",
|
|
2561
|
+
* locale: "fr-FR",
|
|
2562
|
+
* }
|
|
2563
|
+
* }
|
|
2564
|
+
* }
|
|
2565
|
+
* ```
|
|
2566
|
+
*
|
|
2484
2567
|
* Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
2485
2568
|
*
|
|
2486
2569
|
* ## Access From Helpers
|
|
@@ -3791,11 +3874,11 @@ declare namespace CodeceptJS {
|
|
|
3791
3874
|
*/
|
|
3792
3875
|
waitForRequest(urlOrPredicate: string | ((...params: any[]) => any), sec?: number): void;
|
|
3793
3876
|
/**
|
|
3794
|
-
* Waits for a network
|
|
3877
|
+
* Waits for a network response.
|
|
3795
3878
|
*
|
|
3796
3879
|
* ```js
|
|
3797
3880
|
* I.waitForResponse('http://example.com/resource');
|
|
3798
|
-
* I.waitForResponse(
|
|
3881
|
+
* I.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
|
|
3799
3882
|
* ```
|
|
3800
3883
|
* @param [sec = null] - number of seconds to wait
|
|
3801
3884
|
*/
|
|
@@ -3834,18 +3917,6 @@ declare namespace CodeceptJS {
|
|
|
3834
3917
|
* See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
|
|
3835
3918
|
*/
|
|
3836
3919
|
waitForNavigation(opts: any): void;
|
|
3837
|
-
/**
|
|
3838
|
-
* Waits for a function to return true (waits for 1sec by default).
|
|
3839
|
-
*
|
|
3840
|
-
* ```js
|
|
3841
|
-
* I.waitUntil(() => window.requests == 0);
|
|
3842
|
-
* I.waitUntil(() => window.requests == 0, 5);
|
|
3843
|
-
* ```
|
|
3844
|
-
* @param fn - function which is executed in browser context.
|
|
3845
|
-
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
3846
|
-
* @param [timeoutMsg = ''] - message to show in case of timeout fail.
|
|
3847
|
-
*/
|
|
3848
|
-
waitUntil(fn: ((...params: any[]) => any) | string, sec?: number, timeoutMsg?: string, interval?: number): void;
|
|
3849
3920
|
/**
|
|
3850
3921
|
* Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
3851
3922
|
* Element can be located by CSS or XPath.
|
|
@@ -3902,6 +3973,29 @@ declare namespace CodeceptJS {
|
|
|
3902
3973
|
* @returns Element bounding rectangle
|
|
3903
3974
|
*/
|
|
3904
3975
|
grabElementBoundingRect(locator: LocatorOrString, elementSize?: string): Promise<DOMRect> | Promise<number>;
|
|
3976
|
+
/**
|
|
3977
|
+
* Mocks network request using [`browserContext.route`](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) of Playwright
|
|
3978
|
+
*
|
|
3979
|
+
* ```js
|
|
3980
|
+
* I.mockRoute(/(\.png$)|(\.jpg$)/, route => route.abort());
|
|
3981
|
+
* ```
|
|
3982
|
+
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
|
|
3983
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
3984
|
+
* @param [handler] - a function to process request
|
|
3985
|
+
*/
|
|
3986
|
+
mockRoute(url?: string, handler?: (...params: any[]) => any): void;
|
|
3987
|
+
/**
|
|
3988
|
+
* Stops network mocking created by `mockRoute`.
|
|
3989
|
+
*
|
|
3990
|
+
* ```js
|
|
3991
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/);
|
|
3992
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/, previouslySetHandler);
|
|
3993
|
+
* ```
|
|
3994
|
+
* If no handler is passed, all mock requests for the rote are disabled.
|
|
3995
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
3996
|
+
* @param [handler] - a function to process request
|
|
3997
|
+
*/
|
|
3998
|
+
stopMockingRoute(url?: string, handler?: (...params: any[]) => any): void;
|
|
3905
3999
|
}
|
|
3906
4000
|
/**
|
|
3907
4001
|
* This helper works the same as MockRequest helper. It has been included for backwards compatibility
|
|
@@ -4530,11 +4624,12 @@ declare namespace CodeceptJS {
|
|
|
4530
4624
|
/**
|
|
4531
4625
|
* Checks that title is equal to provided one.
|
|
4532
4626
|
*
|
|
4533
|
-
*
|
|
4534
|
-
*
|
|
4535
|
-
*
|
|
4627
|
+
* ```js
|
|
4628
|
+
* I.seeTitleEquals('Test title.');
|
|
4629
|
+
* ```
|
|
4630
|
+
* @param text - value to check.
|
|
4536
4631
|
*/
|
|
4537
|
-
seeTitleEquals(): void;
|
|
4632
|
+
seeTitleEquals(text: string): void;
|
|
4538
4633
|
/**
|
|
4539
4634
|
* Checks that title does not contain text.
|
|
4540
4635
|
*
|
|
@@ -5064,18 +5159,6 @@ declare namespace CodeceptJS {
|
|
|
5064
5159
|
* @param [sec = null] - (optional, `1` by default) time in seconds to wait
|
|
5065
5160
|
*/
|
|
5066
5161
|
waitForFunction(fn: string | ((...params: any[]) => any), argsOrSec?: any[] | number, sec?: number): void;
|
|
5067
|
-
/**
|
|
5068
|
-
* Waits for a function to return true (waits for 1sec by default).
|
|
5069
|
-
*
|
|
5070
|
-
* ```js
|
|
5071
|
-
* I.waitUntil(() => window.requests == 0);
|
|
5072
|
-
* I.waitUntil(() => window.requests == 0, 5);
|
|
5073
|
-
* ```
|
|
5074
|
-
* @param fn - function which is executed in browser context.
|
|
5075
|
-
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
5076
|
-
* @param [timeoutMsg = ''] - message to show in case of timeout fail.
|
|
5077
|
-
*/
|
|
5078
|
-
waitUntil(fn: ((...params: any[]) => any) | string, sec?: number, timeoutMsg?: string, interval?: number): void;
|
|
5079
5162
|
/**
|
|
5080
5163
|
* Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
5081
5164
|
*
|
|
@@ -5294,6 +5377,7 @@ declare namespace CodeceptJS {
|
|
|
5294
5377
|
* }
|
|
5295
5378
|
* }
|
|
5296
5379
|
* ```
|
|
5380
|
+
* > Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
5297
5381
|
*
|
|
5298
5382
|
* #### Example #5: Target URL with provided basic authentication
|
|
5299
5383
|
*
|
|
@@ -5308,10 +5392,25 @@ declare namespace CodeceptJS {
|
|
|
5308
5392
|
* }
|
|
5309
5393
|
* }
|
|
5310
5394
|
* ```
|
|
5395
|
+
* #### Troubleshooting
|
|
5311
5396
|
*
|
|
5397
|
+
* Error Message: `No usable sandbox!`
|
|
5398
|
+
*
|
|
5399
|
+
* When running Puppeteer on CI try to disable sandbox if you see that message
|
|
5400
|
+
*
|
|
5401
|
+
* ```
|
|
5402
|
+
* helpers: {
|
|
5403
|
+
* Puppeteer: {
|
|
5404
|
+
* url: 'http://localhost',
|
|
5405
|
+
* show: false,
|
|
5406
|
+
* chrome: {
|
|
5407
|
+
* args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
5408
|
+
* }
|
|
5409
|
+
* },
|
|
5410
|
+
* }
|
|
5411
|
+
* ```
|
|
5312
5412
|
*
|
|
5313
5413
|
*
|
|
5314
|
-
* Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
5315
5414
|
*
|
|
5316
5415
|
* ## Access From Helpers
|
|
5317
5416
|
*
|
|
@@ -5526,11 +5625,12 @@ declare namespace CodeceptJS {
|
|
|
5526
5625
|
/**
|
|
5527
5626
|
* Checks that title is equal to provided one.
|
|
5528
5627
|
*
|
|
5529
|
-
*
|
|
5530
|
-
*
|
|
5531
|
-
*
|
|
5628
|
+
* ```js
|
|
5629
|
+
* I.seeTitleEquals('Test title.');
|
|
5630
|
+
* ```
|
|
5631
|
+
* @param text - value to check.
|
|
5532
5632
|
*/
|
|
5533
|
-
seeTitleEquals(): void;
|
|
5633
|
+
seeTitleEquals(text: string): void;
|
|
5534
5634
|
/**
|
|
5535
5635
|
* Checks that title does not contain text.
|
|
5536
5636
|
*
|
|
@@ -6739,18 +6839,6 @@ declare namespace CodeceptJS {
|
|
|
6739
6839
|
* See [Pupeteer's reference](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions)
|
|
6740
6840
|
*/
|
|
6741
6841
|
waitForNavigation(opts: any): void;
|
|
6742
|
-
/**
|
|
6743
|
-
* Waits for a function to return true (waits for 1sec by default).
|
|
6744
|
-
*
|
|
6745
|
-
* ```js
|
|
6746
|
-
* I.waitUntil(() => window.requests == 0);
|
|
6747
|
-
* I.waitUntil(() => window.requests == 0, 5);
|
|
6748
|
-
* ```
|
|
6749
|
-
* @param fn - function which is executed in browser context.
|
|
6750
|
-
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
6751
|
-
* @param [timeoutMsg = ''] - message to show in case of timeout fail.
|
|
6752
|
-
*/
|
|
6753
|
-
waitUntil(fn: ((...params: any[]) => any) | string, sec?: number, timeoutMsg?: string, interval?: number): void;
|
|
6754
6842
|
/**
|
|
6755
6843
|
* Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
6756
6844
|
* Element can be located by CSS or XPath.
|
|
@@ -6850,8 +6938,9 @@ declare namespace CodeceptJS {
|
|
|
6850
6938
|
class REST {
|
|
6851
6939
|
/**
|
|
6852
6940
|
* Executes axios request
|
|
6941
|
+
* @returns response
|
|
6853
6942
|
*/
|
|
6854
|
-
_executeRequest(request: any):
|
|
6943
|
+
_executeRequest(request: any): Promise<any>;
|
|
6855
6944
|
/**
|
|
6856
6945
|
* Generates url based on format sent (takes endpoint + url if latter lacks 'http')
|
|
6857
6946
|
*/
|
|
@@ -6862,8 +6951,9 @@ declare namespace CodeceptJS {
|
|
|
6862
6951
|
* ```js
|
|
6863
6952
|
* I.setRequestTimeout(10000); // In milliseconds
|
|
6864
6953
|
* ```
|
|
6954
|
+
* @param newTimeout - timeout in milliseconds
|
|
6865
6955
|
*/
|
|
6866
|
-
setRequestTimeout(): void;
|
|
6956
|
+
setRequestTimeout(newTimeout: number): void;
|
|
6867
6957
|
/**
|
|
6868
6958
|
* Send GET request to REST API
|
|
6869
6959
|
*
|
|
@@ -6871,8 +6961,9 @@ declare namespace CodeceptJS {
|
|
|
6871
6961
|
* I.sendGetRequest('/api/users.json');
|
|
6872
6962
|
* ```
|
|
6873
6963
|
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
6964
|
+
* @returns response
|
|
6874
6965
|
*/
|
|
6875
|
-
sendGetRequest(url: any, headers?: any):
|
|
6966
|
+
sendGetRequest(url: any, headers?: any): Promise<any>;
|
|
6876
6967
|
/**
|
|
6877
6968
|
* Sends POST request to API.
|
|
6878
6969
|
*
|
|
@@ -6885,8 +6976,9 @@ declare namespace CodeceptJS {
|
|
|
6885
6976
|
* ```
|
|
6886
6977
|
* @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
|
|
6887
6978
|
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
6979
|
+
* @returns response
|
|
6888
6980
|
*/
|
|
6889
|
-
sendPostRequest(url: any, payload?: any, headers?: any):
|
|
6981
|
+
sendPostRequest(url: any, payload?: any, headers?: any): Promise<any>;
|
|
6890
6982
|
/**
|
|
6891
6983
|
* Sends PATCH request to API.
|
|
6892
6984
|
*
|
|
@@ -6899,8 +6991,9 @@ declare namespace CodeceptJS {
|
|
|
6899
6991
|
* ```
|
|
6900
6992
|
* @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
|
|
6901
6993
|
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
6994
|
+
* @returns response
|
|
6902
6995
|
*/
|
|
6903
|
-
sendPatchRequest(url: string, payload?: any, headers?: any):
|
|
6996
|
+
sendPatchRequest(url: string, payload?: any, headers?: any): Promise<any>;
|
|
6904
6997
|
/**
|
|
6905
6998
|
* Sends PUT request to API.
|
|
6906
6999
|
*
|
|
@@ -6913,8 +7006,9 @@ declare namespace CodeceptJS {
|
|
|
6913
7006
|
* ```
|
|
6914
7007
|
* @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
|
|
6915
7008
|
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
7009
|
+
* @returns response
|
|
6916
7010
|
*/
|
|
6917
|
-
sendPutRequest(url: string, payload?: any, headers?: any):
|
|
7011
|
+
sendPutRequest(url: string, payload?: any, headers?: any): Promise<any>;
|
|
6918
7012
|
/**
|
|
6919
7013
|
* Sends DELETE request to API.
|
|
6920
7014
|
*
|
|
@@ -6922,8 +7016,9 @@ declare namespace CodeceptJS {
|
|
|
6922
7016
|
* I.sendDeleteRequest('/api/users/1');
|
|
6923
7017
|
* ```
|
|
6924
7018
|
* @param [headers = {}] - the headers object to be sent. By default it is sent as an empty object
|
|
7019
|
+
* @returns response
|
|
6925
7020
|
*/
|
|
6926
|
-
sendDeleteRequest(url: any, headers?: any):
|
|
7021
|
+
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
6927
7022
|
}
|
|
6928
7023
|
/**
|
|
6929
7024
|
* SeleniumWebdriver helper is based on the official [Selenium Webdriver JS](https://www.npmjs.com/package/selenium-webdriver)
|
|
@@ -8308,7 +8403,7 @@ declare namespace CodeceptJS {
|
|
|
8308
8403
|
* ```
|
|
8309
8404
|
* @param timeouts - WebDriver timeouts object.
|
|
8310
8405
|
*/
|
|
8311
|
-
defineTimeout(timeouts:
|
|
8406
|
+
defineTimeout(timeouts: any): void;
|
|
8312
8407
|
/**
|
|
8313
8408
|
* Opens a web page in a browser. Requires relative or absolute url.
|
|
8314
8409
|
* If url starts with `/`, opens a web page of a site defined in `url` config parameter.
|
|
@@ -8656,8 +8751,6 @@ declare namespace CodeceptJS {
|
|
|
8656
8751
|
* @param locator - element located by CSS|XPath|strict locator.
|
|
8657
8752
|
* @param attr - attribute name.
|
|
8658
8753
|
* @returns attribute value
|
|
8659
|
-
*
|
|
8660
|
-
* Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
8661
8754
|
*/
|
|
8662
8755
|
grabAttributeFromAll(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string[]>;
|
|
8663
8756
|
/**
|
|
@@ -8671,8 +8764,6 @@ declare namespace CodeceptJS {
|
|
|
8671
8764
|
* @param locator - element located by CSS|XPath|strict locator.
|
|
8672
8765
|
* @param attr - attribute name.
|
|
8673
8766
|
* @returns attribute value
|
|
8674
|
-
*
|
|
8675
|
-
* Appium: can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
|
|
8676
8767
|
*/
|
|
8677
8768
|
grabAttributeFrom(locator: CodeceptJS.LocatorOrString, attr: string): Promise<string>;
|
|
8678
8769
|
/**
|
|
@@ -9532,18 +9623,6 @@ declare namespace CodeceptJS {
|
|
|
9532
9623
|
* @param [sec = null] - (optional, `1` by default) time in seconds to wait
|
|
9533
9624
|
*/
|
|
9534
9625
|
waitForFunction(fn: string | ((...params: any[]) => any), argsOrSec?: any[] | number, sec?: number): void;
|
|
9535
|
-
/**
|
|
9536
|
-
* Waits for a function to return true (waits for 1sec by default).
|
|
9537
|
-
*
|
|
9538
|
-
* ```js
|
|
9539
|
-
* I.waitUntil(() => window.requests == 0);
|
|
9540
|
-
* I.waitUntil(() => window.requests == 0, 5);
|
|
9541
|
-
* ```
|
|
9542
|
-
* @param fn - function which is executed in browser context.
|
|
9543
|
-
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
9544
|
-
* @param [timeoutMsg = ''] - message to show in case of timeout fail.
|
|
9545
|
-
*/
|
|
9546
|
-
waitUntil(fn: ((...params: any[]) => any) | string, sec?: number, timeoutMsg?: string, interval?: number): void;
|
|
9547
9626
|
/**
|
|
9548
9627
|
* Switches frame or in case of null locator reverts to parent.
|
|
9549
9628
|
*
|
|
@@ -9695,7 +9774,12 @@ declare namespace CodeceptJS {
|
|
|
9695
9774
|
* add print comment method`
|
|
9696
9775
|
*/
|
|
9697
9776
|
say(msg: string, color?: string): Promise<any> | undefined;
|
|
9698
|
-
|
|
9777
|
+
/**
|
|
9778
|
+
* set the maximum execution time for the next step
|
|
9779
|
+
* @param timeout - step timeout in seconds
|
|
9780
|
+
*/
|
|
9781
|
+
limitTime(timeout: number): this;
|
|
9782
|
+
retry(opts?: any): this;
|
|
9699
9783
|
}
|
|
9700
9784
|
/**
|
|
9701
9785
|
* Create CodeceptJS runner.
|
|
@@ -9839,6 +9923,34 @@ declare namespace CodeceptJS {
|
|
|
9839
9923
|
xadd(array: any[]): void;
|
|
9840
9924
|
filter(func: (...params: any[]) => any): void;
|
|
9841
9925
|
}
|
|
9926
|
+
/**
|
|
9927
|
+
* DataTableArgument class to store the Cucumber data table from
|
|
9928
|
+
* a step as an object with methods that can be used to access the data.
|
|
9929
|
+
*/
|
|
9930
|
+
class DataTableArgument {
|
|
9931
|
+
constructor(gherkinDataTable: any);
|
|
9932
|
+
/**
|
|
9933
|
+
* Returns the table as a 2-D array
|
|
9934
|
+
*/
|
|
9935
|
+
raw(): string[][];
|
|
9936
|
+
/**
|
|
9937
|
+
* Returns the table as a 2-D array, without the first row
|
|
9938
|
+
*/
|
|
9939
|
+
rows(): string[][];
|
|
9940
|
+
/**
|
|
9941
|
+
* Returns an array of objects where each row is converted to an object (column header is the key)
|
|
9942
|
+
*/
|
|
9943
|
+
hashes(): any[];
|
|
9944
|
+
/**
|
|
9945
|
+
* Returns an object where each row corresponds to an entry
|
|
9946
|
+
* (first column is the key, second column is the value)
|
|
9947
|
+
*/
|
|
9948
|
+
rowsHash(): Record<string, string>;
|
|
9949
|
+
/**
|
|
9950
|
+
* Transposed the data
|
|
9951
|
+
*/
|
|
9952
|
+
transpose(): void;
|
|
9953
|
+
}
|
|
9842
9954
|
namespace event {
|
|
9843
9955
|
const dispatcher: NodeJS.EventEmitter;
|
|
9844
9956
|
const test: {
|
|
@@ -9935,6 +10047,7 @@ declare namespace CodeceptJS {
|
|
|
9935
10047
|
var pause: typeof CodeceptJS.pause;
|
|
9936
10048
|
var within: typeof CodeceptJS.within;
|
|
9937
10049
|
var dataTable: typeof CodeceptJS.DataTable;
|
|
10050
|
+
var dataTableArgument: typeof CodeceptJS.DataTableArgument;
|
|
9938
10051
|
var store: typeof CodeceptJS.store;
|
|
9939
10052
|
var locator: typeof CodeceptJS.Locator;
|
|
9940
10053
|
}
|
|
@@ -10020,6 +10133,7 @@ declare namespace CodeceptJS {
|
|
|
10020
10133
|
isCustom(): boolean;
|
|
10021
10134
|
isStrict(): boolean;
|
|
10022
10135
|
isAccessibilityId(): boolean;
|
|
10136
|
+
isBasic(): boolean;
|
|
10023
10137
|
toXPath(): string;
|
|
10024
10138
|
or(locator: CodeceptJS.LocatorOrString): Locator;
|
|
10025
10139
|
find(locator: CodeceptJS.LocatorOrString): Locator;
|
|
@@ -10040,11 +10154,11 @@ declare namespace CodeceptJS {
|
|
|
10040
10154
|
/**
|
|
10041
10155
|
* Filters to modify locators
|
|
10042
10156
|
*/
|
|
10043
|
-
static filters:
|
|
10157
|
+
static filters: ((arg0: CodeceptJS.LocatorOrString, arg1: Locator) => void)[];
|
|
10044
10158
|
/**
|
|
10045
10159
|
* Appends new `Locator` filter to an `Locator.filters` array, and returns the new length of the array.
|
|
10046
10160
|
*/
|
|
10047
|
-
static addFilter():
|
|
10161
|
+
static addFilter(fn: (...params: any[]) => any): number;
|
|
10048
10162
|
}
|
|
10049
10163
|
namespace output {
|
|
10050
10164
|
var stepShift: number;
|
|
@@ -10134,7 +10248,7 @@ declare namespace CodeceptJS {
|
|
|
10134
10248
|
* true: it will retries if `retryOpts` set.
|
|
10135
10249
|
* false: ignore `retryOpts` and won't retry.
|
|
10136
10250
|
*/
|
|
10137
|
-
add(taskName: string | ((...params: any[]) => any), fn?: (...params: any[]) => any, force?: boolean, retry?: boolean): Promise<any> | undefined;
|
|
10251
|
+
add(taskName: string | ((...params: any[]) => any), fn?: (...params: any[]) => any, force?: boolean, retry?: boolean, timeout?: number): Promise<any> | undefined;
|
|
10138
10252
|
retry(opts: any): any;
|
|
10139
10253
|
catch(customErrFn?: (...params: any[]) => any): Promise<any>;
|
|
10140
10254
|
catchWithoutStop(customErrFn: (...params: any[]) => any): Promise<any>;
|
|
@@ -10197,6 +10311,7 @@ declare namespace CodeceptJS {
|
|
|
10197
10311
|
args: any[];
|
|
10198
10312
|
metaStep: MetaStep;
|
|
10199
10313
|
stack: string;
|
|
10314
|
+
totalTimeout: number;
|
|
10200
10315
|
setTrace(): void;
|
|
10201
10316
|
setArguments(args: any[]): void;
|
|
10202
10317
|
run(...args: any[]): any;
|
|
@@ -10218,6 +10333,7 @@ declare namespace CodeceptJS {
|
|
|
10218
10333
|
*/
|
|
10219
10334
|
namespace store {
|
|
10220
10335
|
var debugMode: boolean;
|
|
10336
|
+
var timeouts: boolean;
|
|
10221
10337
|
}
|
|
10222
10338
|
/**
|
|
10223
10339
|
* Describe a "suite" with the given `title`
|