@capillarytech/cap-ui-utils 3.2.0-beta.3 → 3.2.0-beta.4

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/e2e/README.md CHANGED
@@ -71,7 +71,11 @@ import { waitForApi } from '@capillarytech/cap-ui-utils/e2e/playwright/waits';
71
71
  `doLogin()`; also exported standalone as `attachApiFailureLogger(page, {baseUrl})`.
72
72
  - **`playwright/config`** — `createPlaywrightConfig()` wires the reporter, selects the
73
73
  suite via `SUITE` → `@<suite>` grep (mirrors `wdio --suite`), and sets pod-friendly
74
- defaults (headless chromium, trace/screenshot on failure, retries).
74
+ defaults (headless chromium, trace/screenshot on failure, retries). Workers are
75
+ resolvable PER SUITE: `workersBySuite: { smoke: 2, sanity: 1, regression: 1 }`
76
+ (smoke is parallel-safe; sanity/regression builders are stateful on a shared org).
77
+ Default parallelism matches the WDIO module configs (`maxInstances: MAX_INSTANCES || 2`).
78
+ Precedence: `PW_WORKERS_<SUITE>` > `workersBySuite` > `PW_WORKERS` > `MAX_INSTANCES` > `workers` > 2.
75
79
  - **`playwright/login`** — Playwright port of `pages/common/login.page` (intouch V2/V1).
76
80
  - **`playwright/waits`** — network-driven wait helpers (no fixed sleeps).
77
81
 
@@ -22,6 +22,30 @@ function num(v, dflt) {
22
22
  return Number.isFinite(n) ? n : dflt;
23
23
  }
24
24
 
25
+ /**
26
+ * Per-suite worker resolution — parallelism DEFAULT matches the WDIO module
27
+ * configs: `maxInstances: Number(process.env.MAX_INSTANCES) || 2` (2 browser
28
+ * instances is the pod-proven ceiling — 3 pushed the container over its 4Gi
29
+ * limit). Additionally declarable PER SUITE, which WDIO couldn't do: stateful
30
+ * sanity/regression builders on a shared org can be pinned serial while smoke
31
+ * stays parallel. Precedence:
32
+ * 1. env PW_WORKERS_<SUITE> (ops override for one suite, no code change)
33
+ * 2. overrides.workersBySuite (the module's checked-in per-suite intent,
34
+ * e.g. { smoke: 2, sanity: 1, regression: 1 })
35
+ * 3. env PW_WORKERS (global override — deliberately BELOW
36
+ * workersBySuite so it can't parallelize a suite the module marked serial)
37
+ * 4. env MAX_INSTANCES (the WDIO-era knob, honoured for continuity)
38
+ * 5. overrides.workers, then 2 (== WDIO maxInstances default)
39
+ */
40
+ function resolveWorkers(overrides, suite) {
41
+ const suiteEnv = suite ? process.env["PW_WORKERS_" + suite.toUpperCase()] : undefined;
42
+ const bySuite = overrides.workersBySuite || {};
43
+ const fromCode = bySuite[suite] !== undefined ? bySuite[suite]
44
+ : num(process.env.PW_WORKERS,
45
+ num(process.env.MAX_INSTANCES, overrides.workers !== undefined ? overrides.workers : 2));
46
+ return num(suiteEnv, fromCode);
47
+ }
48
+
25
49
  function createPlaywrightConfig(overrides = {}) {
26
50
  const suite = process.env.SUITE || process.env.suite || "";
27
51
  const reporterPath = require.resolve("./reporter");
@@ -32,7 +56,7 @@ function createPlaywrightConfig(overrides = {}) {
32
56
  fullyParallel: overrides.fullyParallel !== undefined ? overrides.fullyParallel : true,
33
57
  forbidOnly: !!process.env.CI,
34
58
  retries: num(process.env.PW_RETRIES, overrides.retries !== undefined ? overrides.retries : 1),
35
- workers: num(process.env.PW_WORKERS, overrides.workers !== undefined ? overrides.workers : 1),
59
+ workers: resolveWorkers(overrides, suite),
36
60
  timeout: num(process.env.PW_TIMEOUT, overrides.timeout || 90000),
37
61
  expect: { timeout: num(process.env.PW_EXPECT_TIMEOUT, 15000) },
38
62
  // Only the migrated suite runs — same behaviour as `wdio --suite <suite>`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "3.2.0-beta.3",
3
+ "version": "3.2.0-beta.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },