codeceptjs 3.6.0-beta.1.ai-healers → 3.6.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/README.md +2 -2
- package/bin/codecept.js +2 -1
- package/docs/webapi/dontSeeTraffic.mustache +13 -0
- package/docs/webapi/flushNetworkTraffics.mustache +5 -0
- package/docs/webapi/grabRecordedNetworkTraffics.mustache +10 -0
- package/docs/webapi/seeTraffic.mustache +36 -0
- package/docs/webapi/startRecordingTraffic.mustache +8 -0
- package/docs/webapi/startRecordingWebSocketMessages.mustache +8 -0
- package/docs/webapi/stopRecordingTraffic.mustache +5 -0
- package/docs/webapi/stopRecordingWebSocketMessages.mustache +7 -0
- package/docs/webapi/waitForCookie.mustache +9 -0
- package/lib/actor.js +6 -3
- package/lib/command/dryRun.js +44 -13
- package/lib/helper/Appium.js +36 -12
- package/lib/helper/Expect.js +11 -8
- package/lib/helper/JSONResponse.js +8 -8
- package/lib/helper/MockServer.js +221 -0
- package/lib/helper/Playwright.js +107 -371
- package/lib/helper/Puppeteer.js +404 -71
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +189 -13
- package/lib/helper/errors/ElementAssertion.js +38 -0
- package/lib/helper/extras/PlaywrightReactVueLocator.js +6 -1
- package/lib/helper/network/actions.js +123 -0
- package/lib/helper/network/utils.js +187 -0
- package/lib/locator.js +36 -5
- package/lib/pause.js +4 -9
- package/lib/plugin/coverage.js +112 -99
- package/lib/step.js +3 -1
- package/package.json +49 -38
- package/typings/index.d.ts +19 -2
- package/typings/promiseBasedTypes.d.ts +505 -41
- package/typings/types.d.ts +531 -43
- package/docs/advanced.md +0 -351
- package/docs/ai.md +0 -365
- package/docs/api.md +0 -323
- package/docs/basics.md +0 -979
- package/docs/bdd.md +0 -539
- package/docs/best.md +0 -237
- package/docs/books.md +0 -37
- package/docs/bootstrap.md +0 -135
- package/docs/build/AI.js +0 -124
- package/docs/build/ApiDataFactory.js +0 -410
- package/docs/build/Appium.js +0 -2027
- package/docs/build/Expect.js +0 -422
- package/docs/build/FileSystem.js +0 -228
- package/docs/build/GraphQL.js +0 -229
- package/docs/build/GraphQLDataFactory.js +0 -309
- package/docs/build/JSONResponse.js +0 -338
- package/docs/build/Mochawesome.js +0 -71
- package/docs/build/Nightmare.js +0 -2152
- package/docs/build/OpenAI.js +0 -126
- package/docs/build/Playwright.js +0 -5110
- package/docs/build/Protractor.js +0 -2706
- package/docs/build/Puppeteer.js +0 -3905
- package/docs/build/REST.js +0 -344
- package/docs/build/TestCafe.js +0 -2125
- package/docs/build/WebDriver.js +0 -4240
- package/docs/changelog.md +0 -2572
- package/docs/commands.md +0 -266
- package/docs/community-helpers.md +0 -58
- package/docs/configuration.md +0 -157
- package/docs/continuous-integration.md +0 -22
- package/docs/custom-helpers.md +0 -306
- package/docs/data.md +0 -379
- package/docs/detox.md +0 -235
- package/docs/docker.md +0 -136
- package/docs/email.md +0 -183
- package/docs/examples.md +0 -149
- package/docs/heal.md +0 -186
- package/docs/helpers/ApiDataFactory.md +0 -266
- package/docs/helpers/Appium.md +0 -1374
- package/docs/helpers/Detox.md +0 -586
- package/docs/helpers/Expect.md +0 -275
- package/docs/helpers/FileSystem.md +0 -152
- package/docs/helpers/GraphQL.md +0 -151
- package/docs/helpers/GraphQLDataFactory.md +0 -226
- package/docs/helpers/JSONResponse.md +0 -254
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockRequest.md +0 -377
- package/docs/helpers/Nightmare.md +0 -1305
- package/docs/helpers/OpenAI.md +0 -70
- package/docs/helpers/Playwright.md +0 -2759
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/Puppeteer-firefox.md +0 -86
- package/docs/helpers/Puppeteer.md +0 -2317
- package/docs/helpers/REST.md +0 -218
- package/docs/helpers/TestCafe.md +0 -1321
- package/docs/helpers/WebDriver.md +0 -2547
- package/docs/hooks.md +0 -340
- package/docs/index.md +0 -111
- package/docs/installation.md +0 -75
- package/docs/internal-api.md +0 -266
- package/docs/locators.md +0 -339
- package/docs/mobile-react-native-locators.md +0 -67
- package/docs/mobile.md +0 -338
- package/docs/pageobjects.md +0 -291
- package/docs/parallel.md +0 -400
- package/docs/playwright.md +0 -632
- package/docs/plugins.md +0 -1247
- package/docs/puppeteer.md +0 -316
- package/docs/quickstart.md +0 -162
- package/docs/react.md +0 -70
- package/docs/reports.md +0 -392
- package/docs/secrets.md +0 -36
- package/docs/shadow.md +0 -68
- package/docs/shared/keys.mustache +0 -31
- package/docs/shared/react.mustache +0 -1
- package/docs/testcafe.md +0 -174
- package/docs/translation.md +0 -247
- package/docs/tutorial.md +0 -271
- package/docs/typescript.md +0 -180
- package/docs/ui.md +0 -59
- package/docs/videos.md +0 -28
- package/docs/visual.md +0 -202
- package/docs/vue.md +0 -143
- package/docs/webdriver.md +0 -701
- package/docs/wiki/Books-&-Posts.md +0 -27
- package/docs/wiki/Community-Helpers-&-Plugins.md +0 -53
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -61
- package/docs/wiki/Examples.md +0 -145
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
- package/docs/wiki/Home.md +0 -16
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +0 -83
- package/docs/wiki/Release-Process.md +0 -24
- package/docs/wiki/Roadmap.md +0 -23
- package/docs/wiki/Tests.md +0 -1393
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
- package/docs/wiki/Videos.md +0 -19
package/typings/types.d.ts
CHANGED
|
@@ -1191,9 +1191,9 @@ declare namespace CodeceptJS {
|
|
|
1191
1191
|
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1192
1192
|
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1193
1193
|
/**
|
|
1194
|
-
* @param ajvOptions - Pass AJV options
|
|
1194
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1195
1195
|
*/
|
|
1196
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions
|
|
1196
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1197
1197
|
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1198
1198
|
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1199
1199
|
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
@@ -1799,6 +1799,191 @@ declare namespace CodeceptJS {
|
|
|
1799
1799
|
*/
|
|
1800
1800
|
seeResponseMatchesJsonSchema(fnOrSchema: any): void;
|
|
1801
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
* ## Configuration
|
|
1804
|
+
*
|
|
1805
|
+
* This helper should be configured in codecept.conf.(js|ts)
|
|
1806
|
+
* @property [port = 9393] - Mock server port
|
|
1807
|
+
* @property [host = "0.0.0.0"] - Mock server host
|
|
1808
|
+
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1809
|
+
*/
|
|
1810
|
+
type MockServerConfig = {
|
|
1811
|
+
port?: number;
|
|
1812
|
+
host?: string;
|
|
1813
|
+
httpsOpts?: any;
|
|
1814
|
+
};
|
|
1815
|
+
/**
|
|
1816
|
+
* MockServer
|
|
1817
|
+
*
|
|
1818
|
+
* The MockServer Helper in CodeceptJS empowers you to mock any server or service via HTTP or HTTPS, making it an excellent tool for simulating REST endpoints and other HTTP-based APIs.
|
|
1819
|
+
*
|
|
1820
|
+
* <!-- configuration -->
|
|
1821
|
+
*
|
|
1822
|
+
* #### Examples
|
|
1823
|
+
*
|
|
1824
|
+
* You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
|
|
1825
|
+
*
|
|
1826
|
+
* ```javascript
|
|
1827
|
+
* {
|
|
1828
|
+
* helpers: {
|
|
1829
|
+
* REST: {...},
|
|
1830
|
+
* MockServer: {
|
|
1831
|
+
* // default mock server config
|
|
1832
|
+
* port: 9393,
|
|
1833
|
+
* host: '0.0.0.0',
|
|
1834
|
+
* httpsOpts: {
|
|
1835
|
+
* key: '',
|
|
1836
|
+
* cert: '',
|
|
1837
|
+
* },
|
|
1838
|
+
* },
|
|
1839
|
+
* }
|
|
1840
|
+
* }
|
|
1841
|
+
* ```
|
|
1842
|
+
*
|
|
1843
|
+
* #### Adding Interactions
|
|
1844
|
+
*
|
|
1845
|
+
* Interactions add behavior to the mock server. Use the `I.addInteractionToMockServer()` method to include interactions. It takes an interaction object as an argument, containing request and response details.
|
|
1846
|
+
*
|
|
1847
|
+
* ```javascript
|
|
1848
|
+
* I.addInteractionToMockServer({
|
|
1849
|
+
* request: {
|
|
1850
|
+
* method: 'GET',
|
|
1851
|
+
* path: '/api/hello'
|
|
1852
|
+
* },
|
|
1853
|
+
* response: {
|
|
1854
|
+
* status: 200,
|
|
1855
|
+
* body: {
|
|
1856
|
+
* 'say': 'hello to mock server'
|
|
1857
|
+
* }
|
|
1858
|
+
* }
|
|
1859
|
+
* });
|
|
1860
|
+
* ```
|
|
1861
|
+
*
|
|
1862
|
+
* #### Request Matching
|
|
1863
|
+
*
|
|
1864
|
+
* When a real request is sent to the mock server, it matches the received request with the interactions. If a match is found, it returns the specified response; otherwise, a 404 status code is returned.
|
|
1865
|
+
*
|
|
1866
|
+
* - Strong match on HTTP Method, Path, Query Params & JSON body.
|
|
1867
|
+
* - Loose match on Headers.
|
|
1868
|
+
*
|
|
1869
|
+
* ##### Strong Match on Query Params
|
|
1870
|
+
*
|
|
1871
|
+
* You can send different responses based on query parameters:
|
|
1872
|
+
*
|
|
1873
|
+
* ```javascript
|
|
1874
|
+
* I.addInteractionToMockServer({
|
|
1875
|
+
* request: {
|
|
1876
|
+
* method: 'GET',
|
|
1877
|
+
* path: '/api/users',
|
|
1878
|
+
* queryParams: {
|
|
1879
|
+
* id: 1
|
|
1880
|
+
* }
|
|
1881
|
+
* },
|
|
1882
|
+
* response: {
|
|
1883
|
+
* status: 200,
|
|
1884
|
+
* body: 'user 1'
|
|
1885
|
+
* }
|
|
1886
|
+
* });
|
|
1887
|
+
*
|
|
1888
|
+
* I.addInteractionToMockServer({
|
|
1889
|
+
* request: {
|
|
1890
|
+
* method: 'GET',
|
|
1891
|
+
* path: '/api/users',
|
|
1892
|
+
* queryParams: {
|
|
1893
|
+
* id: 2
|
|
1894
|
+
* }
|
|
1895
|
+
* },
|
|
1896
|
+
* response: {
|
|
1897
|
+
* status: 200,
|
|
1898
|
+
* body: 'user 2'
|
|
1899
|
+
* }
|
|
1900
|
+
* });
|
|
1901
|
+
* ```
|
|
1902
|
+
*
|
|
1903
|
+
* - GET to `/api/users?id=1` will return 'user 1'.
|
|
1904
|
+
* - GET to `/api/users?id=2` will return 'user 2'.
|
|
1905
|
+
* - For all other requests, it returns a 404 status code.
|
|
1906
|
+
*
|
|
1907
|
+
* ##### Loose Match on Body
|
|
1908
|
+
*
|
|
1909
|
+
* When `strict` is set to false, it performs a loose match on query params and response body:
|
|
1910
|
+
*
|
|
1911
|
+
* ```javascript
|
|
1912
|
+
* I.addInteractionToMockServer({
|
|
1913
|
+
* strict: false,
|
|
1914
|
+
* request: {
|
|
1915
|
+
* method: 'POST',
|
|
1916
|
+
* path: '/api/users',
|
|
1917
|
+
* body: {
|
|
1918
|
+
* name: 'john'
|
|
1919
|
+
* }
|
|
1920
|
+
* },
|
|
1921
|
+
* response: {
|
|
1922
|
+
* status: 200
|
|
1923
|
+
* }
|
|
1924
|
+
* });
|
|
1925
|
+
* ```
|
|
1926
|
+
*
|
|
1927
|
+
* - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
|
|
1928
|
+
* - POST to `/api/users` without the `name` property in the body will return a 404 status code.
|
|
1929
|
+
*
|
|
1930
|
+
* Happy testing with MockServer in CodeceptJS! 🚀
|
|
1931
|
+
*
|
|
1932
|
+
* ## Methods
|
|
1933
|
+
*/
|
|
1934
|
+
class MockServer {
|
|
1935
|
+
/**
|
|
1936
|
+
* Start the mock server
|
|
1937
|
+
* @param [port] - start the mock server with given port
|
|
1938
|
+
* @returns void
|
|
1939
|
+
*/
|
|
1940
|
+
startMockServer(port?: number): any;
|
|
1941
|
+
/**
|
|
1942
|
+
* Stop the mock server
|
|
1943
|
+
* @returns void
|
|
1944
|
+
*/
|
|
1945
|
+
stopMockServer(): any;
|
|
1946
|
+
/**
|
|
1947
|
+
* An interaction adds behavior to the mock server
|
|
1948
|
+
*
|
|
1949
|
+
*
|
|
1950
|
+
* ```js
|
|
1951
|
+
* I.addInteractionToMockServer({
|
|
1952
|
+
* request: {
|
|
1953
|
+
* method: 'GET',
|
|
1954
|
+
* path: '/api/hello'
|
|
1955
|
+
* },
|
|
1956
|
+
* response: {
|
|
1957
|
+
* status: 200,
|
|
1958
|
+
* body: {
|
|
1959
|
+
* 'say': 'hello to mock server'
|
|
1960
|
+
* }
|
|
1961
|
+
* }
|
|
1962
|
+
* });
|
|
1963
|
+
* ```
|
|
1964
|
+
* ```js
|
|
1965
|
+
* // with query params
|
|
1966
|
+
* I.addInteractionToMockServer({
|
|
1967
|
+
* request: {
|
|
1968
|
+
* method: 'GET',
|
|
1969
|
+
* path: '/api/hello',
|
|
1970
|
+
* queryParams: {
|
|
1971
|
+
* id: 2
|
|
1972
|
+
* }
|
|
1973
|
+
* },
|
|
1974
|
+
* response: {
|
|
1975
|
+
* status: 200,
|
|
1976
|
+
* body: {
|
|
1977
|
+
* 'say': 'hello to mock server'
|
|
1978
|
+
* }
|
|
1979
|
+
* }
|
|
1980
|
+
* });
|
|
1981
|
+
* ```
|
|
1982
|
+
* @param interaction - add behavior to the mock server
|
|
1983
|
+
* @returns void
|
|
1984
|
+
*/
|
|
1985
|
+
addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
|
|
1986
|
+
}
|
|
1802
1987
|
/**
|
|
1803
1988
|
* Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
|
|
1804
1989
|
* fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -2883,6 +3068,7 @@ declare namespace CodeceptJS {
|
|
|
2883
3068
|
* @property [bypassCSP] - bypass Content Security Policy or CSP
|
|
2884
3069
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
2885
3070
|
* @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).
|
|
3071
|
+
* @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).
|
|
2886
3072
|
*/
|
|
2887
3073
|
type PlaywrightConfig = {
|
|
2888
3074
|
url?: string;
|
|
@@ -2920,6 +3106,7 @@ declare namespace CodeceptJS {
|
|
|
2920
3106
|
bypassCSP?: boolean;
|
|
2921
3107
|
highlightElement?: boolean;
|
|
2922
3108
|
recordHar?: any;
|
|
3109
|
+
testIdAttribute?: string;
|
|
2923
3110
|
};
|
|
2924
3111
|
/**
|
|
2925
3112
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -4747,6 +4934,17 @@ declare namespace CodeceptJS {
|
|
|
4747
4934
|
* @returns automatically synchronized promise through #recorder
|
|
4748
4935
|
*/
|
|
4749
4936
|
waitForDetached(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4937
|
+
/**
|
|
4938
|
+
* Waits for the specified cookie in the cookies.
|
|
4939
|
+
*
|
|
4940
|
+
* ```js
|
|
4941
|
+
* I.waitForCookie("token");
|
|
4942
|
+
* ```
|
|
4943
|
+
* @param name - expected cookie name.
|
|
4944
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
4945
|
+
* @returns automatically synchronized promise through #recorder
|
|
4946
|
+
*/
|
|
4947
|
+
waitForCookie(name: string, sec?: number): void;
|
|
4750
4948
|
/**
|
|
4751
4949
|
* Grab the data from performance timing using Navigation Timing API.
|
|
4752
4950
|
* The returned data will contain following things in ms:
|
|
@@ -4801,7 +4999,7 @@ declare namespace CodeceptJS {
|
|
|
4801
4999
|
* ```
|
|
4802
5000
|
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
|
|
4803
5001
|
* @param [url] - URL, regex or pattern for to match URL
|
|
4804
|
-
* @param [handler] - a function to process
|
|
5002
|
+
* @param [handler] - a function to process request
|
|
4805
5003
|
*/
|
|
4806
5004
|
mockRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
4807
5005
|
/**
|
|
@@ -4813,29 +5011,17 @@ declare namespace CodeceptJS {
|
|
|
4813
5011
|
* ```
|
|
4814
5012
|
* If no handler is passed, all mock requests for the rote are disabled.
|
|
4815
5013
|
* @param [url] - URL, regex or pattern for to match URL
|
|
4816
|
-
* @param [handler] - a function to process
|
|
5014
|
+
* @param [handler] - a function to process request
|
|
4817
5015
|
*/
|
|
4818
5016
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
4819
5017
|
/**
|
|
4820
|
-
*
|
|
4821
|
-
* This also resets recorded network requests.
|
|
5018
|
+
* Resets all recorded network requests.
|
|
4822
5019
|
*
|
|
4823
5020
|
* ```js
|
|
4824
|
-
* I.
|
|
5021
|
+
* I.flushNetworkTraffics();
|
|
4825
5022
|
* ```
|
|
4826
5023
|
*/
|
|
4827
5024
|
startRecordingTraffic(): void;
|
|
4828
|
-
/**
|
|
4829
|
-
* Grab the recording network traffics
|
|
4830
|
-
*
|
|
4831
|
-
* ```js
|
|
4832
|
-
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
4833
|
-
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
4834
|
-
* expect(traffics[0].response.status).to.equal(200);
|
|
4835
|
-
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4836
|
-
* ```
|
|
4837
|
-
*/
|
|
4838
|
-
grabRecordedNetworkTraffics(): Promise<any[]>;
|
|
4839
5025
|
/**
|
|
4840
5026
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4841
5027
|
*
|
|
@@ -4872,6 +5058,10 @@ declare namespace CodeceptJS {
|
|
|
4872
5058
|
mockTraffic(urls: any, responseString: any, contentType?: any): void;
|
|
4873
5059
|
/**
|
|
4874
5060
|
* Resets all recorded network requests.
|
|
5061
|
+
*
|
|
5062
|
+
* ```js
|
|
5063
|
+
* I.flushNetworkTraffics();
|
|
5064
|
+
* ```
|
|
4875
5065
|
*/
|
|
4876
5066
|
flushNetworkTraffics(): void;
|
|
4877
5067
|
/**
|
|
@@ -4882,6 +5072,30 @@ declare namespace CodeceptJS {
|
|
|
4882
5072
|
* ```
|
|
4883
5073
|
*/
|
|
4884
5074
|
stopRecordingTraffic(): void;
|
|
5075
|
+
/**
|
|
5076
|
+
* Returns full URL of request matching parameter "urlMatch".
|
|
5077
|
+
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
5078
|
+
*
|
|
5079
|
+
* Examples:
|
|
5080
|
+
*
|
|
5081
|
+
* ```js
|
|
5082
|
+
* I.grabTrafficUrl('https://api.example.com/session');
|
|
5083
|
+
* I.grabTrafficUrl(/session.*start/);
|
|
5084
|
+
* ```
|
|
5085
|
+
*/
|
|
5086
|
+
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
5087
|
+
/**
|
|
5088
|
+
* Grab the recording network traffics
|
|
5089
|
+
*
|
|
5090
|
+
* ```js
|
|
5091
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
5092
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
5093
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
5094
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
5095
|
+
* ```
|
|
5096
|
+
* @returns recorded network traffics
|
|
5097
|
+
*/
|
|
5098
|
+
grabRecordedNetworkTraffics(): any[];
|
|
4885
5099
|
/**
|
|
4886
5100
|
* Verifies that a certain request is part of network traffic.
|
|
4887
5101
|
*
|
|
@@ -4890,13 +5104,13 @@ declare namespace CodeceptJS {
|
|
|
4890
5104
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4891
5105
|
* I.startRecordingTraffic();
|
|
4892
5106
|
* await I.seeTraffic({
|
|
4893
|
-
*
|
|
4894
|
-
*
|
|
4895
|
-
*
|
|
4896
|
-
*
|
|
4897
|
-
*
|
|
5107
|
+
* name: 'sentry event',
|
|
5108
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
5109
|
+
* parameters: {
|
|
5110
|
+
* width: '1919',
|
|
5111
|
+
* height: '1138',
|
|
4898
5112
|
* },
|
|
4899
|
-
*
|
|
5113
|
+
* });
|
|
4900
5114
|
* ```
|
|
4901
5115
|
*
|
|
4902
5116
|
* ```js
|
|
@@ -4904,12 +5118,12 @@ declare namespace CodeceptJS {
|
|
|
4904
5118
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4905
5119
|
* I.startRecordingTraffic();
|
|
4906
5120
|
* await I.seeTraffic({
|
|
4907
|
-
*
|
|
4908
|
-
*
|
|
4909
|
-
*
|
|
4910
|
-
*
|
|
5121
|
+
* name: 'event',
|
|
5122
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
5123
|
+
* requestPostData: {
|
|
5124
|
+
* st: 2,
|
|
4911
5125
|
* },
|
|
4912
|
-
*
|
|
5126
|
+
* });
|
|
4913
5127
|
* ```
|
|
4914
5128
|
* @param opts - options when checking the traffic network.
|
|
4915
5129
|
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
@@ -4917,6 +5131,7 @@ declare namespace CodeceptJS {
|
|
|
4917
5131
|
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
4918
5132
|
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
4919
5133
|
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
5134
|
+
* @returns automatically synchronized promise through #recorder
|
|
4920
5135
|
*/
|
|
4921
5136
|
seeTraffic(opts: {
|
|
4922
5137
|
name: string;
|
|
@@ -4924,19 +5139,7 @@ declare namespace CodeceptJS {
|
|
|
4924
5139
|
parameters?: any;
|
|
4925
5140
|
requestPostData?: any;
|
|
4926
5141
|
timeout?: number;
|
|
4927
|
-
}):
|
|
4928
|
-
/**
|
|
4929
|
-
* Returns full URL of request matching parameter "urlMatch".
|
|
4930
|
-
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
4931
|
-
*
|
|
4932
|
-
* Examples:
|
|
4933
|
-
*
|
|
4934
|
-
* ```js
|
|
4935
|
-
* I.grabTrafficUrl('https://api.example.com/session');
|
|
4936
|
-
* I.grabTrafficUrl(/session.*start/);
|
|
4937
|
-
* ```
|
|
4938
|
-
*/
|
|
4939
|
-
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
5142
|
+
}): void;
|
|
4940
5143
|
/**
|
|
4941
5144
|
* Verifies that a certain request is not part of network traffic.
|
|
4942
5145
|
*
|
|
@@ -4949,6 +5152,7 @@ declare namespace CodeceptJS {
|
|
|
4949
5152
|
* @param opts - options when checking the traffic network.
|
|
4950
5153
|
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
4951
5154
|
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
5155
|
+
* @returns automatically synchronized promise through #recorder
|
|
4952
5156
|
*/
|
|
4953
5157
|
dontSeeTraffic(opts: {
|
|
4954
5158
|
name: string;
|
|
@@ -4961,6 +5165,7 @@ declare namespace CodeceptJS {
|
|
|
4961
5165
|
* ```js
|
|
4962
5166
|
* await I.startRecordingWebSocketMessages();
|
|
4963
5167
|
* ```
|
|
5168
|
+
* @returns automatically synchronized promise through #recorder
|
|
4964
5169
|
*/
|
|
4965
5170
|
startRecordingWebSocketMessages(): void;
|
|
4966
5171
|
/**
|
|
@@ -4969,6 +5174,7 @@ declare namespace CodeceptJS {
|
|
|
4969
5174
|
* ```js
|
|
4970
5175
|
* await I.stopRecordingWebSocketMessages();
|
|
4971
5176
|
* ```
|
|
5177
|
+
* @returns automatically synchronized promise through #recorder
|
|
4972
5178
|
*/
|
|
4973
5179
|
stopRecordingWebSocketMessages(): void;
|
|
4974
5180
|
/**
|
|
@@ -7612,6 +7818,17 @@ declare namespace CodeceptJS {
|
|
|
7612
7818
|
* Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
7613
7819
|
*/
|
|
7614
7820
|
grabCookie(name?: string): any;
|
|
7821
|
+
/**
|
|
7822
|
+
* Waits for the specified cookie in the cookies.
|
|
7823
|
+
*
|
|
7824
|
+
* ```js
|
|
7825
|
+
* I.waitForCookie("token");
|
|
7826
|
+
* ```
|
|
7827
|
+
* @param name - expected cookie name.
|
|
7828
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
7829
|
+
* @returns automatically synchronized promise through #recorder
|
|
7830
|
+
*/
|
|
7831
|
+
waitForCookie(name: string, sec?: number): void;
|
|
7615
7832
|
/**
|
|
7616
7833
|
* Clears a cookie by name,
|
|
7617
7834
|
* if none provided clears all cookies.
|
|
@@ -8152,6 +8369,153 @@ declare namespace CodeceptJS {
|
|
|
8152
8369
|
* @returns Element bounding rectangle
|
|
8153
8370
|
*/
|
|
8154
8371
|
grabElementBoundingRect(locator: LocatorOrString, elementSize?: string): Promise<DOMRect> | Promise<number>;
|
|
8372
|
+
/**
|
|
8373
|
+
* Mocks network request using [`Request Interception`](https://pptr.dev/next/guides/request-interception)
|
|
8374
|
+
*
|
|
8375
|
+
* ```js
|
|
8376
|
+
* I.mockRoute(/(\.png$)|(\.jpg$)/, route => route.abort());
|
|
8377
|
+
* ```
|
|
8378
|
+
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://pptr.dev/next/guides/request-interception)
|
|
8379
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
8380
|
+
* @param [handler] - a function to process request
|
|
8381
|
+
*/
|
|
8382
|
+
mockRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
8383
|
+
/**
|
|
8384
|
+
* Stops network mocking created by `mockRoute`.
|
|
8385
|
+
*
|
|
8386
|
+
* ```js
|
|
8387
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/);
|
|
8388
|
+
* ```
|
|
8389
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
8390
|
+
*/
|
|
8391
|
+
stopMockingRoute(url?: string | RegExp): void;
|
|
8392
|
+
/**
|
|
8393
|
+
* Resets all recorded network requests.
|
|
8394
|
+
*
|
|
8395
|
+
* ```js
|
|
8396
|
+
* I.flushNetworkTraffics();
|
|
8397
|
+
* ```
|
|
8398
|
+
*/
|
|
8399
|
+
flushNetworkTraffics(): void;
|
|
8400
|
+
/**
|
|
8401
|
+
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
8402
|
+
*
|
|
8403
|
+
* ```js
|
|
8404
|
+
* I.stopRecordingTraffic();
|
|
8405
|
+
* ```
|
|
8406
|
+
*/
|
|
8407
|
+
stopRecordingTraffic(): void;
|
|
8408
|
+
/**
|
|
8409
|
+
* Starts recording the network traffics.
|
|
8410
|
+
* This also resets recorded network requests.
|
|
8411
|
+
*
|
|
8412
|
+
* ```js
|
|
8413
|
+
* I.startRecordingTraffic();
|
|
8414
|
+
* ```
|
|
8415
|
+
* @returns automatically synchronized promise through #recorder
|
|
8416
|
+
*/
|
|
8417
|
+
startRecordingTraffic(): void;
|
|
8418
|
+
/**
|
|
8419
|
+
* Grab the recording network traffics
|
|
8420
|
+
*
|
|
8421
|
+
* ```js
|
|
8422
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
8423
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
8424
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
8425
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
8426
|
+
* ```
|
|
8427
|
+
* @returns recorded network traffics
|
|
8428
|
+
*/
|
|
8429
|
+
grabRecordedNetworkTraffics(): any[];
|
|
8430
|
+
/**
|
|
8431
|
+
* Verifies that a certain request is part of network traffic.
|
|
8432
|
+
*
|
|
8433
|
+
* ```js
|
|
8434
|
+
* // checking the request url contains certain query strings
|
|
8435
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
8436
|
+
* I.startRecordingTraffic();
|
|
8437
|
+
* await I.seeTraffic({
|
|
8438
|
+
* name: 'sentry event',
|
|
8439
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
8440
|
+
* parameters: {
|
|
8441
|
+
* width: '1919',
|
|
8442
|
+
* height: '1138',
|
|
8443
|
+
* },
|
|
8444
|
+
* });
|
|
8445
|
+
* ```
|
|
8446
|
+
*
|
|
8447
|
+
* ```js
|
|
8448
|
+
* // checking the request url contains certain post data
|
|
8449
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
8450
|
+
* I.startRecordingTraffic();
|
|
8451
|
+
* await I.seeTraffic({
|
|
8452
|
+
* name: 'event',
|
|
8453
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
8454
|
+
* requestPostData: {
|
|
8455
|
+
* st: 2,
|
|
8456
|
+
* },
|
|
8457
|
+
* });
|
|
8458
|
+
* ```
|
|
8459
|
+
* @param opts - options when checking the traffic network.
|
|
8460
|
+
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
8461
|
+
* @param opts.url - Expected URL of request in network traffic
|
|
8462
|
+
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
8463
|
+
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
8464
|
+
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
8465
|
+
* @returns automatically synchronized promise through #recorder
|
|
8466
|
+
*/
|
|
8467
|
+
seeTraffic(opts: {
|
|
8468
|
+
name: string;
|
|
8469
|
+
url: string;
|
|
8470
|
+
parameters?: any;
|
|
8471
|
+
requestPostData?: any;
|
|
8472
|
+
timeout?: number;
|
|
8473
|
+
}): void;
|
|
8474
|
+
/**
|
|
8475
|
+
* Verifies that a certain request is not part of network traffic.
|
|
8476
|
+
*
|
|
8477
|
+
* Examples:
|
|
8478
|
+
*
|
|
8479
|
+
* ```js
|
|
8480
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
8481
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
8482
|
+
* ```
|
|
8483
|
+
* @param opts - options when checking the traffic network.
|
|
8484
|
+
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
8485
|
+
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
8486
|
+
* @returns automatically synchronized promise through #recorder
|
|
8487
|
+
*/
|
|
8488
|
+
dontSeeTraffic(opts: {
|
|
8489
|
+
name: string;
|
|
8490
|
+
url: string | RegExp;
|
|
8491
|
+
}): void;
|
|
8492
|
+
/**
|
|
8493
|
+
* Starts recording of websocket messages.
|
|
8494
|
+
* This also resets recorded websocket messages.
|
|
8495
|
+
*
|
|
8496
|
+
* ```js
|
|
8497
|
+
* await I.startRecordingWebSocketMessages();
|
|
8498
|
+
* ```
|
|
8499
|
+
* @returns automatically synchronized promise through #recorder
|
|
8500
|
+
*/
|
|
8501
|
+
startRecordingWebSocketMessages(): void;
|
|
8502
|
+
/**
|
|
8503
|
+
* Stops recording WS messages. Recorded WS messages is not flashed.
|
|
8504
|
+
*
|
|
8505
|
+
* ```js
|
|
8506
|
+
* await I.stopRecordingWebSocketMessages();
|
|
8507
|
+
* ```
|
|
8508
|
+
* @returns automatically synchronized promise through #recorder
|
|
8509
|
+
*/
|
|
8510
|
+
stopRecordingWebSocketMessages(): void;
|
|
8511
|
+
/**
|
|
8512
|
+
* Grab the recording WS messages
|
|
8513
|
+
*/
|
|
8514
|
+
grabWebSocketMessages(): any[] | undefined;
|
|
8515
|
+
/**
|
|
8516
|
+
* Resets all recorded WS messages.
|
|
8517
|
+
*/
|
|
8518
|
+
flushWebSocketMessages(): void;
|
|
8155
8519
|
}
|
|
8156
8520
|
/**
|
|
8157
8521
|
* ## Configuration
|
|
@@ -10707,6 +11071,17 @@ declare namespace CodeceptJS {
|
|
|
10707
11071
|
* @returns attribute value
|
|
10708
11072
|
*/
|
|
10709
11073
|
grabCookie(name?: string): any;
|
|
11074
|
+
/**
|
|
11075
|
+
* Waits for the specified cookie in the cookies.
|
|
11076
|
+
*
|
|
11077
|
+
* ```js
|
|
11078
|
+
* I.waitForCookie("token");
|
|
11079
|
+
* ```
|
|
11080
|
+
* @param name - expected cookie name.
|
|
11081
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
11082
|
+
* @returns automatically synchronized promise through #recorder
|
|
11083
|
+
*/
|
|
11084
|
+
waitForCookie(name: string, sec?: number): void;
|
|
10710
11085
|
/**
|
|
10711
11086
|
* Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
10712
11087
|
* Don't confuse popups with modal windows, as created by [various
|
|
@@ -11300,10 +11675,122 @@ declare namespace CodeceptJS {
|
|
|
11300
11675
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
11301
11676
|
*/
|
|
11302
11677
|
runInWeb(): void;
|
|
11678
|
+
/**
|
|
11679
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11680
|
+
*
|
|
11681
|
+
* Resets all recorded network requests.
|
|
11682
|
+
*
|
|
11683
|
+
* ```js
|
|
11684
|
+
* I.flushNetworkTraffics();
|
|
11685
|
+
* ```
|
|
11686
|
+
*/
|
|
11687
|
+
flushNetworkTraffics(): void;
|
|
11688
|
+
/**
|
|
11689
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11690
|
+
*
|
|
11691
|
+
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
11692
|
+
*
|
|
11693
|
+
* ```js
|
|
11694
|
+
* I.stopRecordingTraffic();
|
|
11695
|
+
* ```
|
|
11696
|
+
*/
|
|
11697
|
+
stopRecordingTraffic(): void;
|
|
11698
|
+
/**
|
|
11699
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11700
|
+
*
|
|
11701
|
+
* Starts recording the network traffics.
|
|
11702
|
+
* This also resets recorded network requests.
|
|
11703
|
+
*
|
|
11704
|
+
* ```js
|
|
11705
|
+
* I.startRecordingTraffic();
|
|
11706
|
+
* ```
|
|
11707
|
+
* @returns automatically synchronized promise through #recorder
|
|
11708
|
+
*/
|
|
11709
|
+
startRecordingTraffic(): void;
|
|
11710
|
+
/**
|
|
11711
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11712
|
+
*
|
|
11713
|
+
* Grab the recording network traffics
|
|
11714
|
+
*
|
|
11715
|
+
* ```js
|
|
11716
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
11717
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
11718
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
11719
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
11720
|
+
* ```
|
|
11721
|
+
* @returns recorded network traffics
|
|
11722
|
+
*/
|
|
11723
|
+
grabRecordedNetworkTraffics(): any[];
|
|
11724
|
+
/**
|
|
11725
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11726
|
+
*
|
|
11727
|
+
* Verifies that a certain request is part of network traffic.
|
|
11728
|
+
*
|
|
11729
|
+
* ```js
|
|
11730
|
+
* // checking the request url contains certain query strings
|
|
11731
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
11732
|
+
* I.startRecordingTraffic();
|
|
11733
|
+
* await I.seeTraffic({
|
|
11734
|
+
* name: 'sentry event',
|
|
11735
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
11736
|
+
* parameters: {
|
|
11737
|
+
* width: '1919',
|
|
11738
|
+
* height: '1138',
|
|
11739
|
+
* },
|
|
11740
|
+
* });
|
|
11741
|
+
* ```
|
|
11742
|
+
*
|
|
11743
|
+
* ```js
|
|
11744
|
+
* // checking the request url contains certain post data
|
|
11745
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
11746
|
+
* I.startRecordingTraffic();
|
|
11747
|
+
* await I.seeTraffic({
|
|
11748
|
+
* name: 'event',
|
|
11749
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
11750
|
+
* requestPostData: {
|
|
11751
|
+
* st: 2,
|
|
11752
|
+
* },
|
|
11753
|
+
* });
|
|
11754
|
+
* ```
|
|
11755
|
+
* @param opts - options when checking the traffic network.
|
|
11756
|
+
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
11757
|
+
* @param opts.url - Expected URL of request in network traffic
|
|
11758
|
+
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
11759
|
+
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
11760
|
+
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
11761
|
+
* @returns automatically synchronized promise through #recorder
|
|
11762
|
+
*/
|
|
11763
|
+
seeTraffic(opts: {
|
|
11764
|
+
name: string;
|
|
11765
|
+
url: string;
|
|
11766
|
+
parameters?: any;
|
|
11767
|
+
requestPostData?: any;
|
|
11768
|
+
timeout?: number;
|
|
11769
|
+
}): void;
|
|
11770
|
+
/**
|
|
11771
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11772
|
+
*
|
|
11773
|
+
* Verifies that a certain request is not part of network traffic.
|
|
11774
|
+
*
|
|
11775
|
+
* Examples:
|
|
11776
|
+
*
|
|
11777
|
+
* ```js
|
|
11778
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
11779
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
11780
|
+
* ```
|
|
11781
|
+
* @param opts - options when checking the traffic network.
|
|
11782
|
+
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
11783
|
+
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
11784
|
+
* @returns automatically synchronized promise through #recorder
|
|
11785
|
+
*/
|
|
11786
|
+
dontSeeTraffic(opts: {
|
|
11787
|
+
name: string;
|
|
11788
|
+
url: string | RegExp;
|
|
11789
|
+
}): void;
|
|
11303
11790
|
}
|
|
11304
11791
|
interface ActorStatic {
|
|
11305
11792
|
/**
|
|
11306
|
-
*
|
|
11793
|
+
* Print the comment on log. Also, adding a step in the `Test.steps` object
|
|
11307
11794
|
*/
|
|
11308
11795
|
say(msg: string, color?: string): void;
|
|
11309
11796
|
/**
|
|
@@ -11637,6 +12124,7 @@ declare namespace CodeceptJS {
|
|
|
11637
12124
|
isShadow(): boolean;
|
|
11638
12125
|
isFrame(): boolean;
|
|
11639
12126
|
isCSS(): boolean;
|
|
12127
|
+
isPlaywrightLocator(): boolean;
|
|
11640
12128
|
isNull(): boolean;
|
|
11641
12129
|
isXPath(): boolean;
|
|
11642
12130
|
isCustom(): boolean;
|