@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.
- package/.claude/settings.json +1 -0
- package/.claude/skills/appium/SKILL.md +2 -2
- package/.claude/skills/appium/templates/ci/github-actions-android.yml +1 -1
- package/.claude/skills/appium/templates/ci/github-actions-ios.yml +1 -1
- package/.claude/skills/appium/templates/ci/github-actions-windows.yml +1 -1
- package/.claude/skills/automation-implementation/SKILL.md +1 -1
- package/.claude/skills/automation-strategy/SKILL.md +1 -0
- package/.claude/skills/cicd-integration/SKILL.md +1 -1
- package/.claude/skills/code-review/SKILL.md +1 -1
- package/.claude/skills/code-review/references/pattern-rules.md +1 -0
- package/.claude/skills/csharp/SKILL.md +1 -0
- package/.claude/skills/documentation/SKILL.md +2 -2
- package/.claude/skills/execution/SKILL.md +9 -9
- package/.claude/skills/httpclient/templates/ci/github-actions.yml +2 -2
- package/.claude/skills/java/SKILL.md +1 -0
- package/.claude/skills/javascript/SKILL.md +1 -0
- package/.claude/skills/junit5/SKILL.md +1 -1
- package/.claude/skills/k6/SKILL.md +1 -1
- package/.claude/skills/k6/templates/project/tests/load/products.js +1 -1
- package/.claude/skills/karate/SKILL.md +1 -1
- package/.claude/skills/karate/templates/ci/github-actions.yml +2 -2
- package/.claude/skills/newman/templates/ci/github-actions.yml +2 -2
- package/.claude/skills/newman/templates/collection/src/config/env.js +1 -1
- package/.claude/skills/nunit/SKILL.md +1 -1
- package/.claude/skills/orion/SKILL.md +2 -2
- package/.claude/skills/orion/references/assess-fix.md +2 -2
- package/.claude/skills/orion/references/batch.md +2 -2
- package/.claude/skills/orion/references/capabilities.md +1 -1
- package/.claude/skills/orion/references/conversation.md +12 -25
- package/.claude/skills/orion/references/greeting.md +23 -0
- package/.claude/skills/orion/references/hosts.md +2 -2
- package/.claude/skills/orion/references/modes.md +1 -1
- package/.claude/skills/orion/references/plain-language.md +5 -2
- package/.claude/skills/orion/references/recovery-loop.md +2 -2
- package/.claude/skills/orion/references/setup-card.md +1 -1
- package/.claude/skills/orion/references/status-lines.md +11 -6
- package/.claude/skills/orion/references/task-brief.md +1 -1
- package/.claude/skills/orion/scripts/batch_state.mjs +1 -1
- package/.claude/skills/orion/scripts/done_check.mjs +12 -5
- package/.claude/skills/orion/scripts/quiet.mjs +1 -1
- package/.claude/skills/orion/scripts/report_check.mjs +5 -2
- package/.claude/skills/orion/scripts/report_make.mjs +186 -0
- package/.claude/skills/orion/scripts/results_parse.mjs +7 -0
- package/.claude/skills/orion/templates/project-context/assessment.md +1 -1
- package/.claude/skills/orion/templates/project-context/report.md +2 -2
- package/.claude/skills/pact/SKILL.md +1 -1
- package/.claude/skills/playwright/SKILL.md +2 -2
- package/.claude/skills/playwright/references/electron.md +1 -1
- package/.claude/skills/playwright/templates/README.md +1 -1
- package/.claude/skills/playwright/templates/ci/azure-pipelines.yml +1 -1
- package/.claude/skills/playwright/templates/ci/github-actions-dotnet.yml +2 -2
- package/.claude/skills/playwright/templates/ci/github-actions-javascript.yml +2 -2
- package/.claude/skills/playwright/templates/ci/github-actions-python.yml +2 -2
- package/.claude/skills/playwright/templates/ci/github-actions.yml +1 -1
- package/.claude/skills/playwright/templates/javascript/.prettierignore +6 -0
- package/.claude/skills/playwright/templates/javascript/.prettierrc.json +4 -0
- package/.claude/skills/playwright/templates/javascript/fixtures/index.js +56 -48
- package/.claude/skills/playwright/templates/javascript/package.json +4 -1
- package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +5 -1
- package/.claude/skills/playwright/templates/javascript/playwright.config.js +6 -2
- package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +92 -15
- package/.claude/skills/playwright/templates/javascript/resources/desc/signIn.desc.js +10 -3
- package/.claude/skills/playwright/templates/javascript/src/config/env.js +12 -3
- package/.claude/skills/playwright/templates/javascript/src/config/flags.js +3 -1
- package/.claude/skills/playwright/templates/javascript/tests/api/session.spec.js +8 -4
- package/.claude/skills/playwright/templates/javascript/tests/unit/summaryReporter.test.js +30 -6
- package/.claude/skills/playwright/templates/javascript/utils/random.js +3 -1
- package/.claude/skills/playwright/templates/project/.prettierignore +6 -0
- package/.claude/skills/playwright/templates/project/.prettierrc.json +4 -0
- package/.claude/skills/playwright/templates/project/fixtures/index.ts +21 -15
- package/.claude/skills/playwright/templates/project/fixtures/session.ts +9 -2
- package/.claude/skills/playwright/templates/project/package.json +4 -1
- package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +5 -1
- package/.claude/skills/playwright/templates/project/playwright.config.ts +4 -2
- package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +97 -15
- package/.claude/skills/playwright/templates/project/resources/desc/signIn.desc.ts +10 -3
- package/.claude/skills/playwright/templates/project/src/config/env.ts +15 -4
- package/.claude/skills/playwright/templates/project/src/services/apiClient.ts +5 -1
- package/.claude/skills/playwright/templates/project/tests/api/session.spec.ts +8 -4
- package/.claude/skills/playwright/templates/project/tests/unit/summaryReporter.test.ts +30 -6
- package/.claude/skills/playwright/templates/project/utils/formFill.ts +4 -1
- package/.claude/skills/playwright/templates/project/utils/random.ts +3 -1
- package/.claude/skills/playwright/templates/project/utils/redact.ts +4 -1
- package/.claude/skills/pytest/SKILL.md +1 -1
- package/.claude/skills/python/SKILL.md +1 -0
- package/.claude/skills/quality-checks/SKILL.md +1 -1
- package/.claude/skills/requests/templates/ci/github-actions.yml +2 -2
- package/.claude/skills/rest-assured/SKILL.md +2 -2
- package/.claude/skills/rest-assured/templates/ci/github-actions.yml +2 -2
- package/.claude/skills/selenium/SKILL.md +1 -1
- package/.claude/skills/selenium/templates/ci/github-actions-csharp.yml +2 -2
- package/.claude/skills/selenium/templates/ci/github-actions-java.yml +2 -2
- package/.claude/skills/selenium/templates/ci/github-actions-python.yml +2 -2
- package/.claude/skills/self-healing/SKILL.md +1 -1
- package/.claude/skills/test-design/SKILL.md +1 -1
- package/.claude/skills/test-reporting/references/report-levels.md +1 -1
- package/.claude/skills/test-reporting/references/tool-mapping.md +1 -1
- package/.claude/skills/testng/SKILL.md +1 -1
- package/.claude/skills/typescript/SKILL.md +1 -0
- package/.claude/skills/ui-observation/SKILL.md +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.cursor/commands/orion.md +1 -1
- package/.gemini/commands/orion.toml +1 -1
- package/.github/prompts/orion.prompt.md +1 -1
- package/.windsurf/workflows/orion.md +1 -1
- package/AGENTS.md +2 -2
- package/README.md +8 -7
- package/assets/architecture.svg +1 -1
- package/assets/run-flow.svg +1 -1
- package/bin/orion.mjs +8 -8
- package/hosts/gemini-extension/gemini-extension.json +1 -1
- package/package.json +2 -2
|
@@ -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: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
//
|
|
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
|
|
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 {
|
|
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(
|
|
66
|
+
return String(s).replace(
|
|
67
|
+
/[&<>"']/g,
|
|
68
|
+
(c) =>
|
|
69
|
+
(({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }) 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)
|
|
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)
|
|
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`]
|
|
102
|
-
|
|
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(
|
|
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]
|
|
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
|
|
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 ?
|
|
213
|
-
const links =
|
|
214
|
-
|
|
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:
|
|
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,39 @@ 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(
|
|
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
|
+
);
|
|
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
|
|
295
|
+
// (Orion's results_parse.mjs), so nothing has to run again just to get a machine-readable report.
|
|
296
|
+
const data = {
|
|
297
|
+
format: 'orion-summary/1',
|
|
298
|
+
finished_at: new Date().toISOString(),
|
|
299
|
+
status: full.status,
|
|
300
|
+
// `all` was built from the same entries in the same order: match by position, since tests made in a loop share a line.
|
|
301
|
+
tests: [...this.results].map(([test, results], i) => {
|
|
302
|
+
const file = `${path.relative(paths.root, test.location.file).split(path.sep).join('/')}:${test.location.line}`;
|
|
303
|
+
const r = all[i];
|
|
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
|
+
};
|
|
313
|
+
}),
|
|
314
|
+
};
|
|
315
|
+
fs.writeFileSync(path.join(dir, 'results.json'), `${JSON.stringify(data, null, 2)}\n`);
|
|
234
316
|
console.log(`Summary: ${path.relative(process.cwd(), this.outputFile)}`);
|
|
235
317
|
}
|
|
236
318
|
|
|
@@ -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',
|
|
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',
|
|
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',
|
|
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 => {
|
|
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 =>
|
|
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']
|
|
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'])
|
|
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(
|
|
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(
|
|
11
|
-
|
|
12
|
-
|
|
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 => ({
|
|
10
|
-
|
|
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({
|
|
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(
|
|
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({
|
|
27
|
-
|
|
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 <b>');
|
|
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(
|
|
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))
|
|
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(
|
|
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
|
|
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 |
|
|
@@ -33,7 +33,7 @@ Not offered yet (say so in one line if asked): contract testing (Pact), API fuzz
|
|
|
33
33
|
- GraphQL: the operation and the fields the test will check, with expected values from the requirement.
|
|
34
34
|
3. **Write the tests** from the add-on template for the project's language (`templates/playwright-js/` or `templates/playwright-ts/`, copied into the test project; it adds `pageObjects/scannedPage`, `src/checks/`, `src/services/graphqlClient`, `resources/desc/quality.desc`, `resources/testData/qualityData` and the specs in `tests/ui` and `tests/api`) with the user's answers in `resources/testData/qualityData`. Add `@axe-core/playwright` at the version pinned in the template README (the confirmed setup card covers installs in the test project).
|
|
35
35
|
4. **Visual baseline after approval only.** The starter's config sets `updateSnapshots: 'none'`, so a missing baseline fails instead of being saved unseen (measured: with the default, the first run writes it silently). After the user's yes: `npx playwright test --project=regression -g QC-5 --update-snapshots=missing` (that run reports the write as a failure; the next run is the check). Changing an approved baseline later is changing an expected value: ask first (H8). Baselines are per project and platform (`Home-regression-linux.png`): CI on another OS needs its own, approved the same way.
|
|
36
|
-
5. **Run and fail-check** like any new test (
|
|
36
|
+
5. **Run and fail-check** like any new test (1 counted run, retries off). Fail check per check: a page with a known problem, or a changed expected value, must fail on that check's assertion with a readable message.
|
|
37
37
|
6. **Report** each check in one line in the result, with what it found on the app (e.g. "Accessibility: 2 critical issues on Home reported as defects; test fails on critical/serious").
|
|
38
38
|
|
|
39
39
|
## Rules
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Python API tests (requests, 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 (
|
|
5
|
+
# "repeat: 3" runs the selection three times with retries off (a stability check); any failing run fails the job.
|
|
6
6
|
name: api-tests
|
|
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
|
|
25
|
+
description: "Runs of the selection (3 for a stability check)"
|
|
26
26
|
type: choice
|
|
27
27
|
options: ["1", "3"]
|
|
28
28
|
default: "1"
|
|
@@ -25,7 +25,7 @@ Adapter rules: holds only what differs from the capability skills; the project's
|
|
|
25
25
|
Copy [templates/java-testng](templates/README.md) (the suite architecture: one `ApiSpec` built once, token from `API_TOKEN`, `Authorization` masked; data in `testData.properties`, cases in `desc/`; select with `-Dgroups`), fill every `{{TOKEN}}`, run the health smoke test against the test environment. With JUnit 5 instead of TestNG, swap the runner dependency and annotations (junit5 adapter).
|
|
26
26
|
|
|
27
27
|
## Run
|
|
28
|
-
- The runner adapter's command (`mvn test -Dtest=<Class>`, `-Dgroups=…`; Gradle equivalents). New tests:
|
|
28
|
+
- The runner adapter's command (`mvn test -Dtest=<Class>`, `-Dgroups=…`; Gradle equivalents). New tests: 1 run with retries off (a stability check on request: N runs, all must agree).
|
|
29
29
|
- Where: the API named in the brief (`run_where` + base URL variable). If the suite starts the service itself, say so in the run record; if it needs a deployed API and none is reachable, NEEDS_ENVIRONMENT.
|
|
30
30
|
- Fail check: change the expected value of the main assertion, run the single test, confirm it fails with REST Assured's `Expected: … Actual: …`, restore.
|
|
31
31
|
- Evidence: Surefire/Gradle reports (`target/surefire-reports/`, `build/test-results/`) and the logged request/response of each failure, with secret headers shown as `[ BLACKLISTED ]`.
|
|
@@ -46,7 +46,7 @@ Copy [templates/java-testng](templates/README.md) (the suite architecture: one `
|
|
|
46
46
|
Fix a path, a payload field name or a JSON path to match the documented contract (same endpoint, same-target evidence: the API doc or a logged response); move a hard-coded value to config. Never change an expected status, value or schema to match what the API returned (that is H8), never add relaxed TLS, never swallow an exception.
|
|
47
47
|
|
|
48
48
|
## Repeat, data and login (platform rules)
|
|
49
|
-
- New tests:
|
|
49
|
+
- New tests: 1 run, retries off; a stability check on request runs N times and all N must agree.
|
|
50
50
|
- Test data per test with unique values, deleted in teardown even on failure.
|
|
51
51
|
- Credentials only from environment variables or CI secrets; never in code, specs, properties files or logs.
|
|
52
52
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# REST Assured (Java, TestNG, Maven). 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 (
|
|
5
|
+
# "repeat: 3" runs the selection three times with retries off (a stability check); any failing run fails the job.
|
|
6
6
|
name: api-tests
|
|
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
|
|
25
|
+
description: "Runs of the selection (3 for a stability check)"
|
|
26
26
|
type: choice
|
|
27
27
|
options: ["1", "3"]
|
|
28
28
|
default: "1"
|
|
@@ -47,7 +47,7 @@ Copy the stack's folder from [templates/](templates/README.md) (Java + TestNG, P
|
|
|
47
47
|
Update locator in the page object (not the test); replace sleep with explicit wait; re-find stale elements.
|
|
48
48
|
|
|
49
49
|
## Repeat, data and login (platform rules)
|
|
50
|
-
- New tests: run them
|
|
50
|
+
- New tests: run them once with retries off; a stability check on request runs them N times (default 3), all N must agree.
|
|
51
51
|
- Test data is created per test with unique values and deleted in teardown (`@AfterMethod` / `afterEach`), even on failure.
|
|
52
52
|
- Login uses the project's pattern; credentials only from environment variables or CI secrets. An HTTP auth prompt or SSO: `ui-observation/references/login-methods.md` section 5 (Java `HasAuthentication`, C# `NetworkAuthenticationHandler`, Python on Chromium a DevTools `Authorization` header; never `user:pass@` in the URL).
|
|
53
53
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Selenium (C#, 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 (
|
|
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
|
|
25
|
+
description: "Runs of the selection (3 for a stability check)"
|
|
26
26
|
type: choice
|
|
27
27
|
options: ["1", "3"]
|
|
28
28
|
default: "1"
|