Files
twenty/packages/twenty-e2e-testing/reporters/log-summary-reporter.ts
T
Marie 0145920d7e e2e tests (#16533)
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
2025-12-17 08:48:17 +01:00

55 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;