codeceptjs 3.5.14 → 3.6.0-beta.1.ai-healers
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 +66 -30
- package/docs/advanced.md +351 -0
- package/docs/ai.md +365 -0
- package/docs/api.md +323 -0
- package/docs/basics.md +979 -0
- package/docs/bdd.md +539 -0
- package/docs/best.md +237 -0
- package/docs/books.md +37 -0
- package/docs/bootstrap.md +135 -0
- package/docs/build/AI.js +124 -0
- package/docs/build/ApiDataFactory.js +410 -0
- package/docs/build/Appium.js +2027 -0
- package/docs/build/Expect.js +422 -0
- package/docs/build/FileSystem.js +228 -0
- package/docs/build/GraphQL.js +229 -0
- package/docs/build/GraphQLDataFactory.js +309 -0
- package/docs/build/JSONResponse.js +338 -0
- package/docs/build/Mochawesome.js +71 -0
- package/docs/build/Nightmare.js +2152 -0
- package/docs/build/Playwright.js +5110 -0
- package/docs/build/Protractor.js +2706 -0
- package/docs/build/Puppeteer.js +3905 -0
- package/docs/build/REST.js +344 -0
- package/docs/build/TestCafe.js +2125 -0
- package/docs/build/WebDriver.js +4240 -0
- package/docs/changelog.md +2572 -0
- package/docs/commands.md +266 -0
- package/docs/community-helpers.md +58 -0
- package/docs/configuration.md +157 -0
- package/docs/continuous-integration.md +22 -0
- package/docs/custom-helpers.md +306 -0
- package/docs/data.md +379 -0
- package/docs/detox.md +235 -0
- package/docs/docker.md +136 -0
- package/docs/email.md +183 -0
- package/docs/examples.md +149 -0
- package/docs/heal.md +186 -0
- package/docs/helpers/ApiDataFactory.md +266 -0
- package/docs/helpers/Appium.md +1374 -0
- package/docs/helpers/Detox.md +586 -0
- package/docs/helpers/Expect.md +275 -0
- package/docs/helpers/FileSystem.md +152 -0
- package/docs/helpers/GraphQL.md +151 -0
- package/docs/helpers/GraphQLDataFactory.md +226 -0
- package/docs/helpers/JSONResponse.md +254 -0
- package/docs/helpers/Mochawesome.md +8 -0
- package/docs/helpers/MockRequest.md +377 -0
- package/docs/helpers/Nightmare.md +1305 -0
- package/docs/helpers/OpenAI.md +70 -0
- package/docs/helpers/Playwright.md +2759 -0
- package/docs/helpers/Polly.md +44 -0
- package/docs/helpers/Protractor.md +1769 -0
- package/docs/helpers/Puppeteer-firefox.md +86 -0
- package/docs/helpers/Puppeteer.md +2317 -0
- package/docs/helpers/REST.md +218 -0
- package/docs/helpers/TestCafe.md +1321 -0
- package/docs/helpers/WebDriver.md +2547 -0
- package/docs/hooks.md +340 -0
- package/docs/index.md +111 -0
- package/docs/installation.md +75 -0
- package/docs/internal-api.md +266 -0
- package/docs/locators.md +339 -0
- package/docs/mobile-react-native-locators.md +67 -0
- package/docs/mobile.md +338 -0
- package/docs/pageobjects.md +291 -0
- package/docs/parallel.md +400 -0
- package/docs/playwright.md +632 -0
- package/docs/plugins.md +1247 -0
- package/docs/puppeteer.md +316 -0
- package/docs/quickstart.md +162 -0
- package/docs/react.md +70 -0
- package/docs/reports.md +392 -0
- package/docs/secrets.md +36 -0
- package/docs/shadow.md +68 -0
- package/docs/shared/keys.mustache +31 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +174 -0
- package/docs/translation.md +247 -0
- package/docs/tutorial.md +271 -0
- package/docs/typescript.md +180 -0
- package/docs/ui.md +59 -0
- package/docs/videos.md +28 -0
- package/docs/visual.md +202 -0
- package/docs/vue.md +143 -0
- package/docs/webdriver.md +701 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +53 -0
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +61 -0
- package/docs/wiki/Examples.md +145 -0
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +68 -0
- package/docs/wiki/Home.md +16 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
- package/docs/wiki/Release-Process.md +24 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Tests.md +1393 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +153 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/actor.js +3 -6
- package/lib/ai.js +152 -80
- package/lib/cli.js +1 -0
- package/lib/command/generate.js +34 -0
- package/lib/command/run-workers.js +3 -0
- package/lib/command/run.js +3 -0
- package/lib/container.js +2 -0
- package/lib/heal.js +172 -0
- package/lib/helper/AI.js +124 -0
- package/lib/helper/Appium.js +12 -36
- package/lib/helper/Expect.js +7 -10
- package/lib/helper/JSONResponse.js +8 -8
- package/lib/helper/Playwright.js +240 -100
- package/lib/helper/Puppeteer.js +9 -61
- package/lib/helper/REST.js +1 -4
- package/lib/helper/WebDriver.js +10 -324
- package/lib/index.js +3 -0
- package/lib/listener/steps.js +0 -2
- package/lib/locator.js +4 -13
- package/lib/plugin/heal.js +26 -117
- package/lib/recorder.js +11 -5
- package/lib/step.js +1 -3
- package/lib/store.js +2 -0
- package/lib/template/heal.js +39 -0
- package/package.json +23 -27
- package/typings/index.d.ts +0 -16
- package/typings/promiseBasedTypes.d.ts +55 -338
- package/typings/types.d.ts +58 -353
- package/docs/webapi/dontSeeTraffic.mustache +0 -13
- package/docs/webapi/flushNetworkTraffics.mustache +0 -5
- package/docs/webapi/grabRecordedNetworkTraffics.mustache +0 -10
- package/docs/webapi/seeTraffic.mustache +0 -36
- package/docs/webapi/startRecordingTraffic.mustache +0 -8
- package/docs/webapi/stopRecordingTraffic.mustache +0 -5
- package/docs/webapi/waitForCookie.mustache +0 -9
- package/lib/helper/MockServer.js +0 -221
- package/lib/helper/errors/ElementAssertion.js +0 -38
- package/lib/helper/networkTraffics/utils.js +0 -137
- /package/{lib/helper → docs/build}/OpenAI.js +0 -0
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
declare namespace CodeceptJS {
|
|
2
|
+
/**
|
|
3
|
+
* AI Helper for CodeceptJS.
|
|
4
|
+
*
|
|
5
|
+
* This helper class provides integration with the AI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
|
|
6
|
+
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
7
|
+
*
|
|
8
|
+
* ## Configuration
|
|
9
|
+
*
|
|
10
|
+
* This helper should be configured in codecept.json or codecept.conf.js
|
|
11
|
+
*
|
|
12
|
+
* * `chunkSize`: (optional, default: 80000) - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.
|
|
13
|
+
*/
|
|
14
|
+
class AITs {
|
|
15
|
+
/**
|
|
16
|
+
* Asks the AI GPT language model a question based on the provided prompt within the context of the current page's HTML.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* I.askGptOnPage('what does this page do?');
|
|
20
|
+
* ```
|
|
21
|
+
* @param prompt - The question or prompt to ask the GPT model.
|
|
22
|
+
* @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
|
|
23
|
+
*/
|
|
24
|
+
askGptOnPage(prompt: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Asks the AI a question based on the provided prompt within the context of a specific HTML fragment on the current page.
|
|
27
|
+
*
|
|
28
|
+
* ```js
|
|
29
|
+
* I.askGptOnPageFragment('describe features of this screen', '.screen');
|
|
30
|
+
* ```
|
|
31
|
+
* @param prompt - The question or prompt to ask the GPT-3.5 model.
|
|
32
|
+
* @param locator - The locator or selector used to identify the HTML fragment on the page.
|
|
33
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
34
|
+
*/
|
|
35
|
+
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Send a general request to ChatGPT and return response.
|
|
38
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
39
|
+
*/
|
|
40
|
+
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
41
|
+
}
|
|
2
42
|
/**
|
|
3
43
|
* Helper for managing remote data using REST API.
|
|
4
44
|
* Uses data generators like [rosie](https://github.com/rosiejs/rosie) or factory girl to create new record.
|
|
@@ -1732,188 +1772,6 @@ declare namespace CodeceptJS {
|
|
|
1732
1772
|
*/
|
|
1733
1773
|
seeResponseMatchesJsonSchema(fnOrSchema: any): Promise<any>;
|
|
1734
1774
|
}
|
|
1735
|
-
/**
|
|
1736
|
-
* ## Configuration
|
|
1737
|
-
*
|
|
1738
|
-
* This helper should be configured in codecept.conf.(js|ts)
|
|
1739
|
-
* @property [port = 9393] - Mock server port
|
|
1740
|
-
* @property [host = "0.0.0.0"] - Mock server host
|
|
1741
|
-
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1742
|
-
*/
|
|
1743
|
-
type MockServerConfig = {
|
|
1744
|
-
port?: number;
|
|
1745
|
-
host?: string;
|
|
1746
|
-
httpsOpts?: any;
|
|
1747
|
-
};
|
|
1748
|
-
/**
|
|
1749
|
-
* MockServer
|
|
1750
|
-
*
|
|
1751
|
-
* 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.
|
|
1752
|
-
*
|
|
1753
|
-
* <!-- configuration -->
|
|
1754
|
-
*
|
|
1755
|
-
* #### Examples
|
|
1756
|
-
*
|
|
1757
|
-
* You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
|
|
1758
|
-
*
|
|
1759
|
-
* ```javascript
|
|
1760
|
-
* {
|
|
1761
|
-
* helpers: {
|
|
1762
|
-
* REST: {...},
|
|
1763
|
-
* MockServer: {
|
|
1764
|
-
* // default mock server config
|
|
1765
|
-
* port: 9393,
|
|
1766
|
-
* host: '0.0.0.0',
|
|
1767
|
-
* httpsOpts: {
|
|
1768
|
-
* key: '',
|
|
1769
|
-
* cert: '',
|
|
1770
|
-
* },
|
|
1771
|
-
* },
|
|
1772
|
-
* }
|
|
1773
|
-
* }
|
|
1774
|
-
* ```
|
|
1775
|
-
*
|
|
1776
|
-
* #### Adding Interactions
|
|
1777
|
-
*
|
|
1778
|
-
* 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.
|
|
1779
|
-
*
|
|
1780
|
-
* ```javascript
|
|
1781
|
-
* I.addInteractionToMockServer({
|
|
1782
|
-
* request: {
|
|
1783
|
-
* method: 'GET',
|
|
1784
|
-
* path: '/api/hello'
|
|
1785
|
-
* },
|
|
1786
|
-
* response: {
|
|
1787
|
-
* status: 200,
|
|
1788
|
-
* body: {
|
|
1789
|
-
* 'say': 'hello to mock server'
|
|
1790
|
-
* }
|
|
1791
|
-
* }
|
|
1792
|
-
* });
|
|
1793
|
-
* ```
|
|
1794
|
-
*
|
|
1795
|
-
* #### Request Matching
|
|
1796
|
-
*
|
|
1797
|
-
* 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.
|
|
1798
|
-
*
|
|
1799
|
-
* - Strong match on HTTP Method, Path, Query Params & JSON body.
|
|
1800
|
-
* - Loose match on Headers.
|
|
1801
|
-
*
|
|
1802
|
-
* ##### Strong Match on Query Params
|
|
1803
|
-
*
|
|
1804
|
-
* You can send different responses based on query parameters:
|
|
1805
|
-
*
|
|
1806
|
-
* ```javascript
|
|
1807
|
-
* I.addInteractionToMockServer({
|
|
1808
|
-
* request: {
|
|
1809
|
-
* method: 'GET',
|
|
1810
|
-
* path: '/api/users',
|
|
1811
|
-
* queryParams: {
|
|
1812
|
-
* id: 1
|
|
1813
|
-
* }
|
|
1814
|
-
* },
|
|
1815
|
-
* response: {
|
|
1816
|
-
* status: 200,
|
|
1817
|
-
* body: 'user 1'
|
|
1818
|
-
* }
|
|
1819
|
-
* });
|
|
1820
|
-
*
|
|
1821
|
-
* I.addInteractionToMockServer({
|
|
1822
|
-
* request: {
|
|
1823
|
-
* method: 'GET',
|
|
1824
|
-
* path: '/api/users',
|
|
1825
|
-
* queryParams: {
|
|
1826
|
-
* id: 2
|
|
1827
|
-
* }
|
|
1828
|
-
* },
|
|
1829
|
-
* response: {
|
|
1830
|
-
* status: 200,
|
|
1831
|
-
* body: 'user 2'
|
|
1832
|
-
* }
|
|
1833
|
-
* });
|
|
1834
|
-
* ```
|
|
1835
|
-
*
|
|
1836
|
-
* - GET to `/api/users?id=1` will return 'user 1'.
|
|
1837
|
-
* - GET to `/api/users?id=2` will return 'user 2'.
|
|
1838
|
-
* - For all other requests, it returns a 404 status code.
|
|
1839
|
-
*
|
|
1840
|
-
* ##### Loose Match on Body
|
|
1841
|
-
*
|
|
1842
|
-
* When `strict` is set to false, it performs a loose match on query params and response body:
|
|
1843
|
-
*
|
|
1844
|
-
* ```javascript
|
|
1845
|
-
* I.addInteractionToMockServer({
|
|
1846
|
-
* strict: false,
|
|
1847
|
-
* request: {
|
|
1848
|
-
* method: 'POST',
|
|
1849
|
-
* path: '/api/users',
|
|
1850
|
-
* body: {
|
|
1851
|
-
* name: 'john'
|
|
1852
|
-
* }
|
|
1853
|
-
* },
|
|
1854
|
-
* response: {
|
|
1855
|
-
* status: 200
|
|
1856
|
-
* }
|
|
1857
|
-
* });
|
|
1858
|
-
* ```
|
|
1859
|
-
*
|
|
1860
|
-
* - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
|
|
1861
|
-
* - POST to `/api/users` without the `name` property in the body will return a 404 status code.
|
|
1862
|
-
*
|
|
1863
|
-
* Happy testing with MockServer in CodeceptJS! 🚀
|
|
1864
|
-
*
|
|
1865
|
-
* ## Methods
|
|
1866
|
-
*/
|
|
1867
|
-
class MockServer {
|
|
1868
|
-
/**
|
|
1869
|
-
* Start the mock server
|
|
1870
|
-
* @param [port] - start the mock server with given port
|
|
1871
|
-
*/
|
|
1872
|
-
startMockServer(port?: number): Promise<any>;
|
|
1873
|
-
/**
|
|
1874
|
-
* Stop the mock server
|
|
1875
|
-
*/
|
|
1876
|
-
stopMockServer(): Promise<any>;
|
|
1877
|
-
/**
|
|
1878
|
-
* An interaction adds behavior to the mock server
|
|
1879
|
-
*
|
|
1880
|
-
*
|
|
1881
|
-
* ```js
|
|
1882
|
-
* I.addInteractionToMockServer({
|
|
1883
|
-
* request: {
|
|
1884
|
-
* method: 'GET',
|
|
1885
|
-
* path: '/api/hello'
|
|
1886
|
-
* },
|
|
1887
|
-
* response: {
|
|
1888
|
-
* status: 200,
|
|
1889
|
-
* body: {
|
|
1890
|
-
* 'say': 'hello to mock server'
|
|
1891
|
-
* }
|
|
1892
|
-
* }
|
|
1893
|
-
* });
|
|
1894
|
-
* ```
|
|
1895
|
-
* ```js
|
|
1896
|
-
* // with query params
|
|
1897
|
-
* I.addInteractionToMockServer({
|
|
1898
|
-
* request: {
|
|
1899
|
-
* method: 'GET',
|
|
1900
|
-
* path: '/api/hello',
|
|
1901
|
-
* queryParams: {
|
|
1902
|
-
* id: 2
|
|
1903
|
-
* }
|
|
1904
|
-
* },
|
|
1905
|
-
* response: {
|
|
1906
|
-
* status: 200,
|
|
1907
|
-
* body: {
|
|
1908
|
-
* 'say': 'hello to mock server'
|
|
1909
|
-
* }
|
|
1910
|
-
* }
|
|
1911
|
-
* });
|
|
1912
|
-
* ```
|
|
1913
|
-
* @param interaction - add behavior to the mock server
|
|
1914
|
-
*/
|
|
1915
|
-
addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): Promise<any>;
|
|
1916
|
-
}
|
|
1917
1775
|
/**
|
|
1918
1776
|
* Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
|
|
1919
1777
|
* fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -4646,16 +4504,6 @@ declare namespace CodeceptJS {
|
|
|
4646
4504
|
* @param [sec = 1] - (optional, `1` by default) time in seconds to wait
|
|
4647
4505
|
*/
|
|
4648
4506
|
waitForDetached(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4649
|
-
/**
|
|
4650
|
-
* Waits for the specified cookie in the cookies.
|
|
4651
|
-
*
|
|
4652
|
-
* ```js
|
|
4653
|
-
* I.waitForCookie("token");
|
|
4654
|
-
* ```
|
|
4655
|
-
* @param name - expected cookie name.
|
|
4656
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
4657
|
-
*/
|
|
4658
|
-
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
4659
4507
|
/**
|
|
4660
4508
|
* Grab the data from performance timing using Navigation Timing API.
|
|
4661
4509
|
* The returned data will contain following things in ms:
|
|
@@ -4725,10 +4573,11 @@ declare namespace CodeceptJS {
|
|
|
4725
4573
|
*/
|
|
4726
4574
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
4727
4575
|
/**
|
|
4728
|
-
*
|
|
4576
|
+
* Starts recording the network traffics.
|
|
4577
|
+
* This also resets recorded network requests.
|
|
4729
4578
|
*
|
|
4730
4579
|
* ```js
|
|
4731
|
-
* I.
|
|
4580
|
+
* I.startRecordingTraffic();
|
|
4732
4581
|
* ```
|
|
4733
4582
|
*/
|
|
4734
4583
|
startRecordingTraffic(): Promise<any>;
|
|
@@ -4742,7 +4591,7 @@ declare namespace CodeceptJS {
|
|
|
4742
4591
|
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4743
4592
|
* ```
|
|
4744
4593
|
*/
|
|
4745
|
-
grabRecordedNetworkTraffics(): Promise<any>;
|
|
4594
|
+
grabRecordedNetworkTraffics(): Promise<any[]>;
|
|
4746
4595
|
/**
|
|
4747
4596
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4748
4597
|
*
|
|
@@ -4779,10 +4628,6 @@ declare namespace CodeceptJS {
|
|
|
4779
4628
|
mockTraffic(urls: any, responseString: any, contentType?: any): Promise<any>;
|
|
4780
4629
|
/**
|
|
4781
4630
|
* Resets all recorded network requests.
|
|
4782
|
-
*
|
|
4783
|
-
* ```js
|
|
4784
|
-
* I.flushNetworkTraffics();
|
|
4785
|
-
* ```
|
|
4786
4631
|
*/
|
|
4787
4632
|
flushNetworkTraffics(): Promise<any>;
|
|
4788
4633
|
/**
|
|
@@ -4801,13 +4646,13 @@ declare namespace CodeceptJS {
|
|
|
4801
4646
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4802
4647
|
* I.startRecordingTraffic();
|
|
4803
4648
|
* await I.seeTraffic({
|
|
4804
|
-
*
|
|
4805
|
-
*
|
|
4806
|
-
*
|
|
4807
|
-
*
|
|
4808
|
-
*
|
|
4649
|
+
* name: 'sentry event',
|
|
4650
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
4651
|
+
* parameters: {
|
|
4652
|
+
* width: '1919',
|
|
4653
|
+
* height: '1138',
|
|
4809
4654
|
* },
|
|
4810
|
-
*
|
|
4655
|
+
* });
|
|
4811
4656
|
* ```
|
|
4812
4657
|
*
|
|
4813
4658
|
* ```js
|
|
@@ -4815,12 +4660,12 @@ declare namespace CodeceptJS {
|
|
|
4815
4660
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4816
4661
|
* I.startRecordingTraffic();
|
|
4817
4662
|
* await I.seeTraffic({
|
|
4818
|
-
*
|
|
4819
|
-
*
|
|
4820
|
-
*
|
|
4821
|
-
*
|
|
4663
|
+
* name: 'event',
|
|
4664
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
4665
|
+
* requestPostData: {
|
|
4666
|
+
* st: 2,
|
|
4822
4667
|
* },
|
|
4823
|
-
*
|
|
4668
|
+
* });
|
|
4824
4669
|
* ```
|
|
4825
4670
|
* @param opts - options when checking the traffic network.
|
|
4826
4671
|
* @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.
|
|
@@ -7309,16 +7154,6 @@ declare namespace CodeceptJS {
|
|
|
7309
7154
|
* @param [name = null] - cookie name.
|
|
7310
7155
|
*/
|
|
7311
7156
|
grabCookie(name?: string): Promise<any>;
|
|
7312
|
-
/**
|
|
7313
|
-
* Waits for the specified cookie in the cookies.
|
|
7314
|
-
*
|
|
7315
|
-
* ```js
|
|
7316
|
-
* I.waitForCookie("token");
|
|
7317
|
-
* ```
|
|
7318
|
-
* @param name - expected cookie name.
|
|
7319
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
7320
|
-
*/
|
|
7321
|
-
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
7322
7157
|
/**
|
|
7323
7158
|
* Clears a cookie by name,
|
|
7324
7159
|
* if none provided clears all cookies.
|
|
@@ -10169,16 +10004,6 @@ declare namespace CodeceptJS {
|
|
|
10169
10004
|
* @param [name = null] - cookie name.
|
|
10170
10005
|
*/
|
|
10171
10006
|
grabCookie(name?: string): Promise<any>;
|
|
10172
|
-
/**
|
|
10173
|
-
* Waits for the specified cookie in the cookies.
|
|
10174
|
-
*
|
|
10175
|
-
* ```js
|
|
10176
|
-
* I.waitForCookie("token");
|
|
10177
|
-
* ```
|
|
10178
|
-
* @param name - expected cookie name.
|
|
10179
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
10180
|
-
*/
|
|
10181
|
-
waitForCookie(name: string, sec?: number): Promise<any>;
|
|
10182
10007
|
/**
|
|
10183
10008
|
* Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
10184
10009
|
* Don't confuse popups with modal windows, as created by [various
|
|
@@ -10738,114 +10563,6 @@ declare namespace CodeceptJS {
|
|
|
10738
10563
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
10739
10564
|
*/
|
|
10740
10565
|
runInWeb(): Promise<any>;
|
|
10741
|
-
/**
|
|
10742
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10743
|
-
*
|
|
10744
|
-
* Resets all recorded network requests.
|
|
10745
|
-
*
|
|
10746
|
-
* ```js
|
|
10747
|
-
* I.flushNetworkTraffics();
|
|
10748
|
-
* ```
|
|
10749
|
-
*/
|
|
10750
|
-
flushNetworkTraffics(): Promise<any>;
|
|
10751
|
-
/**
|
|
10752
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10753
|
-
*
|
|
10754
|
-
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
10755
|
-
*
|
|
10756
|
-
* ```js
|
|
10757
|
-
* I.stopRecordingTraffic();
|
|
10758
|
-
* ```
|
|
10759
|
-
*/
|
|
10760
|
-
stopRecordingTraffic(): Promise<any>;
|
|
10761
|
-
/**
|
|
10762
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10763
|
-
*
|
|
10764
|
-
* Starts recording the network traffics.
|
|
10765
|
-
* This also resets recorded network requests.
|
|
10766
|
-
*
|
|
10767
|
-
* ```js
|
|
10768
|
-
* I.startRecordingTraffic();
|
|
10769
|
-
* ```
|
|
10770
|
-
*/
|
|
10771
|
-
startRecordingTraffic(): Promise<any>;
|
|
10772
|
-
/**
|
|
10773
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10774
|
-
*
|
|
10775
|
-
* Grab the recording network traffics
|
|
10776
|
-
*
|
|
10777
|
-
* ```js
|
|
10778
|
-
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
10779
|
-
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
10780
|
-
* expect(traffics[0].response.status).to.equal(200);
|
|
10781
|
-
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
10782
|
-
* ```
|
|
10783
|
-
*/
|
|
10784
|
-
grabRecordedNetworkTraffics(): Promise<any>;
|
|
10785
|
-
/**
|
|
10786
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10787
|
-
*
|
|
10788
|
-
* Verifies that a certain request is part of network traffic.
|
|
10789
|
-
*
|
|
10790
|
-
* ```js
|
|
10791
|
-
* // checking the request url contains certain query strings
|
|
10792
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
10793
|
-
* I.startRecordingTraffic();
|
|
10794
|
-
* await I.seeTraffic({
|
|
10795
|
-
* name: 'sentry event',
|
|
10796
|
-
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
10797
|
-
* parameters: {
|
|
10798
|
-
* width: '1919',
|
|
10799
|
-
* height: '1138',
|
|
10800
|
-
* },
|
|
10801
|
-
* });
|
|
10802
|
-
* ```
|
|
10803
|
-
*
|
|
10804
|
-
* ```js
|
|
10805
|
-
* // checking the request url contains certain post data
|
|
10806
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
10807
|
-
* I.startRecordingTraffic();
|
|
10808
|
-
* await I.seeTraffic({
|
|
10809
|
-
* name: 'event',
|
|
10810
|
-
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
10811
|
-
* requestPostData: {
|
|
10812
|
-
* st: 2,
|
|
10813
|
-
* },
|
|
10814
|
-
* });
|
|
10815
|
-
* ```
|
|
10816
|
-
* @param opts - options when checking the traffic network.
|
|
10817
|
-
* @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.
|
|
10818
|
-
* @param opts.url - Expected URL of request in network traffic
|
|
10819
|
-
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
10820
|
-
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
10821
|
-
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
10822
|
-
*/
|
|
10823
|
-
seeTraffic(opts: {
|
|
10824
|
-
name: string;
|
|
10825
|
-
url: string;
|
|
10826
|
-
parameters?: any;
|
|
10827
|
-
requestPostData?: any;
|
|
10828
|
-
timeout?: number;
|
|
10829
|
-
}): Promise<any>;
|
|
10830
|
-
/**
|
|
10831
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
10832
|
-
*
|
|
10833
|
-
* Verifies that a certain request is not part of network traffic.
|
|
10834
|
-
*
|
|
10835
|
-
* Examples:
|
|
10836
|
-
*
|
|
10837
|
-
* ```js
|
|
10838
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
10839
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
10840
|
-
* ```
|
|
10841
|
-
* @param opts - options when checking the traffic network.
|
|
10842
|
-
* @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.
|
|
10843
|
-
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
10844
|
-
*/
|
|
10845
|
-
dontSeeTraffic(opts: {
|
|
10846
|
-
name: string;
|
|
10847
|
-
url: string | RegExp;
|
|
10848
|
-
}): Promise<any>;
|
|
10849
10566
|
}
|
|
10850
10567
|
}
|
|
10851
10568
|
|