@sentinelqa/playwright-reporter 0.1.21 → 0.1.22
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/README.md +12 -1
- package/dist/localReport.js +5 -7
- package/dist/reporter.js +8 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,7 +93,7 @@ If `SENTINEL_TOKEN` is not set, the reporter generates a local HTML debugging re
|
|
|
93
93
|
|
|
94
94
|
### Cloud mode
|
|
95
95
|
|
|
96
|
-
If `SENTINEL_TOKEN` is set, the reporter uploads the run to Sentinel instead of generating the local HTML report.
|
|
96
|
+
If `SENTINEL_TOKEN` is set in CI, the reporter uploads the run to Sentinel instead of generating the local HTML report.
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
SENTINEL_TOKEN=your_project_ingest_token npx playwright test
|
|
@@ -101,6 +101,17 @@ SENTINEL_TOKEN=your_project_ingest_token npx playwright test
|
|
|
101
101
|
|
|
102
102
|
For intentional uploads outside CI, also set `SENTINEL_UPLOAD_LOCAL=1` and provide the usual commit and run metadata expected by the uploader.
|
|
103
103
|
|
|
104
|
+
Example:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
SENTINEL_TOKEN=your_project_ingest_token \
|
|
108
|
+
SENTINEL_UPLOAD_LOCAL=1 \
|
|
109
|
+
GITHUB_SHA=abc123 \
|
|
110
|
+
GITHUB_REF_NAME=main \
|
|
111
|
+
GITHUB_RUN_ID=local-dev \
|
|
112
|
+
npx playwright test
|
|
113
|
+
```
|
|
114
|
+
|
|
104
115
|
## What `withSentinel()` does
|
|
105
116
|
|
|
106
117
|
- Preserves your existing reporter configuration
|
package/dist/localReport.js
CHANGED
|
@@ -927,13 +927,11 @@ const buildHtml = (tests, summary, extraArtifacts) => {
|
|
|
927
927
|
var tracePath = button.getAttribute("data-trace-path");
|
|
928
928
|
if (!tracePath) return;
|
|
929
929
|
try {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
);
|
|
936
|
-
}
|
|
930
|
+
var traceUrl = new URL(tracePath, window.location.href).href;
|
|
931
|
+
button.setAttribute(
|
|
932
|
+
"href",
|
|
933
|
+
"https://trace.playwright.dev/?trace=" + encodeURIComponent(traceUrl)
|
|
934
|
+
);
|
|
937
935
|
} catch (_error) {
|
|
938
936
|
// Keep the raw trace file link as fallback.
|
|
939
937
|
}
|
package/dist/reporter.js
CHANGED
|
@@ -86,7 +86,9 @@ class SentinelReporter {
|
|
|
86
86
|
}
|
|
87
87
|
async onEnd() {
|
|
88
88
|
const hasSentinelToken = Boolean(process.env.SENTINEL_TOKEN);
|
|
89
|
-
|
|
89
|
+
const hasCiEnv = (0, node_1.hasSupportedCiEnv)(process.env);
|
|
90
|
+
const localUploadEnabled = (0, node_1.isLocalUploadEnabled)(process.env);
|
|
91
|
+
if (!hasSentinelToken || (!hasCiEnv && !localUploadEnabled)) {
|
|
90
92
|
const localReport = (0, localReport_1.generateLocalDebugReport)({
|
|
91
93
|
playwrightJsonPath: this.options.playwrightJsonPath,
|
|
92
94
|
playwrightReportDir: this.options.playwrightReportDir,
|
|
@@ -98,25 +100,16 @@ class SentinelReporter {
|
|
|
98
100
|
});
|
|
99
101
|
this.printLocalReport(localReport.htmlPath);
|
|
100
102
|
console.log("");
|
|
103
|
+
if (hasSentinelToken && !hasCiEnv && !localUploadEnabled) {
|
|
104
|
+
console.log("Sentinel upload skipped for this local run.");
|
|
105
|
+
console.log("To upload local runs, set SENTINEL_UPLOAD_LOCAL=1 and provide the required CI metadata.");
|
|
106
|
+
console.log("");
|
|
107
|
+
}
|
|
101
108
|
return;
|
|
102
109
|
}
|
|
103
|
-
const hasCiEnv = (0, node_1.hasSupportedCiEnv)(process.env);
|
|
104
|
-
const localUploadEnabled = (0, node_1.isLocalUploadEnabled)(process.env);
|
|
105
110
|
console.log("");
|
|
106
111
|
console.log("Uploading failure artifacts to Sentinel...");
|
|
107
112
|
console.log("");
|
|
108
|
-
if (!hasCiEnv && !localUploadEnabled) {
|
|
109
|
-
console.log("Local upload mode detected.");
|
|
110
|
-
console.log("If this run is outside CI, set SENTINEL_UPLOAD_LOCAL=1 and provide the required CI metadata.");
|
|
111
|
-
console.log("");
|
|
112
|
-
console.log("Typical local upload environment variables:");
|
|
113
|
-
console.log("• SENTINEL_UPLOAD_LOCAL=1");
|
|
114
|
-
console.log("• CI_COMMIT_SHA or GITHUB_SHA");
|
|
115
|
-
console.log("• CI_COMMIT_REF_NAME or GITHUB_REF_NAME");
|
|
116
|
-
console.log("• CI_JOB_URL or a matching run URL");
|
|
117
|
-
console.log("• CI_PIPELINE_ID or GITHUB_RUN_ID");
|
|
118
|
-
console.log("");
|
|
119
|
-
}
|
|
120
113
|
const exitCode = await (0, node_1.runSentinelUpload)({
|
|
121
114
|
playwrightJsonPath: this.options.playwrightJsonPath,
|
|
122
115
|
playwrightReportDir: this.options.playwrightReportDir,
|