@sentinelqa/playwright-reporter 0.1.9 → 0.1.11
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/index.js +13 -4
- package/dist/reporter.js +11 -2
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ function withSentinel(config, options = {}) {
|
|
|
70
70
|
const existingHtmlReporter = reporters.find((entry) => getReporterName(entry) === "html");
|
|
71
71
|
const existingJsonOutputFile = getReporterOptions(existingJsonReporter).outputFile;
|
|
72
72
|
const existingHtmlOutputFolder = getReporterOptions(existingHtmlReporter).outputFolder;
|
|
73
|
+
const shouldUsePlaywrightHtmlReporter = Boolean(process.env.SENTINEL_TOKEN) || typeof existingHtmlOutputFolder === "string";
|
|
73
74
|
const testResultsDir = options.testResultsDir || config.outputDir || DEFAULT_TEST_RESULTS_DIR;
|
|
74
75
|
const playwrightReportDir = options.playwrightReportDir ||
|
|
75
76
|
(typeof existingHtmlOutputFolder === "string"
|
|
@@ -84,10 +85,18 @@ function withSentinel(config, options = {}) {
|
|
|
84
85
|
.map((entry) => normalizePath(entry))));
|
|
85
86
|
nextConfig.outputDir = testResultsDir;
|
|
86
87
|
setReporterOptions(reporters, "json", { outputFile: playwrightJsonPath });
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (shouldUsePlaywrightHtmlReporter) {
|
|
89
|
+
setReporterOptions(reporters, "html", {
|
|
90
|
+
outputFolder: playwrightReportDir,
|
|
91
|
+
open: "never"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const htmlReporterIndex = reporters.findIndex((entry) => getReporterName(entry) === "html");
|
|
96
|
+
if (htmlReporterIndex !== -1) {
|
|
97
|
+
reporters.splice(htmlReporterIndex, 1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
91
100
|
const sentinelReporterPath = require.resolve("./reporter");
|
|
92
101
|
const sentinelReporterOptions = {
|
|
93
102
|
project: options.project || null,
|
package/dist/reporter.js
CHANGED
|
@@ -3,12 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
const path_1 = __importDefault(require("path"));
|
|
6
|
+
const url_1 = require("url");
|
|
6
7
|
const node_1 = require("@sentinelqa/uploader/node");
|
|
7
8
|
const env_1 = require("./env");
|
|
8
9
|
const localReport_1 = require("./localReport");
|
|
9
10
|
const pluralize = (count, singular, plural) => {
|
|
10
11
|
return count === 1 ? singular : plural;
|
|
11
12
|
};
|
|
13
|
+
const formatTerminalLink = (label, target) => {
|
|
14
|
+
if (!process.stdout.isTTY)
|
|
15
|
+
return label;
|
|
16
|
+
return `\u001B]8;;${target}\u0007${label}\u001B]8;;\u0007`;
|
|
17
|
+
};
|
|
12
18
|
class SentinelReporter {
|
|
13
19
|
constructor(options) {
|
|
14
20
|
this.failedCount = 0;
|
|
@@ -58,7 +64,10 @@ class SentinelReporter {
|
|
|
58
64
|
const relativeReportPath = path_1.default
|
|
59
65
|
.relative(process.cwd(), localReport.htmlPath)
|
|
60
66
|
.replace(/\\/g, "/");
|
|
61
|
-
|
|
67
|
+
const displayPath = relativeReportPath.startsWith(".")
|
|
68
|
+
? relativeReportPath
|
|
69
|
+
: `./${relativeReportPath}`;
|
|
70
|
+
console.log(formatTerminalLink(displayPath, (0, url_1.pathToFileURL)(localReport.htmlPath).href));
|
|
62
71
|
console.log("");
|
|
63
72
|
console.log("Optional:");
|
|
64
73
|
console.log("Upload runs to Sentinel Cloud for:");
|
|
@@ -66,7 +75,7 @@ class SentinelReporter {
|
|
|
66
75
|
console.log("• shareable run links");
|
|
67
76
|
console.log("• AI failure summaries");
|
|
68
77
|
console.log("");
|
|
69
|
-
console.log(
|
|
78
|
+
console.log(`Learn more: ${formatTerminalLink("https://sentinelqa.com", "https://sentinelqa.com")}`);
|
|
70
79
|
return;
|
|
71
80
|
}
|
|
72
81
|
console.log("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentinelqa/playwright-reporter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Playwright reporter for CI debugging with optional Sentinel cloud dashboards",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"prepublishOnly": "npm run build",
|
|
41
42
|
"publish:dry": "npm run build && npm pack --dry-run"
|
|
42
43
|
}
|
|
43
44
|
}
|