18 lines
1.2 KiB
TypeScript
18 lines
1.2 KiB
TypeScript
import type { FullResult, Reporter, TestCase, TestResult, TestStep } from '../../web/node_modules/@playwright/test/reporter';
|
|
import { diagnostic } from './diagnostics';
|
|
|
|
/** Playwright action error call logs can contain locator.fill(password) arguments.
|
|
* Never print raw test errors/steps/stdout/stderr, even on a failed login. */
|
|
export default class SafeReporter implements Reporter {
|
|
private executed = 0;
|
|
onBegin() { console.log('Dev/test browser simulation suite. Secret-bearing step/error logs suppressed.'); }
|
|
onTestEnd(_test: TestCase, result: TestResult) { if (result.status !== 'skipped') this.executed++; console.log(`Browser simulation: ${result.status}.`); }
|
|
onStepEnd(_test: TestCase, _result: TestResult, step: TestStep) {
|
|
if (step.category !== 'test.step') return;
|
|
const safe = diagnostic(step.title, step.error, step.location?.line);
|
|
if (safe) console.error(safe);
|
|
}
|
|
onError() { console.error('Browser simulation infrastructure error; details suppressed to protect login secrets.'); }
|
|
onEnd(result: FullResult) { console.log(this.executed ? `Browser simulation suite: ${result.status}. No production approval evidence.` : 'No browser test executed (discovery or skipped). No acceptance evidence.'); }
|
|
}
|