codeceptjs 3.5.13-beta.2 → 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/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/stopRecordingTraffic.mustache +5 -0
- package/lib/helper/Playwright.js +21 -214
- package/lib/helper/Puppeteer.js +3 -3
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +267 -6
- package/lib/helper/networkTraffics/utils.js +137 -0
- package/package.json +7 -7
- package/typings/promiseBasedTypes.d.ts +126 -15
- package/typings/types.d.ts +134 -16
|
@@ -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
|
/**
|