@orion-qa/orion 3.3.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 (99) hide show
  1. package/.claude/skills/appium/SKILL.md +2 -2
  2. package/.claude/skills/appium/templates/ci/github-actions-android.yml +1 -1
  3. package/.claude/skills/appium/templates/ci/github-actions-ios.yml +1 -1
  4. package/.claude/skills/appium/templates/ci/github-actions-windows.yml +1 -1
  5. package/.claude/skills/automation-implementation/SKILL.md +1 -1
  6. package/.claude/skills/automation-strategy/SKILL.md +1 -0
  7. package/.claude/skills/cicd-integration/SKILL.md +1 -1
  8. package/.claude/skills/code-review/SKILL.md +1 -1
  9. package/.claude/skills/code-review/references/pattern-rules.md +1 -0
  10. package/.claude/skills/csharp/SKILL.md +1 -0
  11. package/.claude/skills/documentation/SKILL.md +1 -1
  12. package/.claude/skills/execution/SKILL.md +8 -8
  13. package/.claude/skills/httpclient/templates/ci/github-actions.yml +2 -2
  14. package/.claude/skills/java/SKILL.md +1 -0
  15. package/.claude/skills/javascript/SKILL.md +1 -0
  16. package/.claude/skills/junit5/SKILL.md +1 -1
  17. package/.claude/skills/k6/SKILL.md +1 -1
  18. package/.claude/skills/k6/templates/project/tests/load/products.js +1 -1
  19. package/.claude/skills/karate/SKILL.md +1 -1
  20. package/.claude/skills/karate/templates/ci/github-actions.yml +2 -2
  21. package/.claude/skills/newman/templates/ci/github-actions.yml +2 -2
  22. package/.claude/skills/newman/templates/collection/src/config/env.js +1 -1
  23. package/.claude/skills/nunit/SKILL.md +1 -1
  24. package/.claude/skills/orion/SKILL.md +1 -1
  25. package/.claude/skills/orion/references/assess-fix.md +1 -1
  26. package/.claude/skills/orion/references/batch.md +1 -1
  27. package/.claude/skills/orion/references/capabilities.md +1 -1
  28. package/.claude/skills/orion/references/conversation.md +3 -3
  29. package/.claude/skills/orion/references/modes.md +1 -1
  30. package/.claude/skills/orion/references/plain-language.md +3 -2
  31. package/.claude/skills/orion/references/recovery-loop.md +2 -2
  32. package/.claude/skills/orion/references/status-lines.md +4 -4
  33. package/.claude/skills/orion/references/task-brief.md +1 -1
  34. package/.claude/skills/orion/scripts/batch_state.mjs +1 -1
  35. package/.claude/skills/orion/scripts/done_check.mjs +7 -5
  36. package/.claude/skills/orion/scripts/quiet.mjs +1 -1
  37. package/.claude/skills/orion/templates/project-context/report.md +2 -2
  38. package/.claude/skills/pact/SKILL.md +1 -1
  39. package/.claude/skills/playwright/SKILL.md +2 -2
  40. package/.claude/skills/playwright/references/electron.md +1 -1
  41. package/.claude/skills/playwright/templates/README.md +1 -1
  42. package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
  43. package/.claude/skills/playwright/templates/ci/github-actions-dotnet.yml +2 -2
  44. package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +2 -2
  45. package/.claude/skills/playwright/templates/ci/github-actions-python.yml +2 -2
  46. package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
  47. package/.claude/skills/playwright/templates/javascript/.prettierignore +6 -0
  48. package/.claude/skills/playwright/templates/javascript/.prettierrc.json +4 -0
  49. package/.claude/skills/playwright/templates/javascript/fixtures/index.js +56 -48
  50. package/.claude/skills/playwright/templates/javascript/package.json +4 -1
  51. package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +5 -1
  52. package/.claude/skills/playwright/templates/javascript/playwright.config.js +6 -2
  53. package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +80 -17
  54. package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +10 -3
  55. package/.claude/skills/playwright/templates/javascript/src/config/env.js +12 -3
  56. package/.claude/skills/playwright/templates/javascript/src/config/flags.js +3 -1
  57. package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +8 -4
  58. package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +30 -6
  59. package/.claude/skills/playwright/templates/javascript/utils/random.js +3 -1
  60. package/.claude/skills/playwright/templates/project/.prettierignore +6 -0
  61. package/.claude/skills/playwright/templates/project/.prettierrc.json +4 -0
  62. package/.claude/skills/playwright/templates/project/fixtures/index.ts +21 -15
  63. package/.claude/skills/playwright/templates/project/fixtures/session.ts +9 -2
  64. package/.claude/skills/playwright/templates/project/package.json +4 -1
  65. package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +5 -1
  66. package/.claude/skills/playwright/templates/project/playwright.config.ts +4 -2
  67. package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +84 -17
  68. package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +10 -3
  69. package/.claude/skills/playwright/templates/project/src/config/env.ts +15 -4
  70. package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +5 -1
  71. package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +8 -4
  72. package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +30 -6
  73. package/.claude/skills/playwright/templates/project/utils/formFill.ts +4 -1
  74. package/.claude/skills/playwright/templates/project/utils/random.ts +3 -1
  75. package/.claude/skills/playwright/templates/project/utils/redact.ts +4 -1
  76. package/.claude/skills/pytest/SKILL.md +1 -1
  77. package/.claude/skills/python/SKILL.md +1 -0
  78. package/.claude/skills/quality-checks/SKILL.md +1 -1
  79. package/.claude/skills/requests/templates/ci/github-actions.yml +2 -2
  80. package/.claude/skills/rest-assured/SKILL.md +2 -2
  81. package/.claude/skills/rest-assured/templates/ci/github-actions.yml +2 -2
  82. package/.claude/skills/selenium/SKILL.md +1 -1
  83. package/.claude/skills/selenium/templates/ci/github-actions-csharp.yml +2 -2
  84. package/.claude/skills/selenium/templates/ci/github-actions-java.yml +2 -2
  85. package/.claude/skills/selenium/templates/ci/github-actions-python.yml +2 -2
  86. package/.claude/skills/self-healing/SKILL.md +1 -1
  87. package/.claude/skills/test-design/SKILL.md +1 -1
  88. package/.claude/skills/test-reporting/references/report-levels.md +1 -1
  89. package/.claude/skills/test-reporting/references/tool-mapping.md +1 -1
  90. package/.claude/skills/testng/SKILL.md +1 -1
  91. package/.claude/skills/typescript/SKILL.md +1 -0
  92. package/.claude/skills/ui-observation/SKILL.md +1 -1
  93. package/.claude-plugin/plugin.json +1 -1
  94. package/README.md +8 -7
  95. package/assets/architecture.svg +1 -1
  96. package/assets/run-flow.svg +1 -1
  97. package/bin/orion.mjs +6 -6
  98. package/hosts/gemini-extension/gemini-extension.json +1 -1
  99. package/package.json +2 -2
@@ -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
+ }
@@ -39,16 +39,19 @@ export const test = base.extend<SuiteFixtures, WorkerFixtures>({
39
39
  * stale (the setup project didn't run, e.g. UI mode with only the tests' project ticked, or the session is old).
40
40
  * Normal runs, where setup has just signed in, reuse its session and do nothing here.
41
41
  */
42
- session: [async ({ playwright, browserName, channel, headless, launchOptions }, use, workerInfo) => {
43
- const projectUse = workerInfo.project.use;
44
- if (projectUse.storageState === paths.userSession) {
45
- /** Starts this project's browser, with its channel, only when the session must be renewed. */
46
- const launch = () => playwright[browserName].launch({ ...launchOptions, channel, headless });
47
- const why = await ensureSession(launch, projectUse);
48
- if (why) logger.info(`Signed in again before the tests: ${why}`);
49
- }
50
- await use();
51
- }, { scope: 'worker', auto: true }],
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}`);
50
+ }
51
+ await use();
52
+ },
53
+ { scope: 'worker', auto: true },
54
+ ],
52
55
  /**
53
56
  * Playwright's browser context, plus the saved `sessionStorage` when `AUTH_SESSION_STORAGE=1` and the test
54
57
  * starts signed in (Playwright's own saved state doesn't include it; this is its documented workaround).
@@ -57,11 +60,14 @@ export const test = base.extend<SuiteFixtures, WorkerFixtures>({
57
60
  if (flags.authSessionStorage && storageState && fs.existsSync(paths.sessionStorage)) {
58
61
  const origin = new URL(env.baseUrl() || 'http://localhost').origin;
59
62
  const entries: Record<string, string> = JSON.parse(fs.readFileSync(paths.sessionStorage, 'utf-8'));
60
- await context.addInitScript(({ origin: o, entries: e }) => {
61
- if (window.location.origin === o) {
62
- for (const [key, value] of Object.entries(e)) window.sessionStorage.setItem(key, String(value));
63
- }
64
- }, { origin, entries });
63
+ await context.addInitScript(
64
+ ({ origin: o, entries: e }) => {
65
+ if (window.location.origin === o) {
66
+ for (const [key, value] of Object.entries(e)) window.sessionStorage.setItem(key, String(value));
67
+ }
68
+ },
69
+ { origin, entries },
70
+ );
65
71
  }
66
72
  await use(context);
67
73
  },
@@ -42,7 +42,11 @@ export async function signInAndSave(page: Page): Promise<void> {
42
42
  * @param now The time to compare with, in ms.
43
43
  * @returns e.g. `no saved session`, `saved 42 min ago (limit 15)`, `a cookie in it has expired`.
44
44
  */
45
- export function staleReason(file: string = paths.userSession, maxAgeMinutes: number = flags.sessionMaxAgeMinutes, now: number = Date.now()): string | null {
45
+ export function staleReason(
46
+ file: string = paths.userSession,
47
+ maxAgeMinutes: number = flags.sessionMaxAgeMinutes,
48
+ now: number = Date.now(),
49
+ ): string | null {
46
50
  if (!fs.existsSync(file)) return 'no saved session';
47
51
  const ageMinutes = (now - fs.statSync(file).mtimeMs) / 60000;
48
52
  if (ageMinutes > maxAgeMinutes) return `saved ${Math.round(ageMinutes)} min ago (limit ${maxAgeMinutes})`;
@@ -64,7 +68,10 @@ export function staleReason(file: string = paths.userSession, maxAgeMinutes: num
64
68
  * @param use The project's settings.
65
69
  * @returns Why it signed in again, or `null` when the saved session was used.
66
70
  */
67
- export async function ensureSession(launch: () => Promise<Browser>, use: Pick<BrowserContextOptions, 'baseURL' | 'httpCredentials'>): Promise<string | null> {
71
+ export async function ensureSession(
72
+ launch: () => Promise<Browser>,
73
+ use: Pick<BrowserContextOptions, 'baseURL' | 'httpCredentials'>,
74
+ ): Promise<string | null> {
68
75
  const why = staleReason();
69
76
  if (!why) return null;
70
77
  const browser = await launch();
@@ -9,11 +9,14 @@
9
9
  "test:api": "playwright test --project=api",
10
10
  "test:unit": "playwright test --project=unit",
11
11
  "typecheck": "tsc --noEmit",
12
+ "format": "prettier --write \"**/*.{js,ts}\"",
13
+ "format:check": "prettier --check \"**/*.{js,ts}\"",
12
14
  "report": "playwright show-report"
13
15
  },
14
16
  "devDependencies": {
15
17
  "@playwright/test": "{{PLAYWRIGHT_VERSION}}",
16
18
  "@types/node": "{{TYPES_NODE_VERSION}}",
17
- "typescript": "{{TYPESCRIPT_VERSION}}"
19
+ "typescript": "{{TYPESCRIPT_VERSION}}",
20
+ "prettier": "{{PRETTIER_VERSION}}"
18
21
  }
19
22
  }
@@ -26,7 +26,11 @@ export abstract class BasePage {
26
26
  async open(): Promise<this> {
27
27
  if (/\{\{[A-Z_]+\}\}/.test(String(this.path))) {
28
28
  // A starter copied but not filled: say so now, instead of opening /%7B%7BLOGIN_PATH%7D%7D and timing out.
29
- throw new AutomationError('Open', this.path, 'unfilled starter placeholder: fill it in resources/testData from the UI map');
29
+ throw new AutomationError(
30
+ 'Open',
31
+ this.path,
32
+ 'unfilled starter placeholder: fill it in resources/testData from the UI map',
33
+ );
30
34
  }
31
35
  let response;
32
36
  try {
@@ -18,7 +18,7 @@ export default defineConfig({
18
18
  fullyParallel: false,
19
19
  workers: 1,
20
20
  forbidOnly: !!process.env.CI,
21
- // New tests are accepted only after 3 runs with retries off.
21
+ // Retries stay off so a flaky test shows up instead of passing on a retry.
22
22
  retries: 0,
23
23
  // A missing screenshot baseline fails instead of being saved unseen; a person approves it first.
24
24
  updateSnapshots: 'none',
@@ -29,7 +29,9 @@ export default defineConfig({
29
29
  ['list'],
30
30
  [path.join(__dirname, 'reporters', 'summaryReporter.ts'), { outputFile: paths.summaryReport }],
31
31
  ['html', { open: 'never', outputFolder: paths.htmlReport }],
32
- ...(process.env.CI ? [['junit', { outputFile: 'test-results/junit.xml' }] as ['junit', { outputFile: string }]] : []),
32
+ ...(process.env.CI
33
+ ? [['junit', { outputFile: 'test-results/junit.xml' }] as ['junit', { outputFile: string }]]
34
+ : []),
33
35
  ],
34
36
  use: {
35
37
  baseURL: env.baseUrl(),
@@ -50,7 +50,12 @@ export interface Run {
50
50
  }
51
51
 
52
52
  /** What the page says first. */
53
- interface Verdict { mark: string; label: string; sentence: string; tone: 'good' | 'warn' | 'bad' }
53
+ interface Verdict {
54
+ mark: string;
55
+ label: string;
56
+ sentence: string;
57
+ tone: 'good' | 'warn' | 'bad';
58
+ }
54
59
 
55
60
  /**
56
61
  * Escapes text for HTML.
@@ -58,7 +63,11 @@ interface Verdict { mark: string; label: string; sentence: string; tone: 'good'
58
63
  * @returns Safe HTML text.
59
64
  */
60
65
  function esc(s: unknown): string {
61
- return String(s).replace(/[&<>"']/g, (c) => (({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }) as Record<string, string>)[c] || c);
66
+ return String(s).replace(
67
+ /[&<>"']/g,
68
+ (c) =>
69
+ (({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }) as Record<string, string>)[c] || c,
70
+ );
62
71
  }
63
72
 
64
73
  /**
@@ -94,12 +103,31 @@ export function verdictOf(rows: Row[], support: Row[] = []): Verdict {
94
103
  const n = (o: Row['outcome']) => rows.filter((r) => r.outcome === o).length;
95
104
  const [failed, flaky, skipped, passed] = [n('failed'), n('flaky'), n('skipped'), n('passed')];
96
105
  const setup = support.find((r) => r.outcome === 'failed');
97
- 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' };
106
+ if (setup)
107
+ return {
108
+ mark: '❌',
109
+ label: 'Setup failed',
110
+ sentence: `${setup.title || 'The setup'} failed, so the tests that need it didn't run; ${passed} other tests passed.`,
111
+ tone: 'bad',
112
+ };
98
113
  if (!rows.length) return { mark: '⚠️', label: 'Nothing ran', sentence: 'No tests matched this run.', tone: 'warn' };
99
- if (failed) return { mark: '❌', label: 'Failed', sentence: `${failed} of ${rows.length} tests failed; ${passed} passed.`, tone: 'bad' };
114
+ if (failed)
115
+ return {
116
+ mark: '❌',
117
+ label: 'Failed',
118
+ sentence: `${failed} of ${rows.length} tests failed; ${passed} passed.`,
119
+ tone: 'bad',
120
+ };
100
121
  if (flaky || skipped) {
101
- const parts = [flaky && `${flaky} passed only on a retry`, skipped && `${skipped} skipped`].filter(Boolean).join(', ');
102
- return { mark: '⚠️', label: 'Passed, with notes', sentence: `${passed} of ${rows.length} tests passed; ${parts}.`, tone: 'warn' };
122
+ const parts = [flaky && `${flaky} passed only on a retry`, skipped && `${skipped} skipped`]
123
+ .filter(Boolean)
124
+ .join(', ');
125
+ return {
126
+ mark: '⚠️',
127
+ label: 'Passed, with notes',
128
+ sentence: `${passed} of ${rows.length} tests passed; ${parts}.`,
129
+ tone: 'warn',
130
+ };
103
131
  }
104
132
  return { mark: '✅', label: 'All passed', sentence: `All ${rows.length} tests passed.`, tone: 'good' };
105
133
  }
@@ -114,7 +142,9 @@ export function renderSummary(run: Run): string {
114
142
  const order: Record<Row['outcome'], number> = { failed: 0, flaky: 1, skipped: 2, passed: 3 };
115
143
  const MARK: Record<Row['outcome'], string> = { passed: '✅', failed: '❌', flaky: '⚠️', skipped: '⏭' };
116
144
  const groups = new Map<string, Row[]>();
117
- for (const r of [...run.rows].sort((a, b) => order[a.outcome] - order[b.outcome] || a.id.localeCompare(b.id, 'en', { numeric: true }))) {
145
+ for (const r of [...run.rows].sort(
146
+ (a, b) => order[a.outcome] - order[b.outcome] || a.id.localeCompare(b.id, 'en', { numeric: true }),
147
+ )) {
118
148
  const key = r.story || r.file.split(':')[0];
119
149
  if (!groups.has(key)) groups.set(key, []);
120
150
  groups.get(key)!.push(r);
@@ -132,12 +162,17 @@ export function renderSummary(run: Run): string {
132
162
  <td class="num">${duration(r.durationMs)}${r.attempts > 1 ? ` <span class="muted">· ${r.attempts} tries</span>` : ''}</td>
133
163
  </tr>`;
134
164
  // Story cases first, then framework and unit checks (grouped by file).
135
- const sections = [...groups].sort(([, a], [, b]) => Number(!a[0].story) - Number(!b[0].story)).map(([key, rows]) => `
165
+ const sections = [...groups]
166
+ .sort(([, a], [, b]) => Number(!a[0].story) - Number(!b[0].story))
167
+ .map(
168
+ ([key, rows]) => `
136
169
  <section>
137
170
  <h2>${esc(key)} <span class="muted">${rows.filter((r) => r.outcome === 'passed').length}/${rows.length} passed</span></h2>
138
171
  <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('')}
139
172
  </tbody></table></div>
140
- </section>`).join('');
173
+ </section>`,
174
+ )
175
+ .join('');
141
176
  return `<!doctype html>
142
177
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
143
178
  <title>Test run · ${esc(run.startedAt.toISOString().slice(0, 10))}</title>
@@ -209,10 +244,19 @@ export default class SummaryReporter implements Reporter {
209
244
  const outcome = test.outcome();
210
245
  const parts = parseTitle(test.title);
211
246
  const failedRun = [...results].reverse().find((r) => r.status !== 'passed' && r.status !== 'skipped');
212
- const message = failedRun && failedRun.error ? (failedRun.error.message || failedRun.error.value || '') : '';
213
- const links = outcome === 'unexpected' && failedRun
214
- ? failedRun.attachments.filter((a) => a.path && /screenshot|trace/.test(a.name)).map((a) => ({ name: a.name, href: path.relative(dir, a.path as string).split(path.sep).join('/') }))
215
- : [];
247
+ const message = failedRun && failedRun.error ? failedRun.error.message || failedRun.error.value || '' : '';
248
+ const links =
249
+ outcome === 'unexpected' && failedRun
250
+ ? failedRun.attachments
251
+ .filter((a) => a.path && /screenshot|trace/.test(a.name))
252
+ .map((a) => ({
253
+ name: a.name,
254
+ href: path
255
+ .relative(dir, a.path as string)
256
+ .split(path.sep)
257
+ .join('/'),
258
+ }))
259
+ : [];
216
260
  return {
217
261
  ...parts,
218
262
  acs: test.tags.filter((t) => /^@AC-/.test(t)).map((t) => t.slice(1)),
@@ -222,7 +266,13 @@ export default class SummaryReporter implements Reporter {
222
266
  durationMs: last ? last.duration : 0,
223
267
  attempts: results.length,
224
268
  // eslint-disable-next-line no-control-regex
225
- error: outcome === 'unexpected' ? redact(message.replace(/\u001b\[[0-9;]*m/g, '')).split('\n').slice(0, 12).join('\n') : '',
269
+ error:
270
+ outcome === 'unexpected'
271
+ ? redact(message.replace(/\u001b\[[0-9;]*m/g, ''))
272
+ .split('\n')
273
+ .slice(0, 12)
274
+ .join('\n')
275
+ : '',
226
276
  links,
227
277
  };
228
278
  });
@@ -230,7 +280,17 @@ export default class SummaryReporter implements Reporter {
230
280
  const support = all.filter((r) => SUPPORT_PROJECTS.has(r.project));
231
281
  const projects = [...new Set(rows.map((r) => r.project))];
232
282
  fs.mkdirSync(dir, { recursive: true });
233
- fs.writeFileSync(this.outputFile, renderSummary({ rows, support, startedAt: this.startedAt, durationMs: full.duration, baseUrl: this.baseUrl, projects }));
283
+ fs.writeFileSync(
284
+ this.outputFile,
285
+ renderSummary({
286
+ rows,
287
+ support,
288
+ startedAt: this.startedAt,
289
+ durationMs: full.duration,
290
+ baseUrl: this.baseUrl,
291
+ projects,
292
+ }),
293
+ );
234
294
  // The same run as data, next to the page: every run (yours, CI's or an agent's) leaves results a script can read
235
295
  // (Orion's results_parse.mjs), so nothing has to run again just to get a machine-readable report.
236
296
  const data = {
@@ -241,8 +301,15 @@ export default class SummaryReporter implements Reporter {
241
301
  tests: [...this.results].map(([test, results], i) => {
242
302
  const file = `${path.relative(paths.root, test.location.file).split(path.sep).join('/')}:${test.location.line}`;
243
303
  const r = all[i];
244
- return { title: test.title, file, project: r ? r.project : '', status: r ? r.outcome : 'failed',
245
- duration_ms: r ? r.durationMs : 0, attempts: results.length, failure_sig: r && r.error ? r.error.split('\n')[0].slice(0, 200) : null };
304
+ return {
305
+ title: test.title,
306
+ file,
307
+ project: r ? r.project : '',
308
+ status: r ? r.outcome : 'failed',
309
+ duration_ms: r ? r.durationMs : 0,
310
+ attempts: results.length,
311
+ failure_sig: r && r.error ? r.error.split('\n')[0].slice(0, 200) : null,
312
+ };
246
313
  }),
247
314
  };
248
315
  fs.writeFileSync(path.join(dir, 'results.json'), `${JSON.stringify(data, null, 2)}\n`);
@@ -9,21 +9,28 @@ import type { TestDescription } from '../../utils/titles';
9
9
  /** The sign-in feature's test cases. */
10
10
  export const SIGN_IN = {
11
11
  'TS-0': {
12
- id: 'TS-0', ac: 'AC-0', story: '{{STORY_KEY}}', tags: ['@smoke'],
12
+ id: 'TS-0',
13
+ ac: 'AC-0',
14
+ story: '{{STORY_KEY}}',
15
+ tags: ['@smoke'],
13
16
  title: 'the test account signs in and the app greets the user',
14
17
  preconditions: ['Signed in (the session the setup project saved)'],
15
18
  steps: ['Open the home page'],
16
19
  expected: 'The home page greets the user',
17
20
  },
18
21
  'TS-1': {
19
- id: 'TS-1', ac: 'AC-0', story: '{{STORY_KEY}}',
22
+ id: 'TS-1',
23
+ ac: 'AC-0',
24
+ story: '{{STORY_KEY}}',
20
25
  title: 'a wrong password is refused with a message',
21
26
  preconditions: ['Signed out'],
22
27
  steps: ['Open the sign-in page', 'Enter the user name and a wrong password', 'Submit'],
23
28
  expected: 'The form shows the wrong-password message',
24
29
  },
25
30
  'TS-2': {
26
- id: 'TS-2', ac: 'AC-0', story: '{{STORY_KEY}}',
31
+ id: 'TS-2',
32
+ ac: 'AC-0',
33
+ story: '{{STORY_KEY}}',
27
34
  title: 'signing out returns to the sign-in page',
28
35
  preconditions: ['Signed out (signs in on its own, so the shared session stays valid)'],
29
36
  steps: ['Sign in', 'Open the account menu', 'Sign out'],
@@ -42,11 +42,20 @@ export function optional(name: string): string | undefined {
42
42
  */
43
43
  function installedChannel(): 'chrome' | 'msedge' | undefined {
44
44
  /** Whether a file or folder exists. */
45
- const exists = (p: string): boolean => { try { return fs.statSync(p).isFile() || fs.statSync(p).isDirectory(); } catch { return false; } };
45
+ const exists = (p: string): boolean => {
46
+ try {
47
+ return fs.statSync(p).isFile() || fs.statSync(p).isDirectory();
48
+ } catch {
49
+ return false;
50
+ }
51
+ };
46
52
  /** Whether one of the commands is on the PATH. */
47
- const onPath = (names: string[]): boolean => (process.env.PATH || '').split(path.delimiter).some((d) => names.some((n) => exists(path.join(d, n))));
53
+ const onPath = (names: string[]): boolean =>
54
+ (process.env.PATH || '').split(path.delimiter).some((d) => names.some((n) => exists(path.join(d, n))));
48
55
  if (process.platform === 'win32') {
49
- const roots = ['ProgramFiles', 'ProgramFiles(x86)', 'LOCALAPPDATA'].map((v) => process.env[v]).filter((r): r is string => Boolean(r));
56
+ const roots = ['ProgramFiles', 'ProgramFiles(x86)', 'LOCALAPPDATA']
57
+ .map((v) => process.env[v])
58
+ .filter((r): r is string => Boolean(r));
50
59
  if (roots.some((r) => exists(path.join(r, 'Google', 'Chrome', 'Application', 'chrome.exe')))) return 'chrome';
51
60
  if (roots.some((r) => exists(path.join(r, 'Microsoft', 'Edge', 'Application', 'msedge.exe')))) return 'msedge';
52
61
  return undefined;
@@ -56,7 +65,9 @@ function installedChannel(): 'chrome' | 'msedge' | undefined {
56
65
  return exists('/Applications/Microsoft Edge.app') ? 'msedge' : undefined;
57
66
  }
58
67
  if (exists('/opt/google/chrome/chrome') || onPath(['google-chrome', 'google-chrome-stable'])) return 'chrome';
59
- return exists('/opt/microsoft/msedge/msedge') || onPath(['microsoft-edge', 'microsoft-edge-stable']) ? 'msedge' : undefined;
68
+ return exists('/opt/microsoft/msedge/msedge') || onPath(['microsoft-edge', 'microsoft-edge-stable'])
69
+ ? 'msedge'
70
+ : undefined;
60
71
  }
61
72
 
62
73
  export const env = {
@@ -29,7 +29,11 @@ export class ApiClient {
29
29
  * @returns The response.
30
30
  * @throws AutomationError naming the call and the status that came back.
31
31
  */
32
- async send(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', path: string, options: CallOptions = {}): Promise<APIResponse> {
32
+ async send(
33
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
34
+ path: string,
35
+ options: CallOptions = {},
36
+ ): Promise<APIResponse> {
33
37
  const response = await this.request.fetch(path, { method, data: options.data, maxRedirects: options.maxRedirects });
34
38
  const ok = options.expectStatus === undefined ? response.ok() : response.status() === options.expectStatus;
35
39
  logger.debug(`${method} ${path} -> ${response.status()}`);
@@ -7,8 +7,12 @@ import { test, expect } from '../../fixtures';
7
7
  */
8
8
 
9
9
  test.describe('{{STORY_KEY}} session over HTTP', () => {
10
- test('framework check, not a story case: the saved session opens the home page without a redirect to sign-in', { tag: ['@smoke'] }, async ({ apiClient }) => {
11
- const response = await apiClient.get(ROUTES.home, { expectStatus: 200, maxRedirects: 0 });
12
- expect(new URL(response.url()).pathname).not.toBe(new URL(ROUTES.login, response.url()).pathname);
13
- });
10
+ test(
11
+ 'framework check, not a story case: the saved session opens the home page without a redirect to sign-in',
12
+ { tag: ['@smoke'] },
13
+ async ({ apiClient }) => {
14
+ const response = await apiClient.get(ROUTES.home, { expectStatus: 200, maxRedirects: 0 });
15
+ expect(new URL(response.url()).pathname).not.toBe(new URL(ROUTES.login, response.url()).pathname);
16
+ },
17
+ );
14
18
  });
@@ -6,12 +6,28 @@ import { renderSummary, parseTitle, verdictOf, type Row } from '../../reporters/
6
6
  */
7
7
 
8
8
  /** A passed row; fields overridden per test. */
9
- const row = (over: Partial<Row> = {}): Row => ({ id: 'TS-1', story: 'EA-10', title: 'the user signs in', acs: ['AC-1'], project: 'regression',
10
- file: 'tests/ui/signIn.spec.js:8', outcome: 'passed', durationMs: 1200, attempts: 1, error: '', links: [], ...over });
9
+ const row = (over: Partial<Row> = {}): Row => ({
10
+ id: 'TS-1',
11
+ story: 'EA-10',
12
+ title: 'the user signs in',
13
+ acs: ['AC-1'],
14
+ project: 'regression',
15
+ file: 'tests/ui/signIn.spec.js:8',
16
+ outcome: 'passed',
17
+ durationMs: 1200,
18
+ attempts: 1,
19
+ error: '',
20
+ links: [],
21
+ ...over,
22
+ });
11
23
 
12
24
  test.describe('summary reporter', () => {
13
25
  test('parseTitle splits the case id, story and behaviour', () => {
14
- expect(parseTitle('TS-3 [EA-10] wrong password shows an error')).toEqual({ id: 'TS-3', story: 'EA-10', title: 'wrong password shows an error' });
26
+ expect(parseTitle('TS-3 [EA-10] wrong password shows an error')).toEqual({
27
+ id: 'TS-3',
28
+ story: 'EA-10',
29
+ title: 'wrong password shows an error',
30
+ });
15
31
  expect(parseTitle('a test without an id')).toEqual({ id: '', story: '', title: 'a test without an id' });
16
32
  });
17
33
 
@@ -19,12 +35,20 @@ test.describe('summary reporter', () => {
19
35
  expect(verdictOf([row(), row({ outcome: 'failed' })]).label).toBe('Failed');
20
36
  expect(verdictOf([row(), row({ outcome: 'flaky' })]).label).toBe('Passed, with notes');
21
37
  expect(verdictOf([row(), row()]).sentence).toBe('All 2 tests passed.');
22
- expect(verdictOf([row()], [row({ project: 'setup', title: 'sign in', outcome: 'failed' })]).label).toBe('Setup failed');
38
+ expect(verdictOf([row()], [row({ project: 'setup', title: 'sign in', outcome: 'failed' })]).label).toBe(
39
+ 'Setup failed',
40
+ );
23
41
  });
24
42
 
25
43
  test('renderSummary shows the verdict first, escapes text and keeps a failure next to its test', () => {
26
- const html = renderSummary({ rows: [row(), row({ id: 'TS-2', title: 'shows <b>', outcome: 'failed', error: 'Expected "Welcome"' })],
27
- support: [], startedAt: new Date('2026-11-13T10:00:00Z'), durationMs: 4200, baseUrl: 'https://test.example', projects: ['regression'] });
44
+ const html = renderSummary({
45
+ rows: [row(), row({ id: 'TS-2', title: 'shows <b>', outcome: 'failed', error: 'Expected "Welcome"' })],
46
+ support: [],
47
+ startedAt: new Date('2026-11-13T10:00:00Z'),
48
+ durationMs: 4200,
49
+ baseUrl: 'https://test.example',
50
+ projects: ['regression'],
51
+ });
28
52
  expect(html.indexOf('❌ Failed')).toBeLessThan(html.indexOf('<section>'));
29
53
  expect(html).toContain('shows &lt;b&gt;');
30
54
  expect(html.indexOf('TS-2')).toBeLessThan(html.indexOf('TS-1'));
@@ -12,7 +12,10 @@ import type { Locator, Page } from '@playwright/test';
12
12
  * @param scope The page or the form.
13
13
  * @param values Field label → value.
14
14
  */
15
- export async function fillForm(scope: Page | Locator, values: Record<string, string | boolean | undefined>): Promise<void> {
15
+ export async function fillForm(
16
+ scope: Page | Locator,
17
+ values: Record<string, string | boolean | undefined>,
18
+ ): Promise<void> {
16
19
  for (const [label, value] of Object.entries(values)) {
17
20
  if (value === undefined) continue;
18
21
  const field = scope.getByLabel(label, { exact: true });
@@ -11,7 +11,9 @@ import { randomBytes } from 'node:crypto';
11
11
  * @returns Lower-case letters and digits.
12
12
  */
13
13
  export function uniqueSuffix(length = 6): string {
14
- return randomBytes(Math.ceil(length / 2)).toString('hex').slice(0, length);
14
+ return randomBytes(Math.ceil(length / 2))
15
+ .toString('hex')
16
+ .slice(0, length);
15
17
  }
16
18
 
17
19
  /**
@@ -12,7 +12,10 @@ export const SECRET_NAME = /(PASSWORD|PASSWD|TOKEN|SECRET|API_KEY|COOKIE|SESSION
12
12
  */
13
13
  function secretValues(): string[] {
14
14
  return Object.entries(process.env)
15
- .filter((entry): entry is [string, string] => SECRET_NAME.test(entry[0]) && typeof entry[1] === 'string' && entry[1].length >= 4)
15
+ .filter(
16
+ (entry): entry is [string, string] =>
17
+ SECRET_NAME.test(entry[0]) && typeof entry[1] === 'string' && entry[1].length >= 4,
18
+ )
16
19
  .map(([, value]) => value)
17
20
  .sort((a, b) => b.length - a.length);
18
21
  }
@@ -25,7 +25,7 @@ Adapter rules: holds only what differs from the capability skills; the project's
25
25
  - pytest-playwright: `--browser chromium|firefox|webkit`, `--headed`, `--base-url <url>`, `--tracing retain-on-failure`, `--screenshot only-on-failure`, `--output test-results`.
26
26
 
27
27
  ## Repeat and flaky (platform rules)
28
- - New tests: run the scoped command 3 times in a row (pytest has no built-in repeat); all 3 must agree. If pytest-rerunfailures is installed, pass `-p no:rerunfailures` so nothing is retried.
28
+ - New tests: run the scoped command once; a stability check the user asks for runs it N times in a row (default 3; pytest has no built-in repeat), all N must agree. If pytest-rerunfailures is installed, pass `-p no:rerunfailures` so nothing is retried.
29
29
  - Report tests that passed only on a rerun as flaky, never as passed.
30
30
 
31
31
  ## Failure signals
@@ -21,6 +21,7 @@ Adapter rules: holds only what differs from the capability skills; the project's
21
21
  ## Check
22
22
  - Collect without running: `python -m pytest --collect-only -q` (import and syntax errors surface).
23
23
  - The project's lint and type check if configured (`ruff check`, `flake8`, `mypy`); don't add new ones.
24
+ - Format the changed files with the project's formatter (`ruff format <files>` or `black <files>`); none configured → offered at Gate 4, never added silently.
24
25
 
25
26
  ## Failure signals
26
27
  | Signal | Likely class |