codeceptjs 3.6.0-beta.1.ai-healers → 3.6.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/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/plugin/coverage.js +112 -99
- package/lib/step.js +3 -1
- package/package.json +48 -37
- package/typings/index.d.ts +19 -2
- package/typings/promiseBasedTypes.d.ts +505 -41
- package/typings/types.d.ts +609 -56
- 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
|
@@ -1167,9 +1167,9 @@ declare namespace CodeceptJS {
|
|
|
1167
1167
|
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1168
1168
|
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1169
1169
|
/**
|
|
1170
|
-
* @param ajvOptions - Pass AJV options
|
|
1170
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1171
1171
|
*/
|
|
1172
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions
|
|
1172
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1173
1173
|
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1174
1174
|
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1175
1175
|
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1772,6 +1772,188 @@ declare namespace CodeceptJS {
|
|
|
1772
1772
|
*/
|
|
1773
1773
|
seeResponseMatchesJsonSchema(fnOrSchema: any): Promise<any>;
|
|
1774
1774
|
}
|
|
1775
|
+
/**
|
|
1776
|
+
* ## Configuration
|
|
1777
|
+
*
|
|
1778
|
+
* This helper should be configured in codecept.conf.(js|ts)
|
|
1779
|
+
* @property [port = 9393] - Mock server port
|
|
1780
|
+
* @property [host = "0.0.0.0"] - Mock server host
|
|
1781
|
+
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1782
|
+
*/
|
|
1783
|
+
type MockServerConfig = {
|
|
1784
|
+
port?: number;
|
|
1785
|
+
host?: string;
|
|
1786
|
+
httpsOpts?: any;
|
|
1787
|
+
};
|
|
1788
|
+
/**
|
|
1789
|
+
* MockServer
|
|
1790
|
+
*
|
|
1791
|
+
* 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.
|
|
1792
|
+
*
|
|
1793
|
+
* <!-- configuration -->
|
|
1794
|
+
*
|
|
1795
|
+
* #### Examples
|
|
1796
|
+
*
|
|
1797
|
+
* You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
|
|
1798
|
+
*
|
|
1799
|
+
* ```javascript
|
|
1800
|
+
* {
|
|
1801
|
+
* helpers: {
|
|
1802
|
+
* REST: {...},
|
|
1803
|
+
* MockServer: {
|
|
1804
|
+
* // default mock server config
|
|
1805
|
+
* port: 9393,
|
|
1806
|
+
* host: '0.0.0.0',
|
|
1807
|
+
* httpsOpts: {
|
|
1808
|
+
* key: '',
|
|
1809
|
+
* cert: '',
|
|
1810
|
+
* },
|
|
1811
|
+
* },
|
|
1812
|
+
* }
|
|
1813
|
+
* }
|
|
1814
|
+
* ```
|
|
1815
|
+
*
|
|
1816
|
+
* #### Adding Interactions
|
|
1817
|
+
*
|
|
1818
|
+
* 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.
|
|
1819
|
+
*
|
|
1820
|
+
* ```javascript
|
|
1821
|
+
* I.addInteractionToMockServer({
|
|
1822
|
+
* request: {
|
|
1823
|
+
* method: 'GET',
|
|
1824
|
+
* path: '/api/hello'
|
|
1825
|
+
* },
|
|
1826
|
+
* response: {
|
|
1827
|
+
* status: 200,
|
|
1828
|
+
* body: {
|
|
1829
|
+
* 'say': 'hello to mock server'
|
|
1830
|
+
* }
|
|
1831
|
+
* }
|
|
1832
|
+
* });
|
|
1833
|
+
* ```
|
|
1834
|
+
*
|
|
1835
|
+
* #### Request Matching
|
|
1836
|
+
*
|
|
1837
|
+
* 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.
|
|
1838
|
+
*
|
|
1839
|
+
* - Strong match on HTTP Method, Path, Query Params & JSON body.
|
|
1840
|
+
* - Loose match on Headers.
|
|
1841
|
+
*
|
|
1842
|
+
* ##### Strong Match on Query Params
|
|
1843
|
+
*
|
|
1844
|
+
* You can send different responses based on query parameters:
|
|
1845
|
+
*
|
|
1846
|
+
* ```javascript
|
|
1847
|
+
* I.addInteractionToMockServer({
|
|
1848
|
+
* request: {
|
|
1849
|
+
* method: 'GET',
|
|
1850
|
+
* path: '/api/users',
|
|
1851
|
+
* queryParams: {
|
|
1852
|
+
* id: 1
|
|
1853
|
+
* }
|
|
1854
|
+
* },
|
|
1855
|
+
* response: {
|
|
1856
|
+
* status: 200,
|
|
1857
|
+
* body: 'user 1'
|
|
1858
|
+
* }
|
|
1859
|
+
* });
|
|
1860
|
+
*
|
|
1861
|
+
* I.addInteractionToMockServer({
|
|
1862
|
+
* request: {
|
|
1863
|
+
* method: 'GET',
|
|
1864
|
+
* path: '/api/users',
|
|
1865
|
+
* queryParams: {
|
|
1866
|
+
* id: 2
|
|
1867
|
+
* }
|
|
1868
|
+
* },
|
|
1869
|
+
* response: {
|
|
1870
|
+
* status: 200,
|
|
1871
|
+
* body: 'user 2'
|
|
1872
|
+
* }
|
|
1873
|
+
* });
|
|
1874
|
+
* ```
|
|
1875
|
+
*
|
|
1876
|
+
* - GET to `/api/users?id=1` will return 'user 1'.
|
|
1877
|
+
* - GET to `/api/users?id=2` will return 'user 2'.
|
|
1878
|
+
* - For all other requests, it returns a 404 status code.
|
|
1879
|
+
*
|
|
1880
|
+
* ##### Loose Match on Body
|
|
1881
|
+
*
|
|
1882
|
+
* When `strict` is set to false, it performs a loose match on query params and response body:
|
|
1883
|
+
*
|
|
1884
|
+
* ```javascript
|
|
1885
|
+
* I.addInteractionToMockServer({
|
|
1886
|
+
* strict: false,
|
|
1887
|
+
* request: {
|
|
1888
|
+
* method: 'POST',
|
|
1889
|
+
* path: '/api/users',
|
|
1890
|
+
* body: {
|
|
1891
|
+
* name: 'john'
|
|
1892
|
+
* }
|
|
1893
|
+
* },
|
|
1894
|
+
* response: {
|
|
1895
|
+
* status: 200
|
|
1896
|
+
* }
|
|
1897
|
+
* });
|
|
1898
|
+
* ```
|
|
1899
|
+
*
|
|
1900
|
+
* - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
|
|
1901
|
+
* - POST to `/api/users` without the `name` property in the body will return a 404 status code.
|
|
1902
|
+
*
|
|
1903
|
+
* Happy testing with MockServer in CodeceptJS! 🚀
|
|
1904
|
+
*
|
|
1905
|
+
* ## Methods
|
|
1906
|
+
*/
|
|
1907
|
+
class MockServer {
|
|
1908
|
+
/**
|
|
1909
|
+
* Start the mock server
|
|
1910
|
+
* @param [port] - start the mock server with given port
|
|
1911
|
+
*/
|
|
1912
|
+
startMockServer(port?: number): Promise<any>;
|
|
1913
|
+
/**
|
|
1914
|
+
* Stop the mock server
|
|
1915
|
+
*/
|
|
1916
|
+
stopMockServer(): Promise<any>;
|
|
1917
|
+
/**
|
|
1918
|
+
* An interaction adds behavior to the mock server
|
|
1919
|
+
*
|
|
1920
|
+
*
|
|
1921
|
+
* ```js
|
|
1922
|
+
* I.addInteractionToMockServer({
|
|
1923
|
+
* request: {
|
|
1924
|
+
* method: 'GET',
|
|
1925
|
+
* path: '/api/hello'
|
|
1926
|
+
* },
|
|
1927
|
+
* response: {
|
|
1928
|
+
* status: 200,
|
|
1929
|
+
* body: {
|
|
1930
|
+
* 'say': 'hello to mock server'
|
|
1931
|
+
* }
|
|
1932
|
+
* }
|
|
1933
|
+
* });
|
|
1934
|
+
* ```
|
|
1935
|
+
* ```js
|
|
1936
|
+
* // with query params
|
|
1937
|
+
* I.addInteractionToMockServer({
|
|
1938
|
+
* request: {
|
|
1939
|
+
* method: 'GET',
|
|
1940
|
+
* path: '/api/hello',
|
|
1941
|
+
* queryParams: {
|
|
1942
|
+
* id: 2
|
|
1943
|
+
* }
|
|
1944
|
+
* },
|
|
1945
|
+
* response: {
|
|
1946
|
+
* status: 200,
|
|
1947
|
+
* body: {
|
|
1948
|
+
* 'say': 'hello to mock server'
|
|
1949
|
+
* }
|
|
1950
|
+
* }
|
|
1951
|
+
* });
|
|
1952
|
+
* ```
|
|
1953
|
+
* @param interaction - add behavior to the mock server
|
|
1954
|
+
*/
|
|
1955
|
+
addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): Promise<any>;
|
|
1956
|
+
}
|
|
1775
1957
|
/**
|
|
1776
1958
|
* Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
|
|
1777
1959
|
* fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -4504,6 +4686,16 @@ declare namespace CodeceptJS {
|
|
|
4504
4686
|
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
4505
4687
|
*/
|
|
4506
4688
|
waitForDetached(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4689
|
+
/**
|
|
4690
|
+
* Waits for the specified cookie in the cookies.
|
|
4691
|
+
*
|
|
4692
|
+
* ```js
|
|
4693
|
+
* I.waitForCookie("token");
|
|
4694
|
+
* ```
|
|
4695
|
+
* @param name - expected cookie name.
|
|
4696
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
4697
|
+
*/
|
|
4698
|
+
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
4507
4699
|
/**
|
|
4508
4700
|
* Grab the data from performance timing using Navigation Timing API.
|
|
4509
4701
|
* The returned data will contain following things in ms:
|
|
@@ -4557,7 +4749,7 @@ declare namespace CodeceptJS {
|
|
|
4557
4749
|
* ```
|
|
4558
4750
|
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
|
|
4559
4751
|
* @param [url] - URL, regex or pattern for to match URL
|
|
4560
|
-
* @param [handler] - a function to process
|
|
4752
|
+
* @param [handler] - a function to process request
|
|
4561
4753
|
*/
|
|
4562
4754
|
mockRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
4563
4755
|
/**
|
|
@@ -4569,29 +4761,17 @@ declare namespace CodeceptJS {
|
|
|
4569
4761
|
* ```
|
|
4570
4762
|
* If no handler is passed, all mock requests for the rote are disabled.
|
|
4571
4763
|
* @param [url] - URL, regex or pattern for to match URL
|
|
4572
|
-
* @param [handler] - a function to process
|
|
4764
|
+
* @param [handler] - a function to process request
|
|
4573
4765
|
*/
|
|
4574
4766
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
4575
4767
|
/**
|
|
4576
|
-
*
|
|
4577
|
-
* This also resets recorded network requests.
|
|
4768
|
+
* Resets all recorded network requests.
|
|
4578
4769
|
*
|
|
4579
4770
|
* ```js
|
|
4580
|
-
* I.
|
|
4771
|
+
* I.flushNetworkTraffics();
|
|
4581
4772
|
* ```
|
|
4582
4773
|
*/
|
|
4583
4774
|
startRecordingTraffic(): Promise<any>;
|
|
4584
|
-
/**
|
|
4585
|
-
* Grab the recording network traffics
|
|
4586
|
-
*
|
|
4587
|
-
* ```js
|
|
4588
|
-
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
4589
|
-
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
4590
|
-
* expect(traffics[0].response.status).to.equal(200);
|
|
4591
|
-
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4592
|
-
* ```
|
|
4593
|
-
*/
|
|
4594
|
-
grabRecordedNetworkTraffics(): Promise<any[]>;
|
|
4595
4775
|
/**
|
|
4596
4776
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4597
4777
|
*
|
|
@@ -4628,6 +4808,10 @@ declare namespace CodeceptJS {
|
|
|
4628
4808
|
mockTraffic(urls: any, responseString: any, contentType?: any): Promise<any>;
|
|
4629
4809
|
/**
|
|
4630
4810
|
* Resets all recorded network requests.
|
|
4811
|
+
*
|
|
4812
|
+
* ```js
|
|
4813
|
+
* I.flushNetworkTraffics();
|
|
4814
|
+
* ```
|
|
4631
4815
|
*/
|
|
4632
4816
|
flushNetworkTraffics(): Promise<any>;
|
|
4633
4817
|
/**
|
|
@@ -4638,6 +4822,29 @@ declare namespace CodeceptJS {
|
|
|
4638
4822
|
* ```
|
|
4639
4823
|
*/
|
|
4640
4824
|
stopRecordingTraffic(): Promise<any>;
|
|
4825
|
+
/**
|
|
4826
|
+
* Returns full URL of request matching parameter "urlMatch".
|
|
4827
|
+
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
4828
|
+
*
|
|
4829
|
+
* Examples:
|
|
4830
|
+
*
|
|
4831
|
+
* ```js
|
|
4832
|
+
* I.grabTrafficUrl('https://api.example.com/session');
|
|
4833
|
+
* I.grabTrafficUrl(/session.*start/);
|
|
4834
|
+
* ```
|
|
4835
|
+
*/
|
|
4836
|
+
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
4837
|
+
/**
|
|
4838
|
+
* Grab the recording network traffics
|
|
4839
|
+
*
|
|
4840
|
+
* ```js
|
|
4841
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
4842
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
4843
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
4844
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4845
|
+
* ```
|
|
4846
|
+
*/
|
|
4847
|
+
grabRecordedNetworkTraffics(): Promise<any>;
|
|
4641
4848
|
/**
|
|
4642
4849
|
* Verifies that a certain request is part of network traffic.
|
|
4643
4850
|
*
|
|
@@ -4646,13 +4853,13 @@ declare namespace CodeceptJS {
|
|
|
4646
4853
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4647
4854
|
* I.startRecordingTraffic();
|
|
4648
4855
|
* await I.seeTraffic({
|
|
4649
|
-
*
|
|
4650
|
-
*
|
|
4651
|
-
*
|
|
4652
|
-
*
|
|
4653
|
-
*
|
|
4856
|
+
* name: 'sentry event',
|
|
4857
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
4858
|
+
* parameters: {
|
|
4859
|
+
* width: '1919',
|
|
4860
|
+
* height: '1138',
|
|
4654
4861
|
* },
|
|
4655
|
-
*
|
|
4862
|
+
* });
|
|
4656
4863
|
* ```
|
|
4657
4864
|
*
|
|
4658
4865
|
* ```js
|
|
@@ -4660,12 +4867,12 @@ declare namespace CodeceptJS {
|
|
|
4660
4867
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4661
4868
|
* I.startRecordingTraffic();
|
|
4662
4869
|
* await I.seeTraffic({
|
|
4663
|
-
*
|
|
4664
|
-
*
|
|
4665
|
-
*
|
|
4666
|
-
*
|
|
4870
|
+
* name: 'event',
|
|
4871
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
4872
|
+
* requestPostData: {
|
|
4873
|
+
* st: 2,
|
|
4667
4874
|
* },
|
|
4668
|
-
*
|
|
4875
|
+
* });
|
|
4669
4876
|
* ```
|
|
4670
4877
|
* @param opts - options when checking the traffic network.
|
|
4671
4878
|
* @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.
|
|
@@ -4681,18 +4888,6 @@ declare namespace CodeceptJS {
|
|
|
4681
4888
|
requestPostData?: any;
|
|
4682
4889
|
timeout?: number;
|
|
4683
4890
|
}): Promise<any>;
|
|
4684
|
-
/**
|
|
4685
|
-
* Returns full URL of request matching parameter "urlMatch".
|
|
4686
|
-
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
4687
|
-
*
|
|
4688
|
-
* Examples:
|
|
4689
|
-
*
|
|
4690
|
-
* ```js
|
|
4691
|
-
* I.grabTrafficUrl('https://api.example.com/session');
|
|
4692
|
-
* I.grabTrafficUrl(/session.*start/);
|
|
4693
|
-
* ```
|
|
4694
|
-
*/
|
|
4695
|
-
grabTrafficUrl(urlMatch: string | RegExp): Promise<any>;
|
|
4696
4891
|
/**
|
|
4697
4892
|
* Verifies that a certain request is not part of network traffic.
|
|
4698
4893
|
*
|
|
@@ -7154,6 +7349,16 @@ declare namespace CodeceptJS {
|
|
|
7154
7349
|
* @param [name = null] - cookie name.
|
|
7155
7350
|
*/
|
|
7156
7351
|
grabCookie(name?: string): Promise<any>;
|
|
7352
|
+
/**
|
|
7353
|
+
* Waits for the specified cookie in the cookies.
|
|
7354
|
+
*
|
|
7355
|
+
* ```js
|
|
7356
|
+
* I.waitForCookie("token");
|
|
7357
|
+
* ```
|
|
7358
|
+
* @param name - expected cookie name.
|
|
7359
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
7360
|
+
*/
|
|
7361
|
+
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
7157
7362
|
/**
|
|
7158
7363
|
* Clears a cookie by name,
|
|
7159
7364
|
* if none provided clears all cookies.
|
|
@@ -7659,6 +7864,147 @@ declare namespace CodeceptJS {
|
|
|
7659
7864
|
* @returns Element bounding rectangle
|
|
7660
7865
|
*/
|
|
7661
7866
|
grabElementBoundingRect(locator: LocatorOrString, elementSize?: string): Promise<DOMRect> | Promise<number>;
|
|
7867
|
+
/**
|
|
7868
|
+
* Mocks network request using [`Request Interception`](https://pptr.dev/next/guides/request-interception)
|
|
7869
|
+
*
|
|
7870
|
+
* ```js
|
|
7871
|
+
* I.mockRoute(/(\.png$)|(\.jpg$)/, route => route.abort());
|
|
7872
|
+
* ```
|
|
7873
|
+
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://pptr.dev/next/guides/request-interception)
|
|
7874
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
7875
|
+
* @param [handler] - a function to process request
|
|
7876
|
+
*/
|
|
7877
|
+
mockRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
7878
|
+
/**
|
|
7879
|
+
* Stops network mocking created by `mockRoute`.
|
|
7880
|
+
*
|
|
7881
|
+
* ```js
|
|
7882
|
+
* I.stopMockingRoute(/(\.png$)|(\.jpg$)/);
|
|
7883
|
+
* ```
|
|
7884
|
+
* @param [url] - URL, regex or pattern for to match URL
|
|
7885
|
+
*/
|
|
7886
|
+
stopMockingRoute(url?: string | RegExp): Promise<any>;
|
|
7887
|
+
/**
|
|
7888
|
+
* Resets all recorded network requests.
|
|
7889
|
+
*
|
|
7890
|
+
* ```js
|
|
7891
|
+
* I.flushNetworkTraffics();
|
|
7892
|
+
* ```
|
|
7893
|
+
*/
|
|
7894
|
+
flushNetworkTraffics(): Promise<any>;
|
|
7895
|
+
/**
|
|
7896
|
+
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
7897
|
+
*
|
|
7898
|
+
* ```js
|
|
7899
|
+
* I.stopRecordingTraffic();
|
|
7900
|
+
* ```
|
|
7901
|
+
*/
|
|
7902
|
+
stopRecordingTraffic(): Promise<any>;
|
|
7903
|
+
/**
|
|
7904
|
+
* Starts recording the network traffics.
|
|
7905
|
+
* This also resets recorded network requests.
|
|
7906
|
+
*
|
|
7907
|
+
* ```js
|
|
7908
|
+
* I.startRecordingTraffic();
|
|
7909
|
+
* ```
|
|
7910
|
+
*/
|
|
7911
|
+
startRecordingTraffic(): Promise<any>;
|
|
7912
|
+
/**
|
|
7913
|
+
* Grab the recording network traffics
|
|
7914
|
+
*
|
|
7915
|
+
* ```js
|
|
7916
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
7917
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
7918
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
7919
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
7920
|
+
* ```
|
|
7921
|
+
*/
|
|
7922
|
+
grabRecordedNetworkTraffics(): Promise<any>;
|
|
7923
|
+
/**
|
|
7924
|
+
* Verifies that a certain request is part of network traffic.
|
|
7925
|
+
*
|
|
7926
|
+
* ```js
|
|
7927
|
+
* // checking the request url contains certain query strings
|
|
7928
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
7929
|
+
* I.startRecordingTraffic();
|
|
7930
|
+
* await I.seeTraffic({
|
|
7931
|
+
* name: 'sentry event',
|
|
7932
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
7933
|
+
* parameters: {
|
|
7934
|
+
* width: '1919',
|
|
7935
|
+
* height: '1138',
|
|
7936
|
+
* },
|
|
7937
|
+
* });
|
|
7938
|
+
* ```
|
|
7939
|
+
*
|
|
7940
|
+
* ```js
|
|
7941
|
+
* // checking the request url contains certain post data
|
|
7942
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
7943
|
+
* I.startRecordingTraffic();
|
|
7944
|
+
* await I.seeTraffic({
|
|
7945
|
+
* name: 'event',
|
|
7946
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
7947
|
+
* requestPostData: {
|
|
7948
|
+
* st: 2,
|
|
7949
|
+
* },
|
|
7950
|
+
* });
|
|
7951
|
+
* ```
|
|
7952
|
+
* @param opts - options when checking the traffic network.
|
|
7953
|
+
* @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.
|
|
7954
|
+
* @param opts.url - Expected URL of request in network traffic
|
|
7955
|
+
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
7956
|
+
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
7957
|
+
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
7958
|
+
*/
|
|
7959
|
+
seeTraffic(opts: {
|
|
7960
|
+
name: string;
|
|
7961
|
+
url: string;
|
|
7962
|
+
parameters?: any;
|
|
7963
|
+
requestPostData?: any;
|
|
7964
|
+
timeout?: number;
|
|
7965
|
+
}): Promise<any>;
|
|
7966
|
+
/**
|
|
7967
|
+
* Verifies that a certain request is not part of network traffic.
|
|
7968
|
+
*
|
|
7969
|
+
* Examples:
|
|
7970
|
+
*
|
|
7971
|
+
* ```js
|
|
7972
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
7973
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
7974
|
+
* ```
|
|
7975
|
+
* @param opts - options when checking the traffic network.
|
|
7976
|
+
* @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.
|
|
7977
|
+
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
7978
|
+
*/
|
|
7979
|
+
dontSeeTraffic(opts: {
|
|
7980
|
+
name: string;
|
|
7981
|
+
url: string | RegExp;
|
|
7982
|
+
}): Promise<any>;
|
|
7983
|
+
/**
|
|
7984
|
+
* Starts recording of websocket messages.
|
|
7985
|
+
* This also resets recorded websocket messages.
|
|
7986
|
+
*
|
|
7987
|
+
* ```js
|
|
7988
|
+
* await I.startRecordingWebSocketMessages();
|
|
7989
|
+
* ```
|
|
7990
|
+
*/
|
|
7991
|
+
startRecordingWebSocketMessages(): Promise<any>;
|
|
7992
|
+
/**
|
|
7993
|
+
* Stops recording WS messages. Recorded WS messages is not flashed.
|
|
7994
|
+
*
|
|
7995
|
+
* ```js
|
|
7996
|
+
* await I.stopRecordingWebSocketMessages();
|
|
7997
|
+
* ```
|
|
7998
|
+
*/
|
|
7999
|
+
stopRecordingWebSocketMessages(): Promise<any>;
|
|
8000
|
+
/**
|
|
8001
|
+
* Grab the recording WS messages
|
|
8002
|
+
*/
|
|
8003
|
+
grabWebSocketMessages(): Promise<any>;
|
|
8004
|
+
/**
|
|
8005
|
+
* Resets all recorded WS messages.
|
|
8006
|
+
*/
|
|
8007
|
+
flushWebSocketMessages(): Promise<any>;
|
|
7662
8008
|
}
|
|
7663
8009
|
/**
|
|
7664
8010
|
* REST helper allows to send additional requests to the REST API during acceptance tests.
|
|
@@ -10004,6 +10350,16 @@ declare namespace CodeceptJS {
|
|
|
10004
10350
|
* @param [name = null] - cookie name.
|
|
10005
10351
|
*/
|
|
10006
10352
|
grabCookie(name?: string): Promise<any>;
|
|
10353
|
+
/**
|
|
10354
|
+
* Waits for the specified cookie in the cookies.
|
|
10355
|
+
*
|
|
10356
|
+
* ```js
|
|
10357
|
+
* I.waitForCookie("token");
|
|
10358
|
+
* ```
|
|
10359
|
+
* @param name - expected cookie name.
|
|
10360
|
+
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
10361
|
+
*/
|
|
10362
|
+
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
10007
10363
|
/**
|
|
10008
10364
|
* Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
10009
10365
|
* Don't confuse popups with modal windows, as created by [various
|
|
@@ -10563,6 +10919,114 @@ declare namespace CodeceptJS {
|
|
|
10563
10919
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
10564
10920
|
*/
|
|
10565
10921
|
runInWeb(): Promise<any>;
|
|
10922
|
+
/**
|
|
10923
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10924
|
+
*
|
|
10925
|
+
* Resets all recorded network requests.
|
|
10926
|
+
*
|
|
10927
|
+
* ```js
|
|
10928
|
+
* I.flushNetworkTraffics();
|
|
10929
|
+
* ```
|
|
10930
|
+
*/
|
|
10931
|
+
flushNetworkTraffics(): Promise<any>;
|
|
10932
|
+
/**
|
|
10933
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10934
|
+
*
|
|
10935
|
+
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
10936
|
+
*
|
|
10937
|
+
* ```js
|
|
10938
|
+
* I.stopRecordingTraffic();
|
|
10939
|
+
* ```
|
|
10940
|
+
*/
|
|
10941
|
+
stopRecordingTraffic(): Promise<any>;
|
|
10942
|
+
/**
|
|
10943
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10944
|
+
*
|
|
10945
|
+
* Starts recording the network traffics.
|
|
10946
|
+
* This also resets recorded network requests.
|
|
10947
|
+
*
|
|
10948
|
+
* ```js
|
|
10949
|
+
* I.startRecordingTraffic();
|
|
10950
|
+
* ```
|
|
10951
|
+
*/
|
|
10952
|
+
startRecordingTraffic(): Promise<any>;
|
|
10953
|
+
/**
|
|
10954
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10955
|
+
*
|
|
10956
|
+
* Grab the recording network traffics
|
|
10957
|
+
*
|
|
10958
|
+
* ```js
|
|
10959
|
+
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
10960
|
+
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
10961
|
+
* expect(traffics[0].response.status).to.equal(200);
|
|
10962
|
+
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
10963
|
+
* ```
|
|
10964
|
+
*/
|
|
10965
|
+
grabRecordedNetworkTraffics(): Promise<any>;
|
|
10966
|
+
/**
|
|
10967
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10968
|
+
*
|
|
10969
|
+
* Verifies that a certain request is part of network traffic.
|
|
10970
|
+
*
|
|
10971
|
+
* ```js
|
|
10972
|
+
* // checking the request url contains certain query strings
|
|
10973
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
10974
|
+
* I.startRecordingTraffic();
|
|
10975
|
+
* await I.seeTraffic({
|
|
10976
|
+
* name: 'sentry event',
|
|
10977
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
10978
|
+
* parameters: {
|
|
10979
|
+
* width: '1919',
|
|
10980
|
+
* height: '1138',
|
|
10981
|
+
* },
|
|
10982
|
+
* });
|
|
10983
|
+
* ```
|
|
10984
|
+
*
|
|
10985
|
+
* ```js
|
|
10986
|
+
* // checking the request url contains certain post data
|
|
10987
|
+
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
10988
|
+
* I.startRecordingTraffic();
|
|
10989
|
+
* await I.seeTraffic({
|
|
10990
|
+
* name: 'event',
|
|
10991
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
10992
|
+
* requestPostData: {
|
|
10993
|
+
* st: 2,
|
|
10994
|
+
* },
|
|
10995
|
+
* });
|
|
10996
|
+
* ```
|
|
10997
|
+
* @param opts - options when checking the traffic network.
|
|
10998
|
+
* @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.
|
|
10999
|
+
* @param opts.url - Expected URL of request in network traffic
|
|
11000
|
+
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
11001
|
+
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
11002
|
+
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
11003
|
+
*/
|
|
11004
|
+
seeTraffic(opts: {
|
|
11005
|
+
name: string;
|
|
11006
|
+
url: string;
|
|
11007
|
+
parameters?: any;
|
|
11008
|
+
requestPostData?: any;
|
|
11009
|
+
timeout?: number;
|
|
11010
|
+
}): Promise<any>;
|
|
11011
|
+
/**
|
|
11012
|
+
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11013
|
+
*
|
|
11014
|
+
* Verifies that a certain request is not part of network traffic.
|
|
11015
|
+
*
|
|
11016
|
+
* Examples:
|
|
11017
|
+
*
|
|
11018
|
+
* ```js
|
|
11019
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
11020
|
+
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
11021
|
+
* ```
|
|
11022
|
+
* @param opts - options when checking the traffic network.
|
|
11023
|
+
* @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.
|
|
11024
|
+
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
11025
|
+
*/
|
|
11026
|
+
dontSeeTraffic(opts: {
|
|
11027
|
+
name: string;
|
|
11028
|
+
url: string | RegExp;
|
|
11029
|
+
}): Promise<any>;
|
|
10566
11030
|
}
|
|
10567
11031
|
}
|
|
10568
11032
|
|