@orion-qa/orion 3.2.0 → 3.4.0

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.
Files changed (112) hide show
  1. package/.claude/settings.json +1 -0
  2. package/.claude/skills/appium/SKILL.md +2 -2
  3. package/.claude/skills/appium/templates/ci/github-actions-android.yml +1 -1
  4. package/.claude/skills/appium/templates/ci/github-actions-ios.yml +1 -1
  5. package/.claude/skills/appium/templates/ci/github-actions-windows.yml +1 -1
  6. package/.claude/skills/automation-implementation/SKILL.md +1 -1
  7. package/.claude/skills/automation-strategy/SKILL.md +1 -0
  8. package/.claude/skills/cicd-integration/SKILL.md +1 -1
  9. package/.claude/skills/code-review/SKILL.md +1 -1
  10. package/.claude/skills/code-review/references/pattern-rules.md +1 -0
  11. package/.claude/skills/csharp/SKILL.md +1 -0
  12. package/.claude/skills/documentation/SKILL.md +2 -2
  13. package/.claude/skills/execution/SKILL.md +9 -9
  14. package/.claude/skills/httpclient/templates/ci/github-actions.yml +2 -2
  15. package/.claude/skills/java/SKILL.md +1 -0
  16. package/.claude/skills/javascript/SKILL.md +1 -0
  17. package/.claude/skills/junit5/SKILL.md +1 -1
  18. package/.claude/skills/k6/SKILL.md +1 -1
  19. package/.claude/skills/k6/templates/project/tests/load/products.js +1 -1
  20. package/.claude/skills/karate/SKILL.md +1 -1
  21. package/.claude/skills/karate/templates/ci/github-actions.yml +2 -2
  22. package/.claude/skills/newman/templates/ci/github-actions.yml +2 -2
  23. package/.claude/skills/newman/templates/collection/src/config/env.js +1 -1
  24. package/.claude/skills/nunit/SKILL.md +1 -1
  25. package/.claude/skills/orion/SKILL.md +2 -2
  26. package/.claude/skills/orion/references/assess-fix.md +2 -2
  27. package/.claude/skills/orion/references/batch.md +2 -2
  28. package/.claude/skills/orion/references/capabilities.md +1 -1
  29. package/.claude/skills/orion/references/conversation.md +12 -25
  30. package/.claude/skills/orion/references/greeting.md +23 -0
  31. package/.claude/skills/orion/references/hosts.md +2 -2
  32. package/.claude/skills/orion/references/modes.md +1 -1
  33. package/.claude/skills/orion/references/plain-language.md +5 -2
  34. package/.claude/skills/orion/references/recovery-loop.md +2 -2
  35. package/.claude/skills/orion/references/setup-card.md +1 -1
  36. package/.claude/skills/orion/references/status-lines.md +11 -6
  37. package/.claude/skills/orion/references/task-brief.md +1 -1
  38. package/.claude/skills/orion/scripts/batch_state.mjs +1 -1
  39. package/.claude/skills/orion/scripts/done_check.mjs +12 -5
  40. package/.claude/skills/orion/scripts/quiet.mjs +1 -1
  41. package/.claude/skills/orion/scripts/report_check.mjs +5 -2
  42. package/.claude/skills/orion/scripts/report_make.mjs +186 -0
  43. package/.claude/skills/orion/scripts/results_parse.mjs +7 -0
  44. package/.claude/skills/orion/templates/project-context/assessment.md +1 -1
  45. package/.claude/skills/orion/templates/project-context/report.md +2 -2
  46. package/.claude/skills/pact/SKILL.md +1 -1
  47. package/.claude/skills/playwright/SKILL.md +2 -2
  48. package/.claude/skills/playwright/references/electron.md +1 -1
  49. package/.claude/skills/playwright/templates/README.md +1 -1
  50. package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
  51. package/.claude/skills/playwright/templates/ci/github-actions-dotnet.yml +2 -2
  52. package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +2 -2
  53. package/.claude/skills/playwright/templates/ci/github-actions-python.yml +2 -2
  54. package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
  55. package/.claude/skills/playwright/templates/javascript/.prettierignore +6 -0
  56. package/.claude/skills/playwright/templates/javascript/.prettierrc.json +4 -0
  57. package/.claude/skills/playwright/templates/javascript/fixtures/index.js +56 -48
  58. package/.claude/skills/playwright/templates/javascript/package.json +4 -1
  59. package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +5 -1
  60. package/.claude/skills/playwright/templates/javascript/playwright.config.js +6 -2
  61. package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +92 -15
  62. package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +10 -3
  63. package/.claude/skills/playwright/templates/javascript/src/config/env.js +12 -3
  64. package/.claude/skills/playwright/templates/javascript/src/config/flags.js +3 -1
  65. package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +8 -4
  66. package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +30 -6
  67. package/.claude/skills/playwright/templates/javascript/utils/random.js +3 -1
  68. package/.claude/skills/playwright/templates/project/.prettierignore +6 -0
  69. package/.claude/skills/playwright/templates/project/.prettierrc.json +4 -0
  70. package/.claude/skills/playwright/templates/project/fixtures/index.ts +21 -15
  71. package/.claude/skills/playwright/templates/project/fixtures/session.ts +9 -2
  72. package/.claude/skills/playwright/templates/project/package.json +4 -1
  73. package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +5 -1
  74. package/.claude/skills/playwright/templates/project/playwright.config.ts +4 -2
  75. package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +97 -15
  76. package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +10 -3
  77. package/.claude/skills/playwright/templates/project/src/config/env.ts +15 -4
  78. package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +5 -1
  79. package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +8 -4
  80. package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +30 -6
  81. package/.claude/skills/playwright/templates/project/utils/formFill.ts +4 -1
  82. package/.claude/skills/playwright/templates/project/utils/random.ts +3 -1
  83. package/.claude/skills/playwright/templates/project/utils/redact.ts +4 -1
  84. package/.claude/skills/pytest/SKILL.md +1 -1
  85. package/.claude/skills/python/SKILL.md +1 -0
  86. package/.claude/skills/quality-checks/SKILL.md +1 -1
  87. package/.claude/skills/requests/templates/ci/github-actions.yml +2 -2
  88. package/.claude/skills/rest-assured/SKILL.md +2 -2
  89. package/.claude/skills/rest-assured/templates/ci/github-actions.yml +2 -2
  90. package/.claude/skills/selenium/SKILL.md +1 -1
  91. package/.claude/skills/selenium/templates/ci/github-actions-csharp.yml +2 -2
  92. package/.claude/skills/selenium/templates/ci/github-actions-java.yml +2 -2
  93. package/.claude/skills/selenium/templates/ci/github-actions-python.yml +2 -2
  94. package/.claude/skills/self-healing/SKILL.md +1 -1
  95. package/.claude/skills/test-design/SKILL.md +1 -1
  96. package/.claude/skills/test-reporting/references/report-levels.md +1 -1
  97. package/.claude/skills/test-reporting/references/tool-mapping.md +1 -1
  98. package/.claude/skills/testng/SKILL.md +1 -1
  99. package/.claude/skills/typescript/SKILL.md +1 -0
  100. package/.claude/skills/ui-observation/SKILL.md +1 -1
  101. package/.claude-plugin/plugin.json +1 -1
  102. package/.cursor/commands/orion.md +1 -1
  103. package/.gemini/commands/orion.toml +1 -1
  104. package/.github/prompts/orion.prompt.md +1 -1
  105. package/.windsurf/workflows/orion.md +1 -1
  106. package/AGENTS.md +2 -2
  107. package/README.md +8 -7
  108. package/assets/architecture.svg +1 -1
  109. package/assets/run-flow.svg +1 -1
  110. package/bin/orion.mjs +8 -8
  111. package/hosts/gemini-extension/gemini-extension.json +1 -1
  112. package/package.json +2 -2
@@ -2,7 +2,7 @@
2
2
  # Playwright (.NET, NUnit). Runs on PRs, pushes to the default branch, and on demand: the executor triggers it with
3
3
  # actions_run_trigger (run_workflow) on the work branch and reads the result with get_job_logs.
4
4
  # Actions are pinned to commit SHAs (tag in the comment, resolved 2026-10-15); update them with Dependabot.
5
- # "repeat: 3" runs the selection three times with retries off (the 3-run rule for new tests); any failing run fails the job.
5
+ # "repeat: 3" runs the selection three times with retries off (a stability check); any failing run fails the job.
6
6
  name: e2e
7
7
  on:
8
8
  pull_request:
@@ -22,7 +22,7 @@ on:
22
22
  required: false
23
23
  default: ""
24
24
  repeat:
25
- description: "Runs of the selection (3 for new tests)"
25
+ description: "Runs of the selection (3 for a stability check)"
26
26
  type: choice
27
27
  options: ["1", "3"]
28
28
  default: "1"
@@ -2,7 +2,7 @@
2
2
  # Playwright (JavaScript). Runs on PRs, pushes to the default branch, and on demand: the executor triggers it with
3
3
  # actions_run_trigger (run_workflow) on the work branch and reads the result with get_job_logs.
4
4
  # Actions are pinned to commit SHAs (tag in the comment, resolved 2026-10-15); update them with Dependabot.
5
- # "repeat: 3" runs the selection three times with retries off (the 3-run rule for new tests); any failing run fails the job.
5
+ # "repeat: 3" runs the selection three times with retries off (a stability check); any failing run fails the job.
6
6
  name: e2e
7
7
  on:
8
8
  pull_request:
@@ -22,7 +22,7 @@ on:
22
22
  required: false
23
23
  default: ""
24
24
  repeat:
25
- description: "Runs of the selection (3 for new tests)"
25
+ description: "Runs of the selection (3 for a stability check)"
26
26
  type: choice
27
27
  options: ["1", "3"]
28
28
  default: "1"
@@ -2,7 +2,7 @@
2
2
  # Playwright (Python, pytest). Runs on PRs, pushes to the default branch, and on demand: the executor triggers it with
3
3
  # actions_run_trigger (run_workflow) on the work branch and reads the result with get_job_logs.
4
4
  # Actions are pinned to commit SHAs (tag in the comment, resolved 2026-10-15); update them with Dependabot.
5
- # "repeat: 3" runs the selection three times with retries off (the 3-run rule for new tests); any failing run fails the job.
5
+ # "repeat: 3" runs the selection three times with retries off (a stability check); any failing run fails the job.
6
6
  name: e2e
7
7
  on:
8
8
  pull_request:
@@ -22,7 +22,7 @@ on:
22
22
  required: false
23
23
  default: ""
24
24
  repeat:
25
- description: "Runs of the selection (3 for new tests)"
25
+ description: "Runs of the selection (3 for a stability check)"
26
26
  type: choice
27
27
  options: ["1", "3"]
28
28
  default: "1"
@@ -22,7 +22,7 @@ on:
22
22
  required: false
23
23
  default: ""
24
24
  repeat_each:
25
- description: "Runs per test (3 for new tests, with retries off)"
25
+ description: "Runs per test (3 for a stability check, with retries off)"
26
26
  type: choice
27
27
  options: ["1", "3"]
28
28
  default: "1"
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ playwright-report/
3
+ test-results/
4
+ test-summary/
5
+ reports/
6
+ .auth/
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 120
4
+ }
@@ -32,54 +32,62 @@ const { ensureSession } = require('./session');
32
32
  * @property {void} session Makes sure a project that starts signed in has a usable saved session.
33
33
  */
34
34
 
35
- const test = base.test.extend(/** @type {import('@playwright/test').Fixtures<SuiteFixtures, WorkerFixtures, TestArgs, WorkerArgs>} */ ({
36
- /**
37
- * Before the first test of a worker in a signed-in project: signs in again when the saved session is missing or
38
- * stale (the setup project didn't run, e.g. UI mode with only the tests' project ticked, or the session is old).
39
- * Normal runs, where setup has just signed in, reuse its session and do nothing here.
40
- */
41
- session: [async ({ playwright, browserName, channel, headless, launchOptions }, use, workerInfo) => {
42
- const projectUse = workerInfo.project.use;
43
- if (projectUse.storageState === paths.userSession) {
44
- /** Starts this project's browser, with its channel, only when the session must be renewed. */
45
- const launch = () => playwright[browserName].launch({ ...launchOptions, channel, headless });
46
- const why = await ensureSession(launch, projectUse);
47
- if (why) logger.info(`Signed in again before the tests: ${why}`);
48
- }
49
- await use();
50
- }, { scope: 'worker', auto: true }],
51
- /**
52
- * Playwright's browser context, plus the saved `sessionStorage` when `AUTH_SESSION_STORAGE=1` and the test
53
- * starts signed in (Playwright's own saved state doesn't include it; this is its documented workaround).
54
- */
55
- context: async ({ context, storageState }, use) => {
56
- if (flags.authSessionStorage && storageState && fs.existsSync(paths.sessionStorage)) {
57
- const origin = new URL(env.baseUrl() || 'http://localhost').origin;
58
- const storage = JSON.parse(fs.readFileSync(paths.sessionStorage, 'utf-8'));
59
- await context.addInitScript(({ origin: o, entries }) => {
60
- if (window.location.origin === o) {
61
- for (const [key, value] of Object.entries(entries)) window.sessionStorage.setItem(key, String(value));
35
+ const test = base.test.extend(
36
+ /** @type {import('@playwright/test').Fixtures<SuiteFixtures, WorkerFixtures, TestArgs, WorkerArgs>} */ ({
37
+ /**
38
+ * Before the first test of a worker in a signed-in project: signs in again when the saved session is missing or
39
+ * stale (the setup project didn't run, e.g. UI mode with only the tests' project ticked, or the session is old).
40
+ * Normal runs, where setup has just signed in, reuse its session and do nothing here.
41
+ */
42
+ session: [
43
+ async ({ playwright, browserName, channel, headless, launchOptions }, use, workerInfo) => {
44
+ const projectUse = workerInfo.project.use;
45
+ if (projectUse.storageState === paths.userSession) {
46
+ /** Starts this project's browser, with its channel, only when the session must be renewed. */
47
+ const launch = () => playwright[browserName].launch({ ...launchOptions, channel, headless });
48
+ const why = await ensureSession(launch, projectUse);
49
+ if (why) logger.info(`Signed in again before the tests: ${why}`);
62
50
  }
63
- }, { origin, entries: storage });
64
- }
65
- await use(context);
66
- },
67
- /** The sign-in page. */
68
- loginPage: async ({ page }, use) => {
69
- await use(new LoginPage(page));
70
- },
71
- /** The page a signed-in user lands on. */
72
- homePage: async ({ page }, use) => {
73
- await use(new HomePage(page));
74
- },
75
- /** The app's shell (header, navigation, account menu). */
76
- shellPage: async ({ page }, use) => {
77
- await use(new ShellPage(page));
78
- },
79
- /** The app's HTTP API, with the project's base URL and session. */
80
- apiClient: async ({ request }, use) => {
81
- await use(new ApiClient(request));
82
- },
83
- }));
51
+ await use();
52
+ },
53
+ { scope: 'worker', auto: true },
54
+ ],
55
+ /**
56
+ * Playwright's browser context, plus the saved `sessionStorage` when `AUTH_SESSION_STORAGE=1` and the test
57
+ * starts signed in (Playwright's own saved state doesn't include it; this is its documented workaround).
58
+ */
59
+ context: async ({ context, storageState }, use) => {
60
+ if (flags.authSessionStorage && storageState && fs.existsSync(paths.sessionStorage)) {
61
+ const origin = new URL(env.baseUrl() || 'http://localhost').origin;
62
+ const storage = JSON.parse(fs.readFileSync(paths.sessionStorage, 'utf-8'));
63
+ await context.addInitScript(
64
+ ({ origin: o, entries }) => {
65
+ if (window.location.origin === o) {
66
+ for (const [key, value] of Object.entries(entries)) window.sessionStorage.setItem(key, String(value));
67
+ }
68
+ },
69
+ { origin, entries: storage },
70
+ );
71
+ }
72
+ await use(context);
73
+ },
74
+ /** The sign-in page. */
75
+ loginPage: async ({ page }, use) => {
76
+ await use(new LoginPage(page));
77
+ },
78
+ /** The page a signed-in user lands on. */
79
+ homePage: async ({ page }, use) => {
80
+ await use(new HomePage(page));
81
+ },
82
+ /** The app's shell (header, navigation, account menu). */
83
+ shellPage: async ({ page }, use) => {
84
+ await use(new ShellPage(page));
85
+ },
86
+ /** The app's HTTP API, with the project's base URL and session. */
87
+ apiClient: async ({ request }, use) => {
88
+ await use(new ApiClient(request));
89
+ },
90
+ }),
91
+ );
84
92
 
85
93
  module.exports = { test, expect: base.expect };
@@ -8,10 +8,13 @@
8
8
  "test:regression": "playwright test --project=regression",
9
9
  "test:api": "playwright test --project=api",
10
10
  "test:unit": "playwright test --project=unit",
11
+ "format": "prettier --write \"**/*.{js,ts}\"",
12
+ "format:check": "prettier --check \"**/*.{js,ts}\"",
11
13
  "report": "playwright show-report"
12
14
  },
13
15
  "devDependencies": {
14
16
  "@playwright/test": "{{PLAYWRIGHT_VERSION}}",
15
- "@types/node": "{{TYPES_NODE_VERSION}}"
17
+ "@types/node": "{{TYPES_NODE_VERSION}}",
18
+ "prettier": "{{PRETTIER_VERSION}}"
16
19
  }
17
20
  }
@@ -28,7 +28,11 @@ class BasePage {
28
28
  async open() {
29
29
  if (/\{\{[A-Z_]+\}\}/.test(String(this.path))) {
30
30
  // A starter copied but not filled: say so now, instead of opening /%7B%7BLOGIN_PATH%7D%7D and timing out.
31
- throw new AutomationError('Open', this.path, 'unfilled starter placeholder: fill it in resources/testData from the UI map');
31
+ throw new AutomationError(
32
+ 'Open',
33
+ this.path,
34
+ 'unfilled starter placeholder: fill it in resources/testData from the UI map',
35
+ );
32
36
  }
33
37
  let response;
34
38
  try {
@@ -20,14 +20,18 @@ module.exports = defineConfig({
20
20
  fullyParallel: false,
21
21
  workers: 1,
22
22
  forbidOnly: !!process.env.CI,
23
- // New tests are accepted only after 3 runs with retries off.
23
+ // Retries stay off so a flaky test shows up instead of passing on a retry.
24
24
  retries: 0,
25
25
  // A missing screenshot baseline fails instead of being saved unseen; a person approves it first.
26
26
  updateSnapshots: 'none',
27
27
  timeout: flags.testTimeout,
28
28
  expect: { timeout: flags.expectTimeout },
29
29
  // list while it runs; the one-page summary to read and share (test-summary/index.html); Playwright's report for traces.
30
- reporter: [['list'], [path.join(__dirname, 'reporters', 'summaryReporter.js'), { outputFile: paths.summaryReport }], ['html', { open: 'never', outputFolder: paths.htmlReport }]],
30
+ reporter: [
31
+ ['list'],
32
+ [path.join(__dirname, 'reporters', 'summaryReporter.js'), { outputFile: paths.summaryReport }],
33
+ ['html', { open: 'never', outputFolder: paths.htmlReport }],
34
+ ],
31
35
  use: {
32
36
  baseURL: env.baseUrl(),
33
37
  // The installed Chrome or Edge for every project, not only the UI ones: the session fixture may start a browser in
@@ -35,7 +35,10 @@ const SUPPORT_PROJECTS = new Set(['setup', 'teardown']);
35
35
  * @returns {string} Safe HTML text.
36
36
  */
37
37
  function esc(s) {
38
- return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c] || c);
38
+ return String(s).replace(
39
+ /[&<>"']/g,
40
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c] || c,
41
+ );
39
42
  }
40
43
 
41
44
  /**
@@ -71,12 +74,31 @@ function verdictOf(rows, support = []) {
71
74
  const n = (o) => rows.filter((r) => r.outcome === o).length;
72
75
  const [failed, flaky, skipped, passed] = [n('failed'), n('flaky'), n('skipped'), n('passed')];
73
76
  const setup = support.find((r) => r.outcome === 'failed');
74
- if (setup) return { mark: '❌', label: 'Setup failed', sentence: `${setup.title || 'The setup'} failed, so the tests that need it didn't run; ${passed} other tests passed.`, tone: 'bad' };
77
+ if (setup)
78
+ return {
79
+ mark: '❌',
80
+ label: 'Setup failed',
81
+ sentence: `${setup.title || 'The setup'} failed, so the tests that need it didn't run; ${passed} other tests passed.`,
82
+ tone: 'bad',
83
+ };
75
84
  if (!rows.length) return { mark: '⚠️', label: 'Nothing ran', sentence: 'No tests matched this run.', tone: 'warn' };
76
- if (failed) return { mark: '❌', label: 'Failed', sentence: `${failed} of ${rows.length} tests failed; ${passed} passed.`, tone: 'bad' };
85
+ if (failed)
86
+ return {
87
+ mark: '❌',
88
+ label: 'Failed',
89
+ sentence: `${failed} of ${rows.length} tests failed; ${passed} passed.`,
90
+ tone: 'bad',
91
+ };
77
92
  if (flaky || skipped) {
78
- const parts = [flaky && `${flaky} passed only on a retry`, skipped && `${skipped} skipped`].filter(Boolean).join(', ');
79
- return { mark: '⚠️', label: 'Passed, with notes', sentence: `${passed} of ${rows.length} tests passed; ${parts}.`, tone: 'warn' };
93
+ const parts = [flaky && `${flaky} passed only on a retry`, skipped && `${skipped} skipped`]
94
+ .filter(Boolean)
95
+ .join(', ');
96
+ return {
97
+ mark: '⚠️',
98
+ label: 'Passed, with notes',
99
+ sentence: `${passed} of ${rows.length} tests passed; ${parts}.`,
100
+ tone: 'warn',
101
+ };
80
102
  }
81
103
  return { mark: '✅', label: 'All passed', sentence: `All ${rows.length} tests passed.`, tone: 'good' };
82
104
  }
@@ -91,7 +113,9 @@ function renderSummary(run) {
91
113
  const order = { failed: 0, flaky: 1, skipped: 2, passed: 3 };
92
114
  const MARK = { passed: '✅', failed: '❌', flaky: '⚠️', skipped: '⏭' };
93
115
  const groups = new Map();
94
- for (const r of [...run.rows].sort((a, b) => order[a.outcome] - order[b.outcome] || a.id.localeCompare(b.id, 'en', { numeric: true }))) {
116
+ for (const r of [...run.rows].sort(
117
+ (a, b) => order[a.outcome] - order[b.outcome] || a.id.localeCompare(b.id, 'en', { numeric: true }),
118
+ )) {
95
119
  const key = r.story || r.file.split(':')[0];
96
120
  if (!groups.has(key)) groups.set(key, []);
97
121
  groups.get(key).push(r);
@@ -109,12 +133,17 @@ function renderSummary(run) {
109
133
  <td class="num">${duration(r.durationMs)}${r.attempts > 1 ? ` <span class="muted">· ${r.attempts} tries</span>` : ''}</td>
110
134
  </tr>`;
111
135
  // Story cases first, then framework and unit checks (grouped by file).
112
- const sections = [...groups].sort(([, a], [, b]) => Number(!a[0].story) - Number(!b[0].story)).map(([key, rows]) => `
136
+ const sections = [...groups]
137
+ .sort(([, a], [, b]) => Number(!a[0].story) - Number(!b[0].story))
138
+ .map(
139
+ ([key, rows]) => `
113
140
  <section>
114
141
  <h2>${esc(key)} <span class="muted">${rows.filter((r) => r.outcome === 'passed').length}/${rows.length} passed</span></h2>
115
142
  <div class="scroll"><table><thead><tr><th></th><th>Test</th><th>Project</th><th class="num">Time</th></tr></thead><tbody>${rows.map(row).join('')}
116
143
  </tbody></table></div>
117
- </section>`).join('');
144
+ </section>`,
145
+ )
146
+ .join('');
118
147
  return `<!doctype html>
119
148
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
120
149
  <title>Test run · ${esc(run.startedAt.toISOString().slice(0, 10))}</title>
@@ -196,20 +225,37 @@ class SummaryReporter {
196
225
  const outcome = test.outcome();
197
226
  const parts = parseTitle(test.title);
198
227
  const failedRun = [...results].reverse().find((r) => r.status !== 'passed' && r.status !== 'skipped');
199
- const message = failedRun && failedRun.error ? (failedRun.error.message || failedRun.error.value || '') : '';
200
- const links = outcome === 'unexpected' && failedRun
201
- ? failedRun.attachments.filter((a) => a.path && /screenshot|trace/.test(a.name)).map((a) => ({ name: a.name, href: path.relative(dir, /** @type {string} */ (a.path)).split(path.sep).join('/') }))
202
- : [];
228
+ const message = failedRun && failedRun.error ? failedRun.error.message || failedRun.error.value || '' : '';
229
+ const links =
230
+ outcome === 'unexpected' && failedRun
231
+ ? failedRun.attachments
232
+ .filter((a) => a.path && /screenshot|trace/.test(a.name))
233
+ .map((a) => ({
234
+ name: a.name,
235
+ href: path
236
+ .relative(dir, /** @type {string} */ (a.path))
237
+ .split(path.sep)
238
+ .join('/'),
239
+ }))
240
+ : [];
203
241
  return {
204
242
  ...parts,
205
243
  acs: test.tags.filter((t) => /^@AC-/.test(t)).map((t) => t.slice(1)),
206
244
  project: test.parent.project()?.name || '',
207
245
  file: `${path.relative(paths.root, test.location.file).split(path.sep).join('/')}:${test.location.line}`,
208
- outcome: /** @type {Row['outcome']} */ (({ expected: 'passed', unexpected: 'failed', flaky: 'flaky', skipped: 'skipped' })[outcome]),
246
+ outcome: /** @type {Row['outcome']} */ (
247
+ { expected: 'passed', unexpected: 'failed', flaky: 'flaky', skipped: 'skipped' }[outcome]
248
+ ),
209
249
  durationMs: last ? last.duration : 0,
210
250
  attempts: results.length,
211
251
  // eslint-disable-next-line no-control-regex
212
- error: outcome === 'unexpected' ? redact(message.replace(/\u001b\[[0-9;]*m/g, '')).split('\n').slice(0, 12).join('\n') : '',
252
+ error:
253
+ outcome === 'unexpected'
254
+ ? redact(message.replace(/\u001b\[[0-9;]*m/g, ''))
255
+ .split('\n')
256
+ .slice(0, 12)
257
+ .join('\n')
258
+ : '',
213
259
  links,
214
260
  };
215
261
  });
@@ -217,7 +263,38 @@ class SummaryReporter {
217
263
  const support = all.filter((r) => SUPPORT_PROJECTS.has(r.project));
218
264
  const projects = [...new Set(rows.map((r) => r.project))];
219
265
  fs.mkdirSync(dir, { recursive: true });
220
- fs.writeFileSync(this.outputFile, renderSummary({ rows, support, startedAt: this.startedAt, durationMs: full.duration, baseUrl: this.baseUrl, projects }));
266
+ fs.writeFileSync(
267
+ this.outputFile,
268
+ renderSummary({
269
+ rows,
270
+ support,
271
+ startedAt: this.startedAt,
272
+ durationMs: full.duration,
273
+ baseUrl: this.baseUrl,
274
+ projects,
275
+ }),
276
+ );
277
+ // The same run as data, next to the page: every run (yours, CI's or an agent's) leaves results a script can read
278
+ // (Orion's results_parse.mjs), so nothing has to run again just to get a machine-readable report.
279
+ const data = {
280
+ format: 'orion-summary/1',
281
+ finished_at: new Date().toISOString(),
282
+ status: full.status,
283
+ // `all` was built from the same entries in the same order: match by position, since tests made in a loop share a line.
284
+ tests: [...this.results].map(([test, results], i) => {
285
+ const r = all[i];
286
+ return {
287
+ title: test.title,
288
+ file: r ? r.file : '',
289
+ project: r ? r.project : '',
290
+ status: r ? r.outcome : 'failed',
291
+ duration_ms: r ? r.durationMs : 0,
292
+ attempts: results.length,
293
+ failure_sig: r && r.error ? r.error.split('\n')[0].slice(0, 200) : null,
294
+ };
295
+ }),
296
+ };
297
+ fs.writeFileSync(path.join(dir, 'results.json'), `${JSON.stringify(data, null, 2)}\n`);
221
298
  console.log(`Summary: ${path.relative(process.cwd(), this.outputFile)}`);
222
299
  }
223
300
 
@@ -8,21 +8,28 @@
8
8
  /** @type {Record<string, import('../../utils/titles').TestDescription>} */
9
9
  const SIGN_IN = {
10
10
  'TS-0': {
11
- id: 'TS-0', ac: 'AC-0', story: '{{STORY_KEY}}', tags: ['@smoke'],
11
+ id: 'TS-0',
12
+ ac: 'AC-0',
13
+ story: '{{STORY_KEY}}',
14
+ tags: ['@smoke'],
12
15
  title: 'the test account signs in and the app greets the user',
13
16
  preconditions: ['Signed in (the session the setup project saved)'],
14
17
  steps: ['Open the home page'],
15
18
  expected: 'The home page greets the user',
16
19
  },
17
20
  'TS-1': {
18
- id: 'TS-1', ac: 'AC-0', story: '{{STORY_KEY}}',
21
+ id: 'TS-1',
22
+ ac: 'AC-0',
23
+ story: '{{STORY_KEY}}',
19
24
  title: 'a wrong password is refused with a message',
20
25
  preconditions: ['Signed out'],
21
26
  steps: ['Open the sign-in page', 'Enter the user name and a wrong password', 'Submit'],
22
27
  expected: 'The form shows the wrong-password message',
23
28
  },
24
29
  'TS-2': {
25
- id: 'TS-2', ac: 'AC-0', story: '{{STORY_KEY}}',
30
+ id: 'TS-2',
31
+ ac: 'AC-0',
32
+ story: '{{STORY_KEY}}',
26
33
  title: 'signing out returns to the sign-in page',
27
34
  preconditions: ['Signed out (signs in on its own, so the shared session stays valid)'],
28
35
  steps: ['Sign in', 'Open the account menu', 'Sign out'],
@@ -37,9 +37,16 @@ function installedChannel() {
37
37
  const fs = require('node:fs');
38
38
  const path = require('node:path');
39
39
  /** Whether a file or folder exists. */
40
- const exists = (p) => { try { return fs.statSync(p).isFile() || fs.statSync(p).isDirectory(); } catch { return false; } };
40
+ const exists = (p) => {
41
+ try {
42
+ return fs.statSync(p).isFile() || fs.statSync(p).isDirectory();
43
+ } catch {
44
+ return false;
45
+ }
46
+ };
41
47
  /** Whether one of the commands is on the PATH. */
42
- const onPath = (names) => (process.env.PATH || '').split(path.delimiter).some((d) => names.some((n) => exists(path.join(d, n))));
48
+ const onPath = (names) =>
49
+ (process.env.PATH || '').split(path.delimiter).some((d) => names.some((n) => exists(path.join(d, n))));
43
50
  if (process.platform === 'win32') {
44
51
  const roots = ['ProgramFiles', 'ProgramFiles(x86)', 'LOCALAPPDATA'].map((v) => process.env[v]).filter(Boolean);
45
52
  if (roots.some((r) => exists(path.join(r, 'Google', 'Chrome', 'Application', 'chrome.exe')))) return 'chrome';
@@ -51,7 +58,9 @@ function installedChannel() {
51
58
  return exists('/Applications/Microsoft Edge.app') ? 'msedge' : undefined;
52
59
  }
53
60
  if (exists('/opt/google/chrome/chrome') || onPath(['google-chrome', 'google-chrome-stable'])) return 'chrome';
54
- return exists('/opt/microsoft/msedge/msedge') || onPath(['microsoft-edge', 'microsoft-edge-stable']) ? 'msedge' : undefined;
61
+ return exists('/opt/microsoft/msedge/msedge') || onPath(['microsoft-edge', 'microsoft-edge-stable'])
62
+ ? 'msedge'
63
+ : undefined;
55
64
  }
56
65
 
57
66
  const env = {
@@ -22,7 +22,9 @@ function numberFrom(name, fallback) {
22
22
  */
23
23
  const PROFILE = (() => {
24
24
  try {
25
- return JSON.parse(require('node:fs').readFileSync(require('node:path').join(__dirname, '..', '..', 'timeouts.json'), 'utf-8'));
25
+ return JSON.parse(
26
+ require('node:fs').readFileSync(require('node:path').join(__dirname, '..', '..', 'timeouts.json'), 'utf-8'),
27
+ );
26
28
  } catch {
27
29
  return {};
28
30
  }
@@ -8,8 +8,12 @@ const { test, expect } = require('../../fixtures');
8
8
  */
9
9
 
10
10
  test.describe('{{STORY_KEY}} session over HTTP', () => {
11
- test('framework check, not a story case: the saved session opens the home page without a redirect to sign-in', { tag: ['@smoke'] }, async ({ apiClient }) => {
12
- const response = await apiClient.get(ROUTES.home, { expectStatus: 200, maxRedirects: 0 });
13
- expect(new URL(response.url()).pathname).not.toBe(new URL(ROUTES.login, response.url()).pathname);
14
- });
11
+ test(
12
+ 'framework check, not a story case: the saved session opens the home page without a redirect to sign-in',
13
+ { tag: ['@smoke'] },
14
+ async ({ apiClient }) => {
15
+ const response = await apiClient.get(ROUTES.home, { expectStatus: 200, maxRedirects: 0 });
16
+ expect(new URL(response.url()).pathname).not.toBe(new URL(ROUTES.login, response.url()).pathname);
17
+ },
18
+ );
15
19
  });
@@ -7,12 +7,28 @@ const { renderSummary, parseTitle, verdictOf } = require('../../reporters/summar
7
7
  */
8
8
 
9
9
  /** @returns {import('../../reporters/summaryReporter').Row} A passed row; fields overridden per test. */
10
- const row = (over = {}) => ({ id: 'TS-1', story: 'EA-10', title: 'the user signs in', acs: ['AC-1'], project: 'regression',
11
- file: 'tests/ui/signIn.spec.js:8', outcome: 'passed', durationMs: 1200, attempts: 1, error: '', links: [], ...over });
10
+ const row = (over = {}) => ({
11
+ id: 'TS-1',
12
+ story: 'EA-10',
13
+ title: 'the user signs in',
14
+ acs: ['AC-1'],
15
+ project: 'regression',
16
+ file: 'tests/ui/signIn.spec.js:8',
17
+ outcome: 'passed',
18
+ durationMs: 1200,
19
+ attempts: 1,
20
+ error: '',
21
+ links: [],
22
+ ...over,
23
+ });
12
24
 
13
25
  test.describe('summary reporter', () => {
14
26
  test('parseTitle splits the case id, story and behaviour', () => {
15
- expect(parseTitle('TS-3 [EA-10] wrong password shows an error')).toEqual({ id: 'TS-3', story: 'EA-10', title: 'wrong password shows an error' });
27
+ expect(parseTitle('TS-3 [EA-10] wrong password shows an error')).toEqual({
28
+ id: 'TS-3',
29
+ story: 'EA-10',
30
+ title: 'wrong password shows an error',
31
+ });
16
32
  expect(parseTitle('a test without an id')).toEqual({ id: '', story: '', title: 'a test without an id' });
17
33
  });
18
34
 
@@ -20,12 +36,20 @@ test.describe('summary reporter', () => {
20
36
  expect(verdictOf([row(), row({ outcome: 'failed' })]).label).toBe('Failed');
21
37
  expect(verdictOf([row(), row({ outcome: 'flaky' })]).label).toBe('Passed, with notes');
22
38
  expect(verdictOf([row(), row()]).sentence).toBe('All 2 tests passed.');
23
- expect(verdictOf([row()], [row({ project: 'setup', title: 'sign in', outcome: 'failed' })]).label).toBe('Setup failed');
39
+ expect(verdictOf([row()], [row({ project: 'setup', title: 'sign in', outcome: 'failed' })]).label).toBe(
40
+ 'Setup failed',
41
+ );
24
42
  });
25
43
 
26
44
  test('renderSummary shows the verdict first, escapes text and keeps a failure next to its test', () => {
27
- const html = renderSummary({ rows: [row(), row({ id: 'TS-2', title: 'shows <b>', outcome: 'failed', error: 'Expected "Welcome"' })],
28
- support: [], startedAt: new Date('2026-11-13T10:00:00Z'), durationMs: 4200, baseUrl: 'https://test.example', projects: ['regression'] });
45
+ const html = renderSummary({
46
+ rows: [row(), row({ id: 'TS-2', title: 'shows <b>', outcome: 'failed', error: 'Expected "Welcome"' })],
47
+ support: [],
48
+ startedAt: new Date('2026-11-13T10:00:00Z'),
49
+ durationMs: 4200,
50
+ baseUrl: 'https://test.example',
51
+ projects: ['regression'],
52
+ });
29
53
  expect(html.indexOf('❌ Failed')).toBeLessThan(html.indexOf('<section>'));
30
54
  expect(html).toContain('shows &lt;b&gt;');
31
55
  expect(html.indexOf('TS-2')).toBeLessThan(html.indexOf('TS-1'));
@@ -12,7 +12,9 @@ const { randomBytes } = require('node:crypto');
12
12
  * @returns {string} Lower-case letters and digits.
13
13
  */
14
14
  function uniqueSuffix(length = 6) {
15
- return randomBytes(Math.ceil(length / 2)).toString('hex').slice(0, length);
15
+ return randomBytes(Math.ceil(length / 2))
16
+ .toString('hex')
17
+ .slice(0, length);
16
18
  }
17
19
 
18
20
  /**
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ playwright-report/
3
+ test-results/
4
+ test-summary/
5
+ reports/
6
+ .auth/
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 120
4
+ }