@syngrisi/wdio-sdk 3.14.0 → 3.15.0
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/dist/WDIODriver.js +3 -4
- package/dist/schemas/WDIODriver.js +1 -10
- package/package.json +3 -4
- package/dist/lib/paramsGuard.js +0 -18
- package/dist/lib/utils.js +0 -29
package/dist/WDIODriver.js
CHANGED
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "collectDomTree", { enumerable: true, get: functi
|
|
|
11
11
|
const WDIODriver_1 = require("./schemas/WDIODriver");
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
const wdioHelpers_1 = require("./lib/wdioHelpers");
|
|
14
|
-
const paramsGuard_1 = require("./lib/paramsGuard");
|
|
15
14
|
const log = (0, logger_1.default)('syngrisi-wdio-sdk');
|
|
16
15
|
// 0 | 4 | 2 | 1 | 3 | 5 | "trace" | "debug" | "info" | "warn" | "error" |
|
|
17
16
|
if (process.env.SYNGRISI_LOG_LEVEL) {
|
|
@@ -62,7 +61,7 @@ class WDIODriver {
|
|
|
62
61
|
*/
|
|
63
62
|
async startTestSession({ params, suppressErrors = false }) {
|
|
64
63
|
try {
|
|
65
|
-
(0,
|
|
64
|
+
(0, core_api_1.paramsGuard)(params, 'startTestSession, params', WDIODriver_1.SessionParamsSchema);
|
|
66
65
|
this.params.test = {
|
|
67
66
|
os: params.os || await (0, wdioHelpers_1.getOS)(),
|
|
68
67
|
viewport: params.viewport || await (0, wdioHelpers_1.getViewport)(),
|
|
@@ -148,7 +147,7 @@ class WDIODriver {
|
|
|
148
147
|
app: params.app || this.params.test.app,
|
|
149
148
|
branch: params.branch || this.params.test.branch,
|
|
150
149
|
};
|
|
151
|
-
(0,
|
|
150
|
+
(0, core_api_1.paramsGuard)(opts, 'getBaseline, opts', WDIODriver_1.BaselineParamsSchema);
|
|
152
151
|
const result = await this.api.getBaselines(opts);
|
|
153
152
|
if (result.error) {
|
|
154
153
|
throw `❌ Get baselines error: ${JSON.stringify(result, null, ' ')}`;
|
|
@@ -230,7 +229,7 @@ class WDIODriver {
|
|
|
230
229
|
domDump: skipDomData ? undefined : domDump,
|
|
231
230
|
skipDomData: skipDomData || undefined,
|
|
232
231
|
};
|
|
233
|
-
(0,
|
|
232
|
+
(0, core_api_1.paramsGuard)(opts, 'check, opts', core_api_1.CheckParamsSchema);
|
|
234
233
|
// Remove autoAccept from params before sending to API (it's SDK-only)
|
|
235
234
|
const { autoAccept: checkAutoAccept, ...apiParams } = params || {};
|
|
236
235
|
Object.assign(opts, apiParams);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SessionParamsSchema = exports.
|
|
3
|
+
exports.SessionParamsSchema = exports.BaselineParamsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.BaselineParamsSchema = zod_1.z.object({
|
|
6
6
|
// ident
|
|
@@ -11,15 +11,6 @@ exports.BaselineParamsSchema = zod_1.z.object({
|
|
|
11
11
|
app: zod_1.z.string().min(1).optional(),
|
|
12
12
|
branch: zod_1.z.string().min(1).optional(),
|
|
13
13
|
});
|
|
14
|
-
exports.RequiredIdentOptionsSchema = zod_1.z.object({
|
|
15
|
-
name: zod_1.z.string().min(1),
|
|
16
|
-
viewport: zod_1.z.string().min(3),
|
|
17
|
-
browserName: zod_1.z.string().min(1),
|
|
18
|
-
os: zod_1.z.string().min(1),
|
|
19
|
-
app: zod_1.z.string().min(1),
|
|
20
|
-
branch: zod_1.z.string().min(1),
|
|
21
|
-
imghash: zod_1.z.string().length(128)
|
|
22
|
-
});
|
|
23
14
|
exports.SessionParamsSchema = zod_1.z.object({
|
|
24
15
|
run: zod_1.z.string().min(1),
|
|
25
16
|
runident: zod_1.z.string().min(1),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syngrisi/wdio-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "Syngrisi WebdriverIO SDK — visual regression testing for the Syngrisi Visual Testing Platform",
|
|
5
5
|
"main": "dist/WDIODriver.js",
|
|
6
6
|
"types": "dist/WDIODriver.d.ts",
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/syngrisi/syngrisi/tree/main/packages/wdio-sdk#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syngrisi/core-api": "^3.
|
|
41
|
+
"@syngrisi/core-api": "^3.15.0",
|
|
42
42
|
"form-data": "^4.0.6",
|
|
43
|
-
"got-cjs": "^12.5.4",
|
|
44
43
|
"loglevel": "^1.9.2",
|
|
45
44
|
"zod": "^4.1.13"
|
|
46
45
|
},
|
|
@@ -64,5 +63,5 @@
|
|
|
64
63
|
"typescript": "^6.0.3",
|
|
65
64
|
"vitest": "^4.1.9"
|
|
66
65
|
},
|
|
67
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8399aedee1cf7a73fa4ca4a3cb38f303f1593004"
|
|
68
67
|
}
|
package/dist/lib/paramsGuard.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.paramsGuard = void 0;
|
|
4
|
-
const paramsGuard = (params, functionName, schema) => {
|
|
5
|
-
const result = schema.safeParse(params);
|
|
6
|
-
if (result.success) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
const errorDetails = result.error.format();
|
|
11
|
-
throw new Error(`
|
|
12
|
-
Invalid '${functionName}' parameters: ${JSON.stringify(errorDetails)}
|
|
13
|
-
\n error: ${result.error?.stack || result.error}
|
|
14
|
-
\n params: ${JSON.stringify(params, null, 2)}
|
|
15
|
-
`);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
exports.paramsGuard = paramsGuard;
|
package/dist/lib/utils.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.prettyCheckResult = exports.printErrorResponseBody = void 0;
|
|
7
|
-
const logger_1 = __importDefault(require("./logger"));
|
|
8
|
-
const log = (0, logger_1.default)('syngrisi-wdio-sdk');
|
|
9
|
-
if (process.env.SYNGRISI_LOG_LEVEL) {
|
|
10
|
-
log.setLevel(process.env.SYNGRISI_LOG_LEVEL);
|
|
11
|
-
}
|
|
12
|
-
const printErrorResponseBody = (e) => {
|
|
13
|
-
if (e.response && e.response?.body) {
|
|
14
|
-
log.error(`ERROR RESPONSE BODY: ${e.response?.body}`);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.printErrorResponseBody = printErrorResponseBody;
|
|
18
|
-
const prettyCheckResult = (result) => {
|
|
19
|
-
if (!result.domDump) {
|
|
20
|
-
return JSON.stringify(result);
|
|
21
|
-
}
|
|
22
|
-
const dump = JSON.parse(result.domDump);
|
|
23
|
-
const resObs = { ...result };
|
|
24
|
-
delete resObs.domDump;
|
|
25
|
-
resObs.domDump = `${JSON.stringify(dump)
|
|
26
|
-
.substr(0, 20)}... and about ${dump.length} items]`;
|
|
27
|
-
return JSON.stringify(resObs);
|
|
28
|
-
};
|
|
29
|
-
exports.prettyCheckResult = prettyCheckResult;
|