0145920d7e
In this PR, - current basic E2E tests are fixed, and some were added, covering some basic scenarios - some tests avec been commented out, until we decide whether they are worth fixing The next steps are - evaluate the flakiness of the tests. Once they've proved not to be flaky, we should add more tests + re-write the current ones not using aria-label (cf @lucasbordeau indication). - We will add them back to the development flow
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import type {
|
||
Reporter,
|
||
TestCase,
|
||
TestResult,
|
||
} from '@playwright/test/reporter';
|
||
|
||
class LogSummaryReporter implements Reporter {
|
||
private passed: string[] = [];
|
||
private failed: string[] = [];
|
||
|
||
onTestEnd(test: TestCase, result: TestResult): void {
|
||
const name = test.titlePath().join(' › ');
|
||
|
||
if (result.status === 'passed') {
|
||
this.passed.push(name);
|
||
return;
|
||
}
|
||
|
||
if (result.status === 'failed' || result.status === 'timedOut') {
|
||
this.failed.push(name);
|
||
}
|
||
}
|
||
|
||
onEnd(): void {
|
||
const passedSet = new Set(this.passed);
|
||
const failedSet = new Set(this.failed);
|
||
const flaky: string[] = [];
|
||
|
||
for (const testName of passedSet) {
|
||
if (failedSet.has(testName)) {
|
||
flaky.push(testName);
|
||
}
|
||
}
|
||
|
||
const uniquePassed = this.passed.filter((testName) => !flaky.includes(testName));
|
||
const uniqueFailed = this.failed.filter((testName) => !flaky.includes(testName));
|
||
|
||
console.log('\n=== Playwright summary ===');
|
||
if (uniquePassed.length) {
|
||
console.log('Passed:');
|
||
uniquePassed.forEach((testName) => console.log(` ✅ ${testName}`));
|
||
}
|
||
if (uniqueFailed.length) {
|
||
console.log('Failed:');
|
||
uniqueFailed.forEach((testName) => console.log(` ❌ ${testName}`));
|
||
}
|
||
if (flaky.length) {
|
||
console.log('Flaky:');
|
||
flaky.forEach((testName) => console.log(` ⚠️ ${testName}`));
|
||
}
|
||
}
|
||
}
|
||
|
||
export default LogSummaryReporter;
|