@sentinelqa/playwright 0.1.0 → 0.1.3

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 CHANGED
@@ -34,6 +34,12 @@ Set your ingest token in CI:
34
34
  SENTINEL_TOKEN=your_project_ingest_token
35
35
  ```
36
36
 
37
+ Optional local upload guardrail:
38
+
39
+ ```bash
40
+ SENTINEL_UPLOAD_LOCAL=1
41
+ ```
42
+
37
43
  Then keep your existing Playwright command:
38
44
 
39
45
  ```bash
@@ -50,5 +56,5 @@ npx playwright test
50
56
  ## Notes
51
57
 
52
58
  - Uploads run only when `SENTINEL_TOKEN` is set
53
- - Uploads currently require GitHub Actions, GitLab CI, or CircleCI metadata
54
- - Local runs keep working; upload is skipped outside supported CI providers
59
+ - CI uploads work on GitHub Actions, GitLab CI, and CircleCI
60
+ - Local uploads are disabled by default and require `SENTINEL_UPLOAD_LOCAL=1`
package/dist/env.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const loadSentinelEnv: () => void;
package/dist/env.js ADDED
@@ -0,0 +1,45 @@
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.loadSentinelEnv = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const parseLine = (line) => {
10
+ const trimmed = line.trim();
11
+ if (!trimmed || trimmed.startsWith("#"))
12
+ return null;
13
+ const eqIndex = trimmed.indexOf("=");
14
+ if (eqIndex === -1)
15
+ return null;
16
+ const key = trimmed.slice(0, eqIndex).trim();
17
+ if (!key)
18
+ return null;
19
+ let value = trimmed.slice(eqIndex + 1).trim();
20
+ if ((value.startsWith('"') && value.endsWith('"')) ||
21
+ (value.startsWith("'") && value.endsWith("'"))) {
22
+ value = value.slice(1, -1);
23
+ }
24
+ return { key, value };
25
+ };
26
+ const loadSentinelEnv = () => {
27
+ const candidates = [".env", ".env.local"];
28
+ for (const candidate of candidates) {
29
+ const fullPath = path_1.default.resolve(process.cwd(), candidate);
30
+ if (!fs_1.default.existsSync(fullPath))
31
+ continue;
32
+ if (!fs_1.default.statSync(fullPath).isFile())
33
+ continue;
34
+ const raw = fs_1.default.readFileSync(fullPath, "utf8");
35
+ for (const line of raw.split(/\r?\n/)) {
36
+ const parsed = parseLine(line);
37
+ if (!parsed)
38
+ continue;
39
+ if (typeof process.env[parsed.key] === "undefined") {
40
+ process.env[parsed.key] = parsed.value;
41
+ }
42
+ }
43
+ }
44
+ };
45
+ exports.loadSentinelEnv = loadSentinelEnv;
package/dist/reporter.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const node_1 = require("@sentinelqa/uploader/node");
3
+ const env_1 = require("./env");
3
4
  const pluralize = (count, singular, plural) => {
4
5
  return count === 1 ? singular : plural;
5
6
  };
@@ -7,6 +8,7 @@ class SentinelReporter {
7
8
  constructor(options) {
8
9
  this.failedCount = 0;
9
10
  this.totalCount = 0;
11
+ (0, env_1.loadSentinelEnv)();
10
12
  this.options = options;
11
13
  }
12
14
  onBegin(config, suite) {
@@ -26,11 +28,15 @@ class SentinelReporter {
26
28
  console.log("Playwright run finished");
27
29
  console.log(`${this.failedCount} ${pluralize(this.failedCount, "test", "tests")} failed`);
28
30
  if (!process.env.SENTINEL_TOKEN) {
31
+ console.log("");
32
+ console.log("Sentinel upload disabled. Set SENTINEL_TOKEN to enable uploads.");
29
33
  return;
30
34
  }
31
- if (!(0, node_1.hasSupportedCiEnv)(process.env)) {
35
+ const hasCiEnv = (0, node_1.hasSupportedCiEnv)(process.env);
36
+ const localUploadEnabled = (0, node_1.isLocalUploadEnabled)(process.env);
37
+ if (!hasCiEnv && !localUploadEnabled) {
32
38
  console.log("");
33
- console.log("Skipping Sentinel upload because no supported CI environment was detected.");
39
+ console.log("Sentinel local upload disabled. Set SENTINEL_UPLOAD_LOCAL=1 to enable.");
34
40
  return;
35
41
  }
36
42
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentinelqa/playwright",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "description": "Playwright config wrapper and reporter for SentinelQA",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "@playwright/test": ">=1.40.0"
35
35
  },
36
36
  "dependencies": {
37
- "@sentinelqa/uploader": "^0.1.20"
37
+ "@sentinelqa/uploader": "^0.1.21"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsc -p tsconfig.json",