codeceptjs 3.5.13-beta.3 → 3.5.13
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/lib/helper/Playwright.js +13 -10
- package/lib/helper/Puppeteer.js +3 -3
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +3 -3
- package/package.json +6 -6
- package/typings/promiseBasedTypes.d.ts +126 -15
- package/typings/types.d.ts +134 -16
package/lib/helper/Playwright.js
CHANGED
|
@@ -6,7 +6,6 @@ const { v4: uuidv4 } = require('uuid');
|
|
|
6
6
|
const assert = require('assert');
|
|
7
7
|
const promiseRetry = require('promise-retry');
|
|
8
8
|
const Locator = require('../locator');
|
|
9
|
-
const store = require('../store');
|
|
10
9
|
const recorder = require('../recorder');
|
|
11
10
|
const stringIncludes = require('../assert/include').includes;
|
|
12
11
|
const { urlEquals } = require('../assert/equal');
|
|
@@ -2679,6 +2678,7 @@ class Playwright extends Helper {
|
|
|
2679
2678
|
*/
|
|
2680
2679
|
async waitForText(text, sec = null, context = null) {
|
|
2681
2680
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
2681
|
+
const errorMessage = `Text "${text}" was not found on page after ${waitTimeout / 1000} sec.`;
|
|
2682
2682
|
let waiter;
|
|
2683
2683
|
|
|
2684
2684
|
const contextObject = await this._getContext();
|
|
@@ -2689,18 +2689,21 @@ class Playwright extends Helper {
|
|
|
2689
2689
|
try {
|
|
2690
2690
|
await contextObject.locator(`${locator.isCustom() ? `${locator.type}=${locator.value}` : locator.simplify()} >> text=${text}`).first().waitFor({ timeout: waitTimeout, state: 'visible' });
|
|
2691
2691
|
} catch (e) {
|
|
2692
|
-
|
|
2693
|
-
throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec\n${e.message}`);
|
|
2692
|
+
throw new Error(`${errorMessage}\n${e.message}`);
|
|
2694
2693
|
}
|
|
2695
2694
|
}
|
|
2696
2695
|
|
|
2697
2696
|
if (locator.isXPath()) {
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2697
|
+
try {
|
|
2698
|
+
await contextObject.waitForFunction(([locator, text, $XPath]) => {
|
|
2699
|
+
eval($XPath); // eslint-disable-line no-eval
|
|
2700
|
+
const el = $XPath(null, locator);
|
|
2701
|
+
if (!el.length) return false;
|
|
2702
|
+
return el[0].innerText.indexOf(text) > -1;
|
|
2703
|
+
}, [locator.value, text, $XPath.toString()], { timeout: waitTimeout });
|
|
2704
|
+
} catch (e) {
|
|
2705
|
+
throw new Error(`${errorMessage}\n${e.message}`);
|
|
2706
|
+
}
|
|
2704
2707
|
}
|
|
2705
2708
|
} else {
|
|
2706
2709
|
// we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
|
|
@@ -2714,7 +2717,7 @@ class Playwright extends Helper {
|
|
|
2714
2717
|
count += 1000;
|
|
2715
2718
|
} while (count <= waitTimeout);
|
|
2716
2719
|
|
|
2717
|
-
if (!waiter) throw new Error(
|
|
2720
|
+
if (!waiter) throw new Error(`${errorMessage}`);
|
|
2718
2721
|
}
|
|
2719
2722
|
}
|
|
2720
2723
|
|
package/lib/helper/Puppeteer.js
CHANGED
|
@@ -486,7 +486,7 @@ class Puppeteer extends Helper {
|
|
|
486
486
|
if (!page) return;
|
|
487
487
|
page.setDefaultNavigationTimeout(this.options.getPageTimeout);
|
|
488
488
|
this.context = await this.page.$('body');
|
|
489
|
-
if (this.
|
|
489
|
+
if (this.options.browser === 'chrome') {
|
|
490
490
|
await page.bringToFront();
|
|
491
491
|
}
|
|
492
492
|
}
|
|
@@ -658,9 +658,9 @@ class Puppeteer extends Helper {
|
|
|
658
658
|
url = this.options.url + url;
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
if (this.
|
|
661
|
+
if (this.options.basicAuth && (this.isAuthenticated !== true)) {
|
|
662
662
|
if (url.includes(this.options.url)) {
|
|
663
|
-
await this.page.authenticate(this.
|
|
663
|
+
await this.page.authenticate(this.options.basicAuth);
|
|
664
664
|
this.isAuthenticated = true;
|
|
665
665
|
}
|
|
666
666
|
}
|
package/lib/helper/REST.js
CHANGED
|
@@ -72,9 +72,12 @@ class REST extends Helper {
|
|
|
72
72
|
this.options.maxBodyLength = maxContentLength;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
// override defaults with config
|
|
76
|
+
this._setConfig(config);
|
|
77
|
+
|
|
76
78
|
this.headers = { ...this.options.defaultHeaders };
|
|
77
79
|
this.axios = axios.create();
|
|
80
|
+
// @ts-ignore
|
|
78
81
|
this.axios.defaults.headers = this.options.defaultHeaders;
|
|
79
82
|
}
|
|
80
83
|
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -977,12 +977,12 @@ class WebDriver extends Helper {
|
|
|
977
977
|
*/
|
|
978
978
|
amOnPage(url) {
|
|
979
979
|
let split_url;
|
|
980
|
-
if (this.
|
|
980
|
+
if (this.options.basicAuth) {
|
|
981
981
|
if (url.startsWith('/')) {
|
|
982
|
-
url = this.
|
|
982
|
+
url = this.options.url + url;
|
|
983
983
|
}
|
|
984
984
|
split_url = url.split('//');
|
|
985
|
-
url = `${split_url[0]}//${this.
|
|
985
|
+
url = `${split_url[0]}//${this.options.basicAuth.username}:${this.options.basicAuth.password}@${split_url[1]}`;
|
|
986
986
|
}
|
|
987
987
|
return this.browser.url(url);
|
|
988
988
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.5.13
|
|
3
|
+
"version": "3.5.13",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@xmldom/xmldom": "0.8.10",
|
|
76
76
|
"acorn": "8.11.3",
|
|
77
77
|
"arrify": "2.0.1",
|
|
78
|
-
"axios": "1.6.
|
|
78
|
+
"axios": "1.6.7",
|
|
79
79
|
"chai": "5.0.3",
|
|
80
80
|
"chai-deep-match": "1.2.1",
|
|
81
81
|
"chai-exclude": "2.1.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"openai": "3.2.1",
|
|
107
107
|
"ora-classic": "5.4.2",
|
|
108
108
|
"pactum": "3.6.0",
|
|
109
|
-
"parse-function": "5.6.
|
|
109
|
+
"parse-function": "5.6.10",
|
|
110
110
|
"parse5": "7.1.2",
|
|
111
111
|
"promise-retry": "1.1.1",
|
|
112
112
|
"resq": "1.11.0",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@faker-js/faker": "7.6.0",
|
|
122
122
|
"@pollyjs/adapter-puppeteer": "6.0.6",
|
|
123
123
|
"@pollyjs/core": "5.1.0",
|
|
124
|
-
"@types/chai": "4.3.
|
|
124
|
+
"@types/chai": "4.3.11",
|
|
125
125
|
"@types/inquirer": "9.0.3",
|
|
126
126
|
"@types/node": "20.11.16",
|
|
127
127
|
"@wdio/sauce-service": "8.29.1",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"typedoc-plugin-markdown": "3.17.1",
|
|
163
163
|
"typescript": "5.3.3",
|
|
164
164
|
"wdio-docker-service": "1.5.0",
|
|
165
|
-
"webdriverio": "8.
|
|
165
|
+
"webdriverio": "8.31.1",
|
|
166
166
|
"xml2js": "0.6.2",
|
|
167
167
|
"xpath": "0.0.34"
|
|
168
168
|
},
|
|
@@ -171,4 +171,4 @@
|
|
|
171
171
|
"npm": ">=5.6.0"
|
|
172
172
|
},
|
|
173
173
|
"es6": true
|
|
174
|
-
}
|
|
174
|
+
}
|
|
@@ -4725,11 +4725,10 @@ declare namespace CodeceptJS {
|
|
|
4725
4725
|
*/
|
|
4726
4726
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
4727
4727
|
/**
|
|
4728
|
-
*
|
|
4729
|
-
* This also resets recorded network requests.
|
|
4728
|
+
* Resets all recorded network requests.
|
|
4730
4729
|
*
|
|
4731
4730
|
* ```js
|
|
4732
|
-
* I.
|
|
4731
|
+
* I.flushNetworkTraffics();
|
|
4733
4732
|
* ```
|
|
4734
4733
|
*/
|
|
4735
4734
|
startRecordingTraffic(): Promise<any>;
|
|
@@ -4743,7 +4742,7 @@ declare namespace CodeceptJS {
|
|
|
4743
4742
|
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4744
4743
|
* ```
|
|
4745
4744
|
*/
|
|
4746
|
-
grabRecordedNetworkTraffics(): Promise<any
|
|
4745
|
+
grabRecordedNetworkTraffics(): Promise<any>;
|
|
4747
4746
|
/**
|
|
4748
4747
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4749
4748
|
*
|
|
@@ -4780,6 +4779,10 @@ declare namespace CodeceptJS {
|
|
|
4780
4779
|
mockTraffic(urls: any, responseString: any, contentType?: any): Promise<any>;
|
|
4781
4780
|
/**
|
|
4782
4781
|
* Resets all recorded network requests.
|
|
4782
|
+
*
|
|
4783
|
+
* ```js
|
|
4784
|
+
* I.flushNetworkTraffics();
|
|
4785
|
+
* ```
|
|
4783
4786
|
*/
|
|
4784
4787
|
flushNetworkTraffics(): Promise<any>;
|
|
4785
4788
|
/**
|
|
@@ -4798,13 +4801,13 @@ declare namespace CodeceptJS {
|
|
|
4798
4801
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4799
4802
|
* I.startRecordingTraffic();
|
|
4800
4803
|
* await I.seeTraffic({
|
|
4801
|
-
*
|
|
4802
|
-
*
|
|
4803
|
-
*
|
|
4804
|
-
*
|
|
4805
|
-
*
|
|
4804
|
+
* name: 'sentry event',
|
|
4805
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
4806
|
+
* parameters: {
|
|
4807
|
+
* width: '1919',
|
|
4808
|
+
* height: '1138',
|
|
4806
4809
|
* },
|
|
4807
|
-
*
|
|
4810
|
+
* });
|
|
4808
4811
|
* ```
|
|
4809
4812
|
*
|
|
4810
4813
|
* ```js
|
|
@@ -4812,12 +4815,12 @@ declare namespace CodeceptJS {
|
|
|
4812
4815
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
4813
4816
|
* I.startRecordingTraffic();
|
|
4814
4817
|
* await I.seeTraffic({
|
|
4815
|
-
*
|
|
4816
|
-
*
|
|
4817
|
-
*
|
|
4818
|
-
*
|
|
4818
|
+
* name: 'event',
|
|
4819
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
4820
|
+
* requestPostData: {
|
|
4821
|
+
* st: 2,
|
|
4819
4822
|
* },
|
|
4820
|
-
*
|
|
4823
|
+
* });
|
|
4821
4824
|
* ```
|
|
4822
4825
|
* @param opts - options when checking the traffic network.
|
|
4823
4826
|
* @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.
|
|
@@ -10735,6 +10738,114 @@ declare namespace CodeceptJS {
|
|
|
10735
10738
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
10736
10739
|
*/
|
|
10737
10740
|
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>;
|
|
10738
10849
|
}
|
|
10739
10850
|
}
|
|
10740
10851
|
|
package/typings/types.d.ts
CHANGED
|
@@ -4973,11 +4973,10 @@ declare namespace CodeceptJS {
|
|
|
4973
4973
|
*/
|
|
4974
4974
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
4975
4975
|
/**
|
|
4976
|
-
*
|
|
4977
|
-
* This also resets recorded network requests.
|
|
4976
|
+
* Resets all recorded network requests.
|
|
4978
4977
|
*
|
|
4979
4978
|
* ```js
|
|
4980
|
-
* I.
|
|
4979
|
+
* I.flushNetworkTraffics();
|
|
4981
4980
|
* ```
|
|
4982
4981
|
*/
|
|
4983
4982
|
startRecordingTraffic(): void;
|
|
@@ -4990,8 +4989,9 @@ declare namespace CodeceptJS {
|
|
|
4990
4989
|
* expect(traffics[0].response.status).to.equal(200);
|
|
4991
4990
|
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
4992
4991
|
* ```
|
|
4992
|
+
* @returns recorded network traffics
|
|
4993
4993
|
*/
|
|
4994
|
-
grabRecordedNetworkTraffics():
|
|
4994
|
+
grabRecordedNetworkTraffics(): any[];
|
|
4995
4995
|
/**
|
|
4996
4996
|
* Blocks traffic of a given URL or a list of URLs.
|
|
4997
4997
|
*
|
|
@@ -5028,6 +5028,10 @@ declare namespace CodeceptJS {
|
|
|
5028
5028
|
mockTraffic(urls: any, responseString: any, contentType?: any): void;
|
|
5029
5029
|
/**
|
|
5030
5030
|
* Resets all recorded network requests.
|
|
5031
|
+
*
|
|
5032
|
+
* ```js
|
|
5033
|
+
* I.flushNetworkTraffics();
|
|
5034
|
+
* ```
|
|
5031
5035
|
*/
|
|
5032
5036
|
flushNetworkTraffics(): void;
|
|
5033
5037
|
/**
|
|
@@ -5046,13 +5050,13 @@ declare namespace CodeceptJS {
|
|
|
5046
5050
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
5047
5051
|
* I.startRecordingTraffic();
|
|
5048
5052
|
* await I.seeTraffic({
|
|
5049
|
-
*
|
|
5050
|
-
*
|
|
5051
|
-
*
|
|
5052
|
-
*
|
|
5053
|
-
*
|
|
5053
|
+
* name: 'sentry event',
|
|
5054
|
+
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
5055
|
+
* parameters: {
|
|
5056
|
+
* width: '1919',
|
|
5057
|
+
* height: '1138',
|
|
5054
5058
|
* },
|
|
5055
|
-
*
|
|
5059
|
+
* });
|
|
5056
5060
|
* ```
|
|
5057
5061
|
*
|
|
5058
5062
|
* ```js
|
|
@@ -5060,12 +5064,12 @@ declare namespace CodeceptJS {
|
|
|
5060
5064
|
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
5061
5065
|
* I.startRecordingTraffic();
|
|
5062
5066
|
* await I.seeTraffic({
|
|
5063
|
-
*
|
|
5064
|
-
*
|
|
5065
|
-
*
|
|
5066
|
-
*
|
|
5067
|
+
* name: 'event',
|
|
5068
|
+
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
5069
|
+
* requestPostData: {
|
|
5070
|
+
* st: 2,
|
|
5067
5071
|
* },
|
|
5068
|
-
*
|
|
5072
|
+
* });
|
|
5069
5073
|
* ```
|
|
5070
5074
|
* @param opts - options when checking the traffic network.
|
|
5071
5075
|
* @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.
|
|
@@ -5073,6 +5077,7 @@ declare namespace CodeceptJS {
|
|
|
5073
5077
|
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
5074
5078
|
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
5075
5079
|
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
5080
|
+
* @returns automatically synchronized promise through #recorder
|
|
5076
5081
|
*/
|
|
5077
5082
|
seeTraffic(opts: {
|
|
5078
5083
|
name: string;
|
|
@@ -5080,7 +5085,7 @@ declare namespace CodeceptJS {
|
|
|
5080
5085
|
parameters?: any;
|
|
5081
5086
|
requestPostData?: any;
|
|
5082
5087
|
timeout?: number;
|
|
5083
|
-
}):
|
|
5088
|
+
}): void;
|
|
5084
5089
|
/**
|
|
5085
5090
|
* Returns full URL of request matching parameter "urlMatch".
|
|
5086
5091
|
* @param urlMatch - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
@@ -5105,6 +5110,7 @@ declare namespace CodeceptJS {
|
|
|
5105
5110
|
* @param opts - options when checking the traffic network.
|
|
5106
5111
|
* @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.
|
|
5107
5112
|
* @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
|
|
5108
5114
|
*/
|
|
5109
5115
|
dontSeeTraffic(opts: {
|
|
5110
5116
|
name: string;
|
|
@@ -11478,6 +11484,118 @@ declare namespace CodeceptJS {
|
|
|
11478
11484
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
11479
11485
|
*/
|
|
11480
11486
|
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;
|
|
11481
11599
|
}
|
|
11482
11600
|
interface ActorStatic {
|
|
11483
11601
|
/**
|