codeceptjs 3.5.15 → 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/dryRun.js +13 -44
- 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 +8 -11
- package/lib/helper/JSONResponse.js +8 -8
- package/lib/helper/Playwright.js +240 -100
- package/lib/helper/Puppeteer.js +68 -182
- 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/coverage.js +99 -112
- 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 +35 -47
- package/typings/index.d.ts +0 -17
- package/typings/promiseBasedTypes.d.ts +57 -340
- package/typings/types.d.ts +73 -433
- 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
package/typings/types.d.ts
CHANGED
|
@@ -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 AI {
|
|
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.
|
|
@@ -1151,9 +1191,9 @@ declare namespace CodeceptJS {
|
|
|
1151
1191
|
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1152
1192
|
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1153
1193
|
/**
|
|
1154
|
-
* @param
|
|
1194
|
+
* @param ajvOptions - Pass AJV options
|
|
1155
1195
|
*/
|
|
1156
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions
|
|
1196
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions: any): void;
|
|
1157
1197
|
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1158
1198
|
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1159
1199
|
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
@@ -1759,191 +1799,6 @@ declare namespace CodeceptJS {
|
|
|
1759
1799
|
*/
|
|
1760
1800
|
seeResponseMatchesJsonSchema(fnOrSchema: any): void;
|
|
1761
1801
|
}
|
|
1762
|
-
/**
|
|
1763
|
-
* ## Configuration
|
|
1764
|
-
*
|
|
1765
|
-
* This helper should be configured in codecept.conf.(js|ts)
|
|
1766
|
-
* @property [port = 9393] - Mock server port
|
|
1767
|
-
* @property [host = "0.0.0.0"] - Mock server host
|
|
1768
|
-
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1769
|
-
*/
|
|
1770
|
-
type MockServerConfig = {
|
|
1771
|
-
port?: number;
|
|
1772
|
-
host?: string;
|
|
1773
|
-
httpsOpts?: any;
|
|
1774
|
-
};
|
|
1775
|
-
/**
|
|
1776
|
-
* MockServer
|
|
1777
|
-
*
|
|
1778
|
-
* 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.
|
|
1779
|
-
*
|
|
1780
|
-
* <!-- configuration -->
|
|
1781
|
-
*
|
|
1782
|
-
* #### Examples
|
|
1783
|
-
*
|
|
1784
|
-
* You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
|
|
1785
|
-
*
|
|
1786
|
-
* ```javascript
|
|
1787
|
-
* {
|
|
1788
|
-
* helpers: {
|
|
1789
|
-
* REST: {...},
|
|
1790
|
-
* MockServer: {
|
|
1791
|
-
* // default mock server config
|
|
1792
|
-
* port: 9393,
|
|
1793
|
-
* host: '0.0.0.0',
|
|
1794
|
-
* httpsOpts: {
|
|
1795
|
-
* key: '',
|
|
1796
|
-
* cert: '',
|
|
1797
|
-
* },
|
|
1798
|
-
* },
|
|
1799
|
-
* }
|
|
1800
|
-
* }
|
|
1801
|
-
* ```
|
|
1802
|
-
*
|
|
1803
|
-
* #### Adding Interactions
|
|
1804
|
-
*
|
|
1805
|
-
* 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.
|
|
1806
|
-
*
|
|
1807
|
-
* ```javascript
|
|
1808
|
-
* I.addInteractionToMockServer({
|
|
1809
|
-
* request: {
|
|
1810
|
-
* method: 'GET',
|
|
1811
|
-
* path: '/api/hello'
|
|
1812
|
-
* },
|
|
1813
|
-
* response: {
|
|
1814
|
-
* status: 200,
|
|
1815
|
-
* body: {
|
|
1816
|
-
* 'say': 'hello to mock server'
|
|
1817
|
-
* }
|
|
1818
|
-
* }
|
|
1819
|
-
* });
|
|
1820
|
-
* ```
|
|
1821
|
-
*
|
|
1822
|
-
* #### Request Matching
|
|
1823
|
-
*
|
|
1824
|
-
* 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.
|
|
1825
|
-
*
|
|
1826
|
-
* - Strong match on HTTP Method, Path, Query Params & JSON body.
|
|
1827
|
-
* - Loose match on Headers.
|
|
1828
|
-
*
|
|
1829
|
-
* ##### Strong Match on Query Params
|
|
1830
|
-
*
|
|
1831
|
-
* You can send different responses based on query parameters:
|
|
1832
|
-
*
|
|
1833
|
-
* ```javascript
|
|
1834
|
-
* I.addInteractionToMockServer({
|
|
1835
|
-
* request: {
|
|
1836
|
-
* method: 'GET',
|
|
1837
|
-
* path: '/api/users',
|
|
1838
|
-
* queryParams: {
|
|
1839
|
-
* id: 1
|
|
1840
|
-
* }
|
|
1841
|
-
* },
|
|
1842
|
-
* response: {
|
|
1843
|
-
* status: 200,
|
|
1844
|
-
* body: 'user 1'
|
|
1845
|
-
* }
|
|
1846
|
-
* });
|
|
1847
|
-
*
|
|
1848
|
-
* I.addInteractionToMockServer({
|
|
1849
|
-
* request: {
|
|
1850
|
-
* method: 'GET',
|
|
1851
|
-
* path: '/api/users',
|
|
1852
|
-
* queryParams: {
|
|
1853
|
-
* id: 2
|
|
1854
|
-
* }
|
|
1855
|
-
* },
|
|
1856
|
-
* response: {
|
|
1857
|
-
* status: 200,
|
|
1858
|
-
* body: 'user 2'
|
|
1859
|
-
* }
|
|
1860
|
-
* });
|
|
1861
|
-
* ```
|
|
1862
|
-
*
|
|
1863
|
-
* - GET to `/api/users?id=1` will return 'user 1'.
|
|
1864
|
-
* - GET to `/api/users?id=2` will return 'user 2'.
|
|
1865
|
-
* - For all other requests, it returns a 404 status code.
|
|
1866
|
-
*
|
|
1867
|
-
* ##### Loose Match on Body
|
|
1868
|
-
*
|
|
1869
|
-
* When `strict` is set to false, it performs a loose match on query params and response body:
|
|
1870
|
-
*
|
|
1871
|
-
* ```javascript
|
|
1872
|
-
* I.addInteractionToMockServer({
|
|
1873
|
-
* strict: false,
|
|
1874
|
-
* request: {
|
|
1875
|
-
* method: 'POST',
|
|
1876
|
-
* path: '/api/users',
|
|
1877
|
-
* body: {
|
|
1878
|
-
* name: 'john'
|
|
1879
|
-
* }
|
|
1880
|
-
* },
|
|
1881
|
-
* response: {
|
|
1882
|
-
* status: 200
|
|
1883
|
-
* }
|
|
1884
|
-
* });
|
|
1885
|
-
* ```
|
|
1886
|
-
*
|
|
1887
|
-
* - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
|
|
1888
|
-
* - POST to `/api/users` without the `name` property in the body will return a 404 status code.
|
|
1889
|
-
*
|
|
1890
|
-
* Happy testing with MockServer in CodeceptJS! 🚀
|
|
1891
|
-
*
|
|
1892
|
-
* ## Methods
|
|
1893
|
-
*/
|
|
1894
|
-
class MockServer {
|
|
1895
|
-
/**
|
|
1896
|
-
* Start the mock server
|
|
1897
|
-
* @param [port] - start the mock server with given port
|
|
1898
|
-
* @returns void
|
|
1899
|
-
*/
|
|
1900
|
-
startMockServer(port?: number): any;
|
|
1901
|
-
/**
|
|
1902
|
-
* Stop the mock server
|
|
1903
|
-
* @returns void
|
|
1904
|
-
*/
|
|
1905
|
-
stopMockServer(): any;
|
|
1906
|
-
/**
|
|
1907
|
-
* An interaction adds behavior to the mock server
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
* ```js
|
|
1911
|
-
* I.addInteractionToMockServer({
|
|
1912
|
-
* request: {
|
|
1913
|
-
* method: 'GET',
|
|
1914
|
-
* path: '/api/hello'
|
|
1915
|
-
* },
|
|
1916
|
-
* response: {
|
|
1917
|
-
* status: 200,
|
|
1918
|
-
* body: {
|
|
1919
|
-
* 'say': 'hello to mock server'
|
|
1920
|
-
* }
|
|
1921
|
-
* }
|
|
1922
|
-
* });
|
|
1923
|
-
* ```
|
|
1924
|
-
* ```js
|
|
1925
|
-
* // with query params
|
|
1926
|
-
* I.addInteractionToMockServer({
|
|
1927
|
-
* request: {
|
|
1928
|
-
* method: 'GET',
|
|
1929
|
-
* path: '/api/hello',
|
|
1930
|
-
* queryParams: {
|
|
1931
|
-
* id: 2
|
|
1932
|
-
* }
|
|
1933
|
-
* },
|
|
1934
|
-
* response: {
|
|
1935
|
-
* status: 200,
|
|
1936
|
-
* body: {
|
|
1937
|
-
* 'say': 'hello to mock server'
|
|
1938
|
-
* }
|
|
1939
|
-
* }
|
|
1940
|
-
* });
|
|
1941
|
-
* ```
|
|
1942
|
-
* @param interaction - add behavior to the mock server
|
|
1943
|
-
* @returns void
|
|
1944
|
-
*/
|
|
1945
|
-
addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
|
|
1946
|
-
}
|
|
1947
1802
|
/**
|
|
1948
1803
|
* Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
|
|
1949
1804
|
* fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -4892,17 +4747,6 @@ declare namespace CodeceptJS {
|
|
|
4892
4747
|
* @returns automatically synchronized promise through #recorder
|
|
4893
4748
|
*/
|
|
4894
4749
|
waitForDetached(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4895
|
-
/**
|
|
4896
|
-
* Waits for the specified cookie in the cookies.
|
|
4897
|
-
*
|
|
4898
|
-
* ```js
|
|
4899
|
-
* I.waitForCookie("token");
|
|
4900
|
-
* ```
|
|
4901
|
-
* @param name - expected cookie name.
|
|
4902
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
4903
|
-
* @returns automatically synchronized promise through #recorder
|
|
4904
|
-
*/
|
|
4905
|
-
waitForCookie(name: string, sec?: number): void;
|
|
4906
4750
|
/**
|
|
4907
4751
|
* Grab the data from performance timing using Navigation Timing API.
|
|
4908
4752
|
* The returned data will contain following things in ms:
|
|
@@ -4973,10 +4817,11 @@ declare namespace CodeceptJS {
|
|
|
4973
4817
|
*/
|
|
4974
4818
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
4975
4819
|
/**
|
|
4976
|
-
*
|
|
4820
|
+
* Starts recording the network traffics.
|
|
4821
|
+
* This also resets recorded network requests.
|
|
4977
4822
|
*
|
|
4978
4823
|
* ```js
|
|
4979
|
-
* I.
|
|
4824
|
+
* I.startRecordingTraffic();
|
|
4980
4825
|
* ```
|
|
4981
4826
|
*/
|
|
4982
4827
|
startRecordingTraffic(): void;
|
|
@@ -4989,9 +4834,8 @@ declare namespace CodeceptJS {
|
|
|
4989
4834
|
* expect(traffics[0].response.status).to.equal(200);
|
|
4990
4835
|
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4991
4836
|
* ```
|
|
4992
|
-
* @returns recorded network traffics
|
|
4993
4837
|
*/
|
|
4994
|
-
grabRecordedNetworkTraffics(): any[]
|
|
4838
|
+
grabRecordedNetworkTraffics(): Promise<any[]>;
|
|
4995
4839
|
/**
|
|
4996
4840
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4997
4841
|
*
|
|
@@ -5028,10 +4872,6 @@ declare namespace CodeceptJS {
|
|
|
5028
4872
|
mockTraffic(urls: any, responseString: any, contentType?: any): void;
|
|
5029
4873
|
/**
|
|
5030
4874
|
* Resets all recorded network requests.
|
|
5031
|
-
*
|
|
5032
|
-
* ```js
|
|
5033
|
-
* I.flushNetworkTraffics();
|
|
5034
|
-
* ```
|
|
5035
4875
|
*/
|
|
5036
4876
|
flushNetworkTraffics(): void;
|
|
5037
4877
|
/**
|
|
@@ -5050,13 +4890,13 @@ declare namespace CodeceptJS {
|
|
|
5050
4890
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
5051
4891
|
* I.startRecordingTraffic();
|
|
5052
4892
|
* await I.seeTraffic({
|
|
5053
|
-
*
|
|
5054
|
-
*
|
|
5055
|
-
*
|
|
5056
|
-
*
|
|
5057
|
-
*
|
|
4893
|
+
* name: 'sentry event',
|
|
4894
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
4895
|
+
* parameters: {
|
|
4896
|
+
* width: '1919',
|
|
4897
|
+
* height: '1138',
|
|
5058
4898
|
* },
|
|
5059
|
-
*
|
|
4899
|
+
* });
|
|
5060
4900
|
* ```
|
|
5061
4901
|
*
|
|
5062
4902
|
* ```js
|
|
@@ -5064,12 +4904,12 @@ declare namespace CodeceptJS {
|
|
|
5064
4904
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
5065
4905
|
* I.startRecordingTraffic();
|
|
5066
4906
|
* await I.seeTraffic({
|
|
5067
|
-
*
|
|
5068
|
-
*
|
|
5069
|
-
*
|
|
5070
|
-
*
|
|
4907
|
+
* name: 'event',
|
|
4908
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
4909
|
+
* requestPostData: {
|
|
4910
|
+
* st: 2,
|
|
5071
4911
|
* },
|
|
5072
|
-
*
|
|
4912
|
+
* });
|
|
5073
4913
|
* ```
|
|
5074
4914
|
* @param opts - options when checking the traffic network.
|
|
5075
4915
|
* @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.
|
|
@@ -5077,7 +4917,6 @@ declare namespace CodeceptJS {
|
|
|
5077
4917
|
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
5078
4918
|
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
5079
4919
|
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
5080
|
-
* @returns automatically synchronized promise through #recorder
|
|
5081
4920
|
*/
|
|
5082
4921
|
seeTraffic(opts: {
|
|
5083
4922
|
name: string;
|
|
@@ -5085,7 +4924,7 @@ declare namespace CodeceptJS {
|
|
|
5085
4924
|
parameters?: any;
|
|
5086
4925
|
requestPostData?: any;
|
|
5087
4926
|
timeout?: number;
|
|
5088
|
-
}):
|
|
4927
|
+
}): Promise<any>;
|
|
5089
4928
|
/**
|
|
5090
4929
|
* Returns full URL of request matching parameter "urlMatch".
|
|
5091
4930
|
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
@@ -5110,7 +4949,6 @@ declare namespace CodeceptJS {
|
|
|
5110
4949
|
* @param opts - options when checking the traffic network.
|
|
5111
4950
|
* @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.
|
|
5112
4951
|
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
5113
|
-
* @returns automatically synchronized promise through #recorder
|
|
5114
4952
|
*/
|
|
5115
4953
|
dontSeeTraffic(opts: {
|
|
5116
4954
|
name: string;
|
|
@@ -7774,17 +7612,6 @@ declare namespace CodeceptJS {
|
|
|
7774
7612
|
* Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
7775
7613
|
*/
|
|
7776
7614
|
grabCookie(name?: string): any;
|
|
7777
|
-
/**
|
|
7778
|
-
* Waits for the specified cookie in the cookies.
|
|
7779
|
-
*
|
|
7780
|
-
* ```js
|
|
7781
|
-
* I.waitForCookie("token");
|
|
7782
|
-
* ```
|
|
7783
|
-
* @param name - expected cookie name.
|
|
7784
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
7785
|
-
* @returns automatically synchronized promise through #recorder
|
|
7786
|
-
*/
|
|
7787
|
-
waitForCookie(name: string, sec?: number): void;
|
|
7788
7615
|
/**
|
|
7789
7616
|
* Clears a cookie by name,
|
|
7790
7617
|
* if none provided clears all cookies.
|
|
@@ -10880,17 +10707,6 @@ declare namespace CodeceptJS {
|
|
|
10880
10707
|
* @returns attribute value
|
|
10881
10708
|
*/
|
|
10882
10709
|
grabCookie(name?: string): any;
|
|
10883
|
-
/**
|
|
10884
|
-
* Waits for the specified cookie in the cookies.
|
|
10885
|
-
*
|
|
10886
|
-
* ```js
|
|
10887
|
-
* I.waitForCookie("token");
|
|
10888
|
-
* ```
|
|
10889
|
-
* @param name - expected cookie name.
|
|
10890
|
-
* @param [sec = 3] - (optional, `3` by default) time in seconds to wait
|
|
10891
|
-
* @returns automatically synchronized promise through #recorder
|
|
10892
|
-
*/
|
|
10893
|
-
waitForCookie(name: string, sec?: number): void;
|
|
10894
10710
|
/**
|
|
10895
10711
|
* Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
10896
10712
|
* Don't confuse popups with modal windows, as created by [various
|
|
@@ -11484,122 +11300,10 @@ declare namespace CodeceptJS {
|
|
|
11484
11300
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
11485
11301
|
*/
|
|
11486
11302
|
runInWeb(): void;
|
|
11487
|
-
/**
|
|
11488
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11489
|
-
*
|
|
11490
|
-
* Resets all recorded network requests.
|
|
11491
|
-
*
|
|
11492
|
-
* ```js
|
|
11493
|
-
* I.flushNetworkTraffics();
|
|
11494
|
-
* ```
|
|
11495
|
-
*/
|
|
11496
|
-
flushNetworkTraffics(): void;
|
|
11497
|
-
/**
|
|
11498
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11499
|
-
*
|
|
11500
|
-
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
11501
|
-
*
|
|
11502
|
-
* ```js
|
|
11503
|
-
* I.stopRecordingTraffic();
|
|
11504
|
-
* ```
|
|
11505
|
-
*/
|
|
11506
|
-
stopRecordingTraffic(): void;
|
|
11507
|
-
/**
|
|
11508
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11509
|
-
*
|
|
11510
|
-
* Starts recording the network traffics.
|
|
11511
|
-
* This also resets recorded network requests.
|
|
11512
|
-
*
|
|
11513
|
-
* ```js
|
|
11514
|
-
* I.startRecordingTraffic();
|
|
11515
|
-
* ```
|
|
11516
|
-
* @returns automatically synchronized promise through #recorder
|
|
11517
|
-
*/
|
|
11518
|
-
startRecordingTraffic(): void;
|
|
11519
|
-
/**
|
|
11520
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11521
|
-
*
|
|
11522
|
-
* Grab the recording network traffics
|
|
11523
|
-
*
|
|
11524
|
-
* ```js
|
|
11525
|
-
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
11526
|
-
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
11527
|
-
* expect(traffics[0].response.status).to.equal(200);
|
|
11528
|
-
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
11529
|
-
* ```
|
|
11530
|
-
* @returns recorded network traffics
|
|
11531
|
-
*/
|
|
11532
|
-
grabRecordedNetworkTraffics(): any[];
|
|
11533
|
-
/**
|
|
11534
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11535
|
-
*
|
|
11536
|
-
* Verifies that a certain request is part of network traffic.
|
|
11537
|
-
*
|
|
11538
|
-
* ```js
|
|
11539
|
-
* // checking the request url contains certain query strings
|
|
11540
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
11541
|
-
* I.startRecordingTraffic();
|
|
11542
|
-
* await I.seeTraffic({
|
|
11543
|
-
* name: 'sentry event',
|
|
11544
|
-
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
11545
|
-
* parameters: {
|
|
11546
|
-
* width: '1919',
|
|
11547
|
-
* height: '1138',
|
|
11548
|
-
* },
|
|
11549
|
-
* });
|
|
11550
|
-
* ```
|
|
11551
|
-
*
|
|
11552
|
-
* ```js
|
|
11553
|
-
* // checking the request url contains certain post data
|
|
11554
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
11555
|
-
* I.startRecordingTraffic();
|
|
11556
|
-
* await I.seeTraffic({
|
|
11557
|
-
* name: 'event',
|
|
11558
|
-
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
11559
|
-
* requestPostData: {
|
|
11560
|
-
* st: 2,
|
|
11561
|
-
* },
|
|
11562
|
-
* });
|
|
11563
|
-
* ```
|
|
11564
|
-
* @param opts - options when checking the traffic network.
|
|
11565
|
-
* @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.
|
|
11566
|
-
* @param opts.url - Expected URL of request in network traffic
|
|
11567
|
-
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
11568
|
-
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
11569
|
-
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
11570
|
-
* @returns automatically synchronized promise through #recorder
|
|
11571
|
-
*/
|
|
11572
|
-
seeTraffic(opts: {
|
|
11573
|
-
name: string;
|
|
11574
|
-
url: string;
|
|
11575
|
-
parameters?: any;
|
|
11576
|
-
requestPostData?: any;
|
|
11577
|
-
timeout?: number;
|
|
11578
|
-
}): void;
|
|
11579
|
-
/**
|
|
11580
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
11581
|
-
*
|
|
11582
|
-
* Verifies that a certain request is not part of network traffic.
|
|
11583
|
-
*
|
|
11584
|
-
* Examples:
|
|
11585
|
-
*
|
|
11586
|
-
* ```js
|
|
11587
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
11588
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
11589
|
-
* ```
|
|
11590
|
-
* @param opts - options when checking the traffic network.
|
|
11591
|
-
* @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.
|
|
11592
|
-
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
11593
|
-
* @returns automatically synchronized promise through #recorder
|
|
11594
|
-
*/
|
|
11595
|
-
dontSeeTraffic(opts: {
|
|
11596
|
-
name: string;
|
|
11597
|
-
url: string | RegExp;
|
|
11598
|
-
}): void;
|
|
11599
11303
|
}
|
|
11600
11304
|
interface ActorStatic {
|
|
11601
11305
|
/**
|
|
11602
|
-
*
|
|
11306
|
+
* add print comment method`
|
|
11603
11307
|
*/
|
|
11604
11308
|
say(msg: string, color?: string): void;
|
|
11605
11309
|
/**
|
|
@@ -12157,6 +11861,7 @@ declare namespace CodeceptJS {
|
|
|
12157
11861
|
namespace store {
|
|
12158
11862
|
var debugMode: boolean;
|
|
12159
11863
|
var timeouts: boolean;
|
|
11864
|
+
var dryRun: boolean;
|
|
12160
11865
|
}
|
|
12161
11866
|
/**
|
|
12162
11867
|
* Describe a "suite" with the given `title`
|
|
@@ -12184,14 +11889,14 @@ declare namespace CodeceptJS {
|
|
|
12184
11889
|
* Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
|
|
12185
11890
|
*
|
|
12186
11891
|
* Detox plays quite differently from Appium. To establish detox testing you need to build a mobile application in a special way to inject Detox code.
|
|
12187
|
-
* This why **Detox is grey box testing** solution, so you need access to application source code, and a way to build and execute it on emulator.
|
|
11892
|
+
* This why **Detox is grey box testing** solution, so you need an access to application source code, and a way to build and execute it on emulator.
|
|
12188
11893
|
*
|
|
12189
11894
|
* Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.
|
|
12190
11895
|
*
|
|
12191
11896
|
* ### Setup
|
|
12192
11897
|
*
|
|
12193
|
-
* 1. [Install and configure Detox](https://wix.github.
|
|
12194
|
-
* 2. [Build an application](https://
|
|
11898
|
+
* 1. [Install and configure Detox for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
|
|
11899
|
+
* 2. [Build an application](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-4-build-your-app-and-run-detox-tests) using `detox build` command.
|
|
12195
11900
|
* 3. Install [CodeceptJS](https://codecept.io) and detox-helper:
|
|
12196
11901
|
*
|
|
12197
11902
|
* ```
|
|
@@ -12204,28 +11909,15 @@ declare namespace CodeceptJS {
|
|
|
12204
11909
|
*
|
|
12205
11910
|
* ```js
|
|
12206
11911
|
* "detox": {
|
|
12207
|
-
*
|
|
12208
|
-
*
|
|
12209
|
-
*
|
|
12210
|
-
*
|
|
12211
|
-
*
|
|
12212
|
-
*
|
|
12213
|
-
*
|
|
12214
|
-
*
|
|
12215
|
-
*
|
|
12216
|
-
* "binaryPath": "../test/ios/build/Build/Products/Debug-iphonesimulator/MyTestApp.app",
|
|
12217
|
-
* "build": "xcodebuild -workspace ../test/ios/MyTestApp.xcworkspace -scheme MyTestApp -configuration Debug -sdk iphonesimulator -derivedDataPath ../test/ios/build"
|
|
12218
|
-
* }
|
|
12219
|
-
* },
|
|
12220
|
-
* "devices": {
|
|
12221
|
-
* "simulator": {
|
|
12222
|
-
* "type": "ios.simulator",
|
|
12223
|
-
* "device": {
|
|
12224
|
-
* "type": "iPhone 15"
|
|
12225
|
-
* }
|
|
12226
|
-
* }
|
|
12227
|
-
* }
|
|
12228
|
-
* }
|
|
11912
|
+
* "configurations": {
|
|
11913
|
+
* "ios.sim.debug": {
|
|
11914
|
+
* "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
|
|
11915
|
+
* "build": "xcodebuild -project ios/example.xcodeproj -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
|
|
11916
|
+
* "type": "ios.simulator",
|
|
11917
|
+
* "name": "iPhone 7"
|
|
11918
|
+
* }
|
|
11919
|
+
* }
|
|
11920
|
+
* }
|
|
12229
11921
|
* ```
|
|
12230
11922
|
*
|
|
12231
11923
|
*
|
|
@@ -12320,14 +12012,6 @@ declare namespace CodeceptJS {
|
|
|
12320
12012
|
* ```
|
|
12321
12013
|
*/
|
|
12322
12014
|
setPortraitOrientation(): void;
|
|
12323
|
-
/**
|
|
12324
|
-
* Grab the device platform
|
|
12325
|
-
*
|
|
12326
|
-
* ```js
|
|
12327
|
-
* const platform = await I.grabPlatform();
|
|
12328
|
-
* ```
|
|
12329
|
-
*/
|
|
12330
|
-
grabPlatform(): void;
|
|
12331
12015
|
/**
|
|
12332
12016
|
* Execute code only on iOS
|
|
12333
12017
|
*
|
|
@@ -12417,19 +12101,6 @@ declare namespace CodeceptJS {
|
|
|
12417
12101
|
* ```
|
|
12418
12102
|
*/
|
|
12419
12103
|
click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12420
|
-
/**
|
|
12421
|
-
* Clicks on an element.
|
|
12422
|
-
* Element can be located by its label
|
|
12423
|
-
*
|
|
12424
|
-
* The second parameter is a context (id | type | accessibility id) to narrow the search.
|
|
12425
|
-
*
|
|
12426
|
-
*
|
|
12427
|
-
* ```js
|
|
12428
|
-
* I.tapByLabel('Login'); // locate by text
|
|
12429
|
-
* I.tapByLabel('Login', '#nav'); // locate by text inside #nav
|
|
12430
|
-
* ```
|
|
12431
|
-
*/
|
|
12432
|
-
tapByLabel(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12433
12104
|
/**
|
|
12434
12105
|
* Performs click on element with horizontal and vertical offset.
|
|
12435
12106
|
* An element is located by text, id, accessibility id.
|
|
@@ -12480,17 +12151,6 @@ declare namespace CodeceptJS {
|
|
|
12480
12151
|
* @param [context = null] - context element
|
|
12481
12152
|
*/
|
|
12482
12153
|
seeElement(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12483
|
-
/**
|
|
12484
|
-
* Checks if an element exists.
|
|
12485
|
-
*
|
|
12486
|
-
* ```js
|
|
12487
|
-
* I.checkIfElementExists('~edit'); // located by accessibility id
|
|
12488
|
-
* I.checkIfElementExists('~edit', '#menu'); // element inside #menu
|
|
12489
|
-
* ```
|
|
12490
|
-
* @param locator - element to locate
|
|
12491
|
-
* @param [context = null] - context element
|
|
12492
|
-
*/
|
|
12493
|
-
checkIfElementExists(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12494
12154
|
/**
|
|
12495
12155
|
* Checks that element is not visible.
|
|
12496
12156
|
* Use second parameter to narrow down the search.
|
|
@@ -12540,18 +12200,6 @@ declare namespace CodeceptJS {
|
|
|
12540
12200
|
* @param value - value to fill
|
|
12541
12201
|
*/
|
|
12542
12202
|
fillField(field: CodeceptJS.LocatorOrString, value: string): void;
|
|
12543
|
-
/**
|
|
12544
|
-
* Taps return key.
|
|
12545
|
-
* A field can be located by text, accessibility id, id.
|
|
12546
|
-
*
|
|
12547
|
-
* ```js
|
|
12548
|
-
* I.tapReturnKey('Username');
|
|
12549
|
-
* I.tapReturnKey('~name');
|
|
12550
|
-
* I.tapReturnKey({ android: 'NAME', ios: 'name' });
|
|
12551
|
-
* ```
|
|
12552
|
-
* @param field - an input element to fill in
|
|
12553
|
-
*/
|
|
12554
|
-
tapReturnKey(field: CodeceptJS.LocatorOrString): void;
|
|
12555
12203
|
/**
|
|
12556
12204
|
* Clears a text field.
|
|
12557
12205
|
* A field can be located by text, accessibility id, id.
|
|
@@ -12677,7 +12325,7 @@ declare namespace CodeceptJS {
|
|
|
12677
12325
|
*/
|
|
12678
12326
|
waitForElementVisible(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
12679
12327
|
/**
|
|
12680
|
-
* Waits an
|
|
12328
|
+
* Waits an elment to become not visible.
|
|
12681
12329
|
*
|
|
12682
12330
|
* ```js
|
|
12683
12331
|
* I.waitToHide('#message', 2); // wait for 2 seconds
|
|
@@ -12686,14 +12334,6 @@ declare namespace CodeceptJS {
|
|
|
12686
12334
|
* @param [sec = 5] - number of seconds to wait
|
|
12687
12335
|
*/
|
|
12688
12336
|
waitToHide(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
12689
|
-
/**
|
|
12690
|
-
* Scrolls within a scrollable container to an element.
|
|
12691
|
-
* @param targetLocator - Locator of the element to scroll to
|
|
12692
|
-
* @param containerLocator - Locator of the scrollable container
|
|
12693
|
-
* @param direction - 'up' or 'down'
|
|
12694
|
-
* @param [offset = 100] - Offset for scroll, can be adjusted based on need
|
|
12695
|
-
*/
|
|
12696
|
-
scrollToElement(targetLocator: CodeceptJS.LocatorOrString, containerLocator: CodeceptJS.LocatorOrString, direction?: string, offset?: number): void;
|
|
12697
12337
|
}
|
|
12698
12338
|
/**
|
|
12699
12339
|
* Abstract class.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Verifies that a certain request is not part of network traffic.
|
|
2
|
-
|
|
3
|
-
Examples:
|
|
4
|
-
|
|
5
|
-
```js
|
|
6
|
-
I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
7
|
-
I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
@param {Object} opts - options when checking the traffic network.
|
|
11
|
-
@param {string} opts.name A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
12
|
-
@param {string|RegExp} opts.url Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
13
|
-
@return {void} automatically synchronized promise through #recorder
|