codeceptjs 3.6.1 → 3.6.2-beta.1
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 +14 -2
- package/lib/locator.js +1 -1
- package/package.json +6 -6
- package/typings/promiseBasedTypes.d.ts +6 -2
- package/typings/types.d.ts +85 -15
package/lib/helper/Playwright.js
CHANGED
|
@@ -417,7 +417,14 @@ class Playwright extends Helper {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
if (this.options.video) {
|
|
420
|
-
|
|
420
|
+
// set the video resolution with window size
|
|
421
|
+
let size = parseWindowSize(this.options.windowSize);
|
|
422
|
+
|
|
423
|
+
// if the video resolution is passed, set the record resoultion with that resolution
|
|
424
|
+
if (this.options.recordVideo && this.options.recordVideo.size) {
|
|
425
|
+
size = parseWindowSize(this.options.recordVideo.size);
|
|
426
|
+
}
|
|
427
|
+
this.options.recordVideo = { size };
|
|
421
428
|
}
|
|
422
429
|
if (this.options.recordVideo && !this.options.recordVideo.dir) {
|
|
423
430
|
this.options.recordVideo.dir = `${global.output_dir}/videos/`;
|
|
@@ -2984,7 +2991,7 @@ class Playwright extends Helper {
|
|
|
2984
2991
|
}
|
|
2985
2992
|
|
|
2986
2993
|
/**
|
|
2987
|
-
* {{>
|
|
2994
|
+
* {{> startRecordingTraffic }}
|
|
2988
2995
|
*
|
|
2989
2996
|
*/
|
|
2990
2997
|
startRecordingTraffic() {
|
|
@@ -3656,6 +3663,11 @@ async function targetCreatedHandler(page) {
|
|
|
3656
3663
|
|
|
3657
3664
|
function parseWindowSize(windowSize) {
|
|
3658
3665
|
if (!windowSize) return { width: 800, height: 600 };
|
|
3666
|
+
|
|
3667
|
+
if (windowSize.width && windowSize.height) {
|
|
3668
|
+
return { width: parseInt(windowSize.width, 10), height: parseInt(windowSize.height, 10) };
|
|
3669
|
+
}
|
|
3670
|
+
|
|
3659
3671
|
const dimensions = windowSize.split('x');
|
|
3660
3672
|
if (dimensions.length < 2 || windowSize === 'maximize') {
|
|
3661
3673
|
console.log('Invalid window size, setting window to default values');
|
package/lib/locator.js
CHANGED
|
@@ -541,7 +541,7 @@ function removePrefix(xpath) {
|
|
|
541
541
|
* @returns {boolean}
|
|
542
542
|
*/
|
|
543
543
|
function isPlaywrightLocator(locator) {
|
|
544
|
-
return locator.includes('_react') || locator.includes('_vue')
|
|
544
|
+
return locator.includes('_react') || locator.includes('_vue');
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.1",
|
|
3
|
+
"version": "3.6.2-beta.1",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -98,16 +98,16 @@
|
|
|
98
98
|
"glob": "6.0.1",
|
|
99
99
|
"html-minifier-terser": "7.2.0",
|
|
100
100
|
"inquirer": "6.5.2",
|
|
101
|
-
"joi": "17.12.
|
|
101
|
+
"joi": "17.12.3",
|
|
102
102
|
"js-beautify": "1.15.1",
|
|
103
103
|
"lodash.clonedeep": "4.5.0",
|
|
104
104
|
"lodash.merge": "4.6.2",
|
|
105
105
|
"mkdirp": "1.0.4",
|
|
106
|
-
"mocha": "10.
|
|
106
|
+
"mocha": "10.4.0",
|
|
107
107
|
"monocart-coverage-reports": "2.7.4",
|
|
108
108
|
"ms": "2.1.3",
|
|
109
109
|
"ora-classic": "5.4.2",
|
|
110
|
-
"pactum": "3.6.
|
|
110
|
+
"pactum": "3.6.7",
|
|
111
111
|
"parse-function": "5.6.10",
|
|
112
112
|
"parse5": "7.1.2",
|
|
113
113
|
"promise-retry": "1.1.1",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"jsdoc": "3.6.11",
|
|
149
149
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
150
150
|
"json-server": "0.10.1",
|
|
151
|
-
"playwright": "1.43.
|
|
151
|
+
"playwright": "1.43.1",
|
|
152
152
|
"puppeteer": "22.6.3",
|
|
153
153
|
"qrcode-terminal": "0.12.0",
|
|
154
154
|
"rosie": "2.1.1",
|
|
@@ -179,4 +179,4 @@
|
|
|
179
179
|
"strict": false
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
}
|
|
@@ -1154,6 +1154,7 @@ declare namespace CodeceptJS {
|
|
|
1154
1154
|
*
|
|
1155
1155
|
* ## Methods
|
|
1156
1156
|
*/
|
|
1157
|
+
// @ts-ignore
|
|
1157
1158
|
class ExpectHelper {
|
|
1158
1159
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1159
1160
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1780,6 +1781,7 @@ declare namespace CodeceptJS {
|
|
|
1780
1781
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1781
1782
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1782
1783
|
*/
|
|
1784
|
+
// @ts-ignore
|
|
1783
1785
|
type MockServerConfig = {
|
|
1784
1786
|
port?: number;
|
|
1785
1787
|
host?: string;
|
|
@@ -1904,6 +1906,7 @@ declare namespace CodeceptJS {
|
|
|
1904
1906
|
*
|
|
1905
1907
|
* ## Methods
|
|
1906
1908
|
*/
|
|
1909
|
+
// @ts-ignore
|
|
1907
1910
|
class MockServer {
|
|
1908
1911
|
/**
|
|
1909
1912
|
* Start the mock server
|
|
@@ -4765,10 +4768,11 @@ declare namespace CodeceptJS {
|
|
|
4765
4768
|
*/
|
|
4766
4769
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): Promise<any>;
|
|
4767
4770
|
/**
|
|
4768
|
-
*
|
|
4771
|
+
* Starts recording the network traffics.
|
|
4772
|
+
* This also resets recorded network requests.
|
|
4769
4773
|
*
|
|
4770
4774
|
* ```js
|
|
4771
|
-
* I.
|
|
4775
|
+
* I.startRecordingTraffic();
|
|
4772
4776
|
* ```
|
|
4773
4777
|
*/
|
|
4774
4778
|
startRecordingTraffic(): Promise<any>;
|
package/typings/types.d.ts
CHANGED
|
@@ -1178,6 +1178,7 @@ declare namespace CodeceptJS {
|
|
|
1178
1178
|
*
|
|
1179
1179
|
* ## Methods
|
|
1180
1180
|
*/
|
|
1181
|
+
// @ts-ignore
|
|
1181
1182
|
class ExpectHelper {
|
|
1182
1183
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1183
1184
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1807,6 +1808,7 @@ declare namespace CodeceptJS {
|
|
|
1807
1808
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1808
1809
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1809
1810
|
*/
|
|
1811
|
+
// @ts-ignore
|
|
1810
1812
|
type MockServerConfig = {
|
|
1811
1813
|
port?: number;
|
|
1812
1814
|
host?: string;
|
|
@@ -1931,6 +1933,7 @@ declare namespace CodeceptJS {
|
|
|
1931
1933
|
*
|
|
1932
1934
|
* ## Methods
|
|
1933
1935
|
*/
|
|
1936
|
+
// @ts-ignore
|
|
1934
1937
|
class MockServer {
|
|
1935
1938
|
/**
|
|
1936
1939
|
* Start the mock server
|
|
@@ -5015,11 +5018,13 @@ declare namespace CodeceptJS {
|
|
|
5015
5018
|
*/
|
|
5016
5019
|
stopMockingRoute(url?: string | RegExp, handler?: (...params: any[]) => any): void;
|
|
5017
5020
|
/**
|
|
5018
|
-
*
|
|
5021
|
+
* Starts recording the network traffics.
|
|
5022
|
+
* This also resets recorded network requests.
|
|
5019
5023
|
*
|
|
5020
5024
|
* ```js
|
|
5021
|
-
* I.
|
|
5025
|
+
* I.startRecordingTraffic();
|
|
5022
5026
|
* ```
|
|
5027
|
+
* @returns automatically synchronized promise through #recorder
|
|
5023
5028
|
*/
|
|
5024
5029
|
startRecordingTraffic(): void;
|
|
5025
5030
|
/**
|
|
@@ -12377,14 +12382,14 @@ declare namespace CodeceptJS {
|
|
|
12377
12382
|
* Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
|
|
12378
12383
|
*
|
|
12379
12384
|
* 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.
|
|
12380
|
-
* This why **Detox is grey box testing** solution, so you need
|
|
12385
|
+
* 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.
|
|
12381
12386
|
*
|
|
12382
12387
|
* Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.
|
|
12383
12388
|
*
|
|
12384
12389
|
* ### Setup
|
|
12385
12390
|
*
|
|
12386
|
-
* 1. [Install and configure Detox
|
|
12387
|
-
* 2. [Build an application](https://github.
|
|
12391
|
+
* 1. [Install and configure Detox](https://wix.github.io/Detox/docs/introduction/project-setup)
|
|
12392
|
+
* 2. [Build an application](https://wix.github.io/Detox/docs/introduction/project-setup#step-5-build-the-app) using `detox build` command.
|
|
12388
12393
|
* 3. Install [CodeceptJS](https://codecept.io) and detox-helper:
|
|
12389
12394
|
*
|
|
12390
12395
|
* ```
|
|
@@ -12397,15 +12402,28 @@ declare namespace CodeceptJS {
|
|
|
12397
12402
|
*
|
|
12398
12403
|
* ```js
|
|
12399
12404
|
* "detox": {
|
|
12400
|
-
*
|
|
12401
|
-
*
|
|
12402
|
-
*
|
|
12403
|
-
*
|
|
12404
|
-
*
|
|
12405
|
-
*
|
|
12406
|
-
*
|
|
12407
|
-
*
|
|
12408
|
-
*
|
|
12405
|
+
* "configurations": {
|
|
12406
|
+
* "ios.sim.debug": {
|
|
12407
|
+
* "device": "simulator",
|
|
12408
|
+
* "app": "ios.debug"
|
|
12409
|
+
* }
|
|
12410
|
+
* },
|
|
12411
|
+
* "apps": {
|
|
12412
|
+
* "ios.debug": {
|
|
12413
|
+
* "type": "ios.app",
|
|
12414
|
+
* "binaryPath": "../test/ios/build/Build/Products/Debug-iphonesimulator/MyTestApp.app",
|
|
12415
|
+
* "build": "xcodebuild -workspace ../test/ios/MyTestApp.xcworkspace -scheme MyTestApp -configuration Debug -sdk iphonesimulator -derivedDataPath ../test/ios/build"
|
|
12416
|
+
* }
|
|
12417
|
+
* },
|
|
12418
|
+
* "devices": {
|
|
12419
|
+
* "simulator": {
|
|
12420
|
+
* "type": "ios.simulator",
|
|
12421
|
+
* "device": {
|
|
12422
|
+
* "type": "iPhone 15"
|
|
12423
|
+
* }
|
|
12424
|
+
* }
|
|
12425
|
+
* }
|
|
12426
|
+
* }
|
|
12409
12427
|
* ```
|
|
12410
12428
|
*
|
|
12411
12429
|
*
|
|
@@ -12500,6 +12518,14 @@ declare namespace CodeceptJS {
|
|
|
12500
12518
|
* ```
|
|
12501
12519
|
*/
|
|
12502
12520
|
setPortraitOrientation(): void;
|
|
12521
|
+
/**
|
|
12522
|
+
* Grab the device platform
|
|
12523
|
+
*
|
|
12524
|
+
* ```js
|
|
12525
|
+
* const platform = await I.grabPlatform();
|
|
12526
|
+
* ```
|
|
12527
|
+
*/
|
|
12528
|
+
grabPlatform(): void;
|
|
12503
12529
|
/**
|
|
12504
12530
|
* Execute code only on iOS
|
|
12505
12531
|
*
|
|
@@ -12589,6 +12615,19 @@ declare namespace CodeceptJS {
|
|
|
12589
12615
|
* ```
|
|
12590
12616
|
*/
|
|
12591
12617
|
click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12618
|
+
/**
|
|
12619
|
+
* Clicks on an element.
|
|
12620
|
+
* Element can be located by its label
|
|
12621
|
+
*
|
|
12622
|
+
* The second parameter is a context (id | type | accessibility id) to narrow the search.
|
|
12623
|
+
*
|
|
12624
|
+
*
|
|
12625
|
+
* ```js
|
|
12626
|
+
* I.tapByLabel('Login'); // locate by text
|
|
12627
|
+
* I.tapByLabel('Login', '#nav'); // locate by text inside #nav
|
|
12628
|
+
* ```
|
|
12629
|
+
*/
|
|
12630
|
+
tapByLabel(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12592
12631
|
/**
|
|
12593
12632
|
* Performs click on element with horizontal and vertical offset.
|
|
12594
12633
|
* An element is located by text, id, accessibility id.
|
|
@@ -12639,6 +12678,17 @@ declare namespace CodeceptJS {
|
|
|
12639
12678
|
* @param [context = null] - context element
|
|
12640
12679
|
*/
|
|
12641
12680
|
seeElement(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12681
|
+
/**
|
|
12682
|
+
* Checks if an element exists.
|
|
12683
|
+
*
|
|
12684
|
+
* ```js
|
|
12685
|
+
* I.checkIfElementExists('~edit'); // located by accessibility id
|
|
12686
|
+
* I.checkIfElementExists('~edit', '#menu'); // element inside #menu
|
|
12687
|
+
* ```
|
|
12688
|
+
* @param locator - element to locate
|
|
12689
|
+
* @param [context = null] - context element
|
|
12690
|
+
*/
|
|
12691
|
+
checkIfElementExists(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null): void;
|
|
12642
12692
|
/**
|
|
12643
12693
|
* Checks that element is not visible.
|
|
12644
12694
|
* Use second parameter to narrow down the search.
|
|
@@ -12688,6 +12738,18 @@ declare namespace CodeceptJS {
|
|
|
12688
12738
|
* @param value - value to fill
|
|
12689
12739
|
*/
|
|
12690
12740
|
fillField(field: CodeceptJS.LocatorOrString, value: string): void;
|
|
12741
|
+
/**
|
|
12742
|
+
* Taps return key.
|
|
12743
|
+
* A field can be located by text, accessibility id, id.
|
|
12744
|
+
*
|
|
12745
|
+
* ```js
|
|
12746
|
+
* I.tapReturnKey('Username');
|
|
12747
|
+
* I.tapReturnKey('~name');
|
|
12748
|
+
* I.tapReturnKey({ android: 'NAME', ios: 'name' });
|
|
12749
|
+
* ```
|
|
12750
|
+
* @param field - an input element to fill in
|
|
12751
|
+
*/
|
|
12752
|
+
tapReturnKey(field: CodeceptJS.LocatorOrString): void;
|
|
12691
12753
|
/**
|
|
12692
12754
|
* Clears a text field.
|
|
12693
12755
|
* A field can be located by text, accessibility id, id.
|
|
@@ -12813,7 +12875,7 @@ declare namespace CodeceptJS {
|
|
|
12813
12875
|
*/
|
|
12814
12876
|
waitForElementVisible(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
12815
12877
|
/**
|
|
12816
|
-
* Waits an
|
|
12878
|
+
* Waits an elmenet to become not visible.
|
|
12817
12879
|
*
|
|
12818
12880
|
* ```js
|
|
12819
12881
|
* I.waitToHide('#message', 2); // wait for 2 seconds
|
|
@@ -12822,6 +12884,14 @@ declare namespace CodeceptJS {
|
|
|
12822
12884
|
* @param [sec = 5] - number of seconds to wait
|
|
12823
12885
|
*/
|
|
12824
12886
|
waitToHide(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
12887
|
+
/**
|
|
12888
|
+
* Scrolls within a scrollable container to an element.
|
|
12889
|
+
* @param targetLocator - Locator of the element to scroll to
|
|
12890
|
+
* @param containerLocator - Locator of the scrollable container
|
|
12891
|
+
* @param direction - 'up' or 'down'
|
|
12892
|
+
* @param [offset = 100] - Offset for scroll, can be adjusted based on need
|
|
12893
|
+
*/
|
|
12894
|
+
scrollToElement(targetLocator: CodeceptJS.LocatorOrString, containerLocator: CodeceptJS.LocatorOrString, direction?: string, offset?: number): void;
|
|
12825
12895
|
}
|
|
12826
12896
|
/**
|
|
12827
12897
|
* Abstract class.
|