codeceptjs 3.6.0 → 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/lib/pause.js +4 -9
- package/package.json +7 -7
- package/typings/promiseBasedTypes.d.ts +6 -2
- package/typings/types.d.ts +7 -2
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/lib/pause.js
CHANGED
|
@@ -6,7 +6,7 @@ const debug = require('debug')('codeceptjs:pause');
|
|
|
6
6
|
const container = require('./container');
|
|
7
7
|
const history = require('./history');
|
|
8
8
|
const store = require('./store');
|
|
9
|
-
const
|
|
9
|
+
const aiAssistant = require('./ai');
|
|
10
10
|
const recorder = require('./recorder');
|
|
11
11
|
const event = require('./event');
|
|
12
12
|
const output = require('./output');
|
|
@@ -18,7 +18,6 @@ let nextStep;
|
|
|
18
18
|
let finish;
|
|
19
19
|
let next;
|
|
20
20
|
let registeredVariables = {};
|
|
21
|
-
let aiAssistant;
|
|
22
21
|
/**
|
|
23
22
|
* Pauses test execution and starts interactive shell
|
|
24
23
|
* @param {Object<string, *>} [passedObject]
|
|
@@ -44,8 +43,6 @@ function pauseSession(passedObject = {}) {
|
|
|
44
43
|
let vars = Object.keys(registeredVariables).join(', ');
|
|
45
44
|
if (vars) vars = `(vars: ${vars})`;
|
|
46
45
|
|
|
47
|
-
aiAssistant = AiAssistant.getInstance();
|
|
48
|
-
|
|
49
46
|
output.print(colors.yellow(' Interactive shell started'));
|
|
50
47
|
output.print(colors.yellow(' Use JavaScript syntax to try steps in action'));
|
|
51
48
|
output.print(colors.yellow(` - Press ${colors.bold('ENTER')} to run the next step`));
|
|
@@ -54,11 +51,9 @@ function pauseSession(passedObject = {}) {
|
|
|
54
51
|
output.print(colors.yellow(` - Prefix ${colors.bold('=>')} to run js commands ${colors.bold(vars)}`));
|
|
55
52
|
|
|
56
53
|
if (aiAssistant.isEnabled) {
|
|
57
|
-
output.print(colors.blue(` ${colors.bold('
|
|
58
|
-
output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to
|
|
54
|
+
output.print(colors.blue(` ${colors.bold('AI is enabled! (experimental)')} Write what you want and make AI run it`));
|
|
55
|
+
output.print(colors.blue(' Please note, only HTML fragments with interactive elements are sent to AI provider'));
|
|
59
56
|
output.print(colors.blue(' Ideas: ask it to fill forms for you or to click'));
|
|
60
|
-
} else {
|
|
61
|
-
output.print(colors.blue(` Enable OpenAI assistant by setting ${colors.bold('OPENAI_API_KEY')} env variable`));
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
59
|
rl = readline.createInterface(process.stdin, process.stdout, completer);
|
|
@@ -125,7 +120,7 @@ async function parseInput(cmd) {
|
|
|
125
120
|
} finally {
|
|
126
121
|
output.level(currentOutputLevel);
|
|
127
122
|
}
|
|
128
|
-
|
|
123
|
+
|
|
129
124
|
const spinner = ora("Processing OpenAI request...").start();
|
|
130
125
|
cmd = await aiAssistant.writeSteps(cmd);
|
|
131
126
|
spinner.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2-beta.1",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@codeceptjs/configure": "1.0.1",
|
|
72
|
-
"@codeceptjs/helper": "2.0.
|
|
72
|
+
"@codeceptjs/helper": "2.0.4",
|
|
73
73
|
"@cucumber/cucumber-expressions": "17",
|
|
74
74
|
"@cucumber/gherkin": "26",
|
|
75
75
|
"@cucumber/messages": "24.1.0",
|
|
@@ -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
|
/**
|