@wopee-io/wopee.pw 4.11.0 → 4.11.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/build/shared/metadata/versionMetadata.js +2 -2
- package/build/tools/wopee-reporter/helpers/generateTestRunId.d.ts +1 -0
- package/build/tools/wopee-reporter/helpers/generateTestRunId.js +8 -0
- package/build/tools/wopee-reporter/helpers/generateTestRunId.js.map +1 -0
- package/build/tools/wopee-reporter/helpers/index.d.ts +3 -0
- package/build/tools/wopee-reporter/helpers/index.js +8 -0
- package/build/tools/wopee-reporter/helpers/index.js.map +1 -0
- package/build/tools/wopee-reporter/helpers/parseError.d.ts +6 -0
- package/build/tools/wopee-reporter/helpers/parseError.js +18 -0
- package/build/tools/wopee-reporter/helpers/parseError.js.map +1 -0
- package/build/tools/wopee-reporter/wopeeReporter.js +3 -3
- package/build/tools/wopee-reporter/wopeeReporter.js.map +1 -1
- package/package.json +5 -1
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.logVersionMetadata = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const logVersionMetadata = () => {
|
|
6
|
-
let version = "4.11.
|
|
7
|
-
let hash = "
|
|
6
|
+
let version = "4.11.1"
|
|
7
|
+
let hash = "d02c09a206aaf09258844f2ea164d09a2dc629cc"
|
|
8
8
|
if (version === '__LOCAL__') {
|
|
9
9
|
version = process.env.npm_package_version || '__LOCAL__';
|
|
10
10
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateTestRunId(): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTestRunId = void 0;
|
|
4
|
+
function generateTestRunId() {
|
|
5
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 10)}`;
|
|
6
|
+
}
|
|
7
|
+
exports.generateTestRunId = generateTestRunId;
|
|
8
|
+
//# sourceMappingURL=generateTestRunId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateTestRunId.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/generateTestRunId.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB;IAC/B,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACxE,CAAC;AAFD,8CAEC","sourcesContent":["export function generateTestRunId() {\n return `${Date.now()}-${Math.random().toString(36).substring(2, 10)}`;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseError = exports.generateTestRunId = void 0;
|
|
4
|
+
const generateTestRunId_js_1 = require("./generateTestRunId.js");
|
|
5
|
+
Object.defineProperty(exports, "generateTestRunId", { enumerable: true, get: function () { return generateTestRunId_js_1.generateTestRunId; } });
|
|
6
|
+
const parseError_js_1 = require("./parseError.js");
|
|
7
|
+
Object.defineProperty(exports, "parseError", { enumerable: true, get: function () { return parseError_js_1.parseError; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/index.ts"],"names":[],"mappings":";;;AAAA,iEAA2D;AAGlD,kGAHA,wCAAiB,OAGA;AAF1B,mDAA6C;AAEjB,2FAFnB,0BAAU,OAEmB","sourcesContent":["import { generateTestRunId } from './generateTestRunId.js';\nimport { parseError } from './parseError.js';\n\nexport { generateTestRunId, parseError };\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseError = void 0;
|
|
4
|
+
const ansiRegex = new RegExp('([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))', 'g');
|
|
5
|
+
function stripAnsiEscapes(str) {
|
|
6
|
+
if (!str)
|
|
7
|
+
return str;
|
|
8
|
+
return str.replace(ansiRegex, '');
|
|
9
|
+
}
|
|
10
|
+
function parseError(error) {
|
|
11
|
+
return {
|
|
12
|
+
message: stripAnsiEscapes(error.message),
|
|
13
|
+
stack: stripAnsiEscapes(error.stack),
|
|
14
|
+
snippet: stripAnsiEscapes(error.snippet),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.parseError = parseError;
|
|
18
|
+
//# sourceMappingURL=parseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseError.js","sourceRoot":"","sources":["../../../../lib/tools/wopee-reporter/helpers/parseError.ts"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAG,IAAI,MAAM,CAC1B,wJAAwJ,EACxJ,GAAG,CACJ,CAAC;AACF,SAAS,gBAAgB,CAAC,GAAuB;IAC/C,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,SAAgB,UAAU,CAAC,KAAgB;IACzC,OAAO;QACL,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;QACxC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC;QACpC,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;KACzC,CAAC;AACJ,CAAC;AAND,gCAMC","sourcesContent":["import type { TestError } from '@playwright/test/reporter';\n\nconst ansiRegex = new RegExp(\n '([\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:[a-zA-Z\\\\d]*(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)|(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~])))',\n 'g',\n);\nfunction stripAnsiEscapes(str: string | undefined): string | undefined {\n if (!str) return str;\n return str.replace(ansiRegex, '');\n}\n\nexport function parseError(error: TestError) {\n return {\n message: stripAnsiEscapes(error.message),\n stack: stripAnsiEscapes(error.stack),\n snippet: stripAnsiEscapes(error.snippet),\n };\n}\n"]}
|
|
@@ -13,8 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.WopeeReporter = void 0;
|
|
16
|
+
const helpers_1 = require("./helpers");
|
|
16
17
|
const wopeeReporter_interface_js_1 = require("./types/wopeeReporter.interface.js");
|
|
17
|
-
const utils_1 = require("./utils");
|
|
18
18
|
const axios_1 = __importDefault(require("axios"));
|
|
19
19
|
require("dotenv/config");
|
|
20
20
|
const { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;
|
|
@@ -22,7 +22,7 @@ class WopeeReporter {
|
|
|
22
22
|
onTestEnd(test) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
var _a, _b, _c, _d, _e;
|
|
25
|
-
const testRunId = (0,
|
|
25
|
+
const testRunId = (0, helpers_1.generateTestRunId)();
|
|
26
26
|
const testResults = (_a = test.results) === null || _a === void 0 ? void 0 : _a[0];
|
|
27
27
|
const wopeeScenarioUuid = (_c = (_b = testResults === null || testResults === void 0 ? void 0 : testResults.attachments.find((a) => (a === null || a === void 0 ? void 0 : a.name) === 'wopee-scenario-uuid')) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.toString('utf-8');
|
|
28
28
|
const steps = testResults === null || testResults === void 0 ? void 0 : testResults.steps.map((step, index) => ({
|
|
@@ -31,7 +31,7 @@ class WopeeReporter {
|
|
|
31
31
|
testTitle: test.title,
|
|
32
32
|
title: step.title,
|
|
33
33
|
status: step.error ? 'failed' : 'passed',
|
|
34
|
-
error: step.error ? (0,
|
|
34
|
+
error: step.error ? (0, helpers_1.parseError)(step.error) : step.error,
|
|
35
35
|
category: step.category,
|
|
36
36
|
location: step.location,
|
|
37
37
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"wopeeReporter.js","sourceRoot":"","sources":["../../../lib/tools/wopee-reporter/wopeeReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAA0D;AAC1D,mFAG4C;AAE5C,kDAA0B;AAC1B,yBAAuB;AAEvB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAEzE,MAAa,aAAa;IAClB,SAAS,CAAC,IAAc;;;YAC5B,MAAM,SAAS,GAAG,IAAA,2BAAiB,GAAE,CAAC;YACtC,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAG,CAAC,CAAC,CAAC;YACtC,MAAM,iBAAiB,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAC/C,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,MAAK,qBAAqB,CAAC,0CAC7C,IAAI,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE5B,MAAM,KAAK,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAA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CAAC,KAAK,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;oBACnD,MAAM,IAAI,KAAK,CAAC,wCAAwC,MAAM,GAAG,CAAC,CAAC;gBACrE,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;KAAA;CACF;AArDD,sCAqDC","sourcesContent":["import { generateTestRunId, parseError } from './helpers';\nimport {\n ExtendIntegrationScenarioPayload,\n ExtendIntegrationScenarioPayloadSchema,\n} from './types/wopeeReporter.interface.js';\nimport type { Reporter, TestCase } from '@playwright/test/reporter';\nimport axios from 'axios';\nimport 'dotenv/config';\n\nconst { WOPEE_API_KEY, WOPEE_API_URL, WOPEE_PROJECT_UUID } = process.env;\n\nexport class WopeeReporter implements Reporter {\n async onTestEnd(test: TestCase) {\n const testRunId = generateTestRunId();\n const testResults = test.results?.[0];\n const wopeeScenarioUuid = testResults?.attachments\n .find((a) => a?.name === 'wopee-scenario-uuid')\n ?.body?.toString('utf-8');\n\n const steps = testResults?.steps.map((step, index) => ({\n testRunId,\n number: index + 1,\n testTitle: test.title,\n title: step.title,\n status: step.error ? 'failed' : 'passed',\n error: step.error ? parseError(step.error) : step.error,\n category: step.category,\n location: step.location,\n }));\n\n const query = `\n mutation ExtendIntegrationScenario($input: ExtendIntegrationScenarioInput!) {\n extendIntegrationScenario(input: $input)\n }`;\n\n const extendIntegrationScenarioPayload: ExtendIntegrationScenarioPayload = {\n input: {\n projectUuid: WOPEE_PROJECT_UUID,\n scenarioUuid: wopeeScenarioUuid,\n pwSteps: JSON.stringify(steps),\n },\n };\n const variables = ExtendIntegrationScenarioPayloadSchema.parse(extendIntegrationScenarioPayload);\n\n try {\n return await axios.post(\n WOPEE_API_URL,\n { query, variables },\n {\n headers: {\n api_key: WOPEE_API_KEY,\n },\n },\n );\n } catch (error) {\n if (axios.isAxiosError(error)) {\n const status = error.response?.status;\n const errorData = error.response?.data;\n console.error('[WOPEE_REPORTER_ERROR]', errorData);\n throw new Error(`API request failed with status code: ${status}.`);\n }\n throw new Error('Unexpected error occurred during API call.');\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wopee-io/wopee.pw",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Wopee's Playwright integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visual testing",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build:win": "rm -rf ./build/ && npx tsc && node utils/addVersionToBuild.mjs"
|
|
12
12
|
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./build/index.js",
|
|
15
|
+
"./wopee-reporter": "./build/tools/wopee-reporter/index.js"
|
|
16
|
+
},
|
|
13
17
|
"author": "Ondrej Winter <ondrej.winter@gmail.com>",
|
|
14
18
|
"license": "PROPRIETARY",
|
|
15
19
|
"homepage": "https://Wopee.io",
|