The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
e2e: one retry on CI, and every flaky test named in the job summary
purple08db9bc3d9f5
diff --git a/e2e/support/flaky-report.ts b/e2e/support/flaky-report.tsnew file mode 100644index 00000000..52065211--- /dev/null+++ b/e2e/support/flaky-report.ts@@ -0,0 +1,58 @@+import { appendFileSync } from 'node:fs'+import { stripVTControlCharacters } from 'node:util'+import type { Reporter, TestCase } from '@playwright/test/reporter'++/**+ * CI gives a red test one more try (playwright.config.ts, David's decision for 3.0.9). A test that is red and then+ * green on that try is "flaky", and Playwright's list output says so in one line between 1,700 others. In 3.0.8 that+ * was how two real races (one of them an app bug) went unseen for days. This reporter names every flaky test where+ * it is read: a warning on the run, and a table in the job summary. A run with none says nothing.+ */+export type Flaky = { title: string; file: string; line: number; error: string }++export function flakySummary(flaky: Flaky[]): string {+ if (!flaky.length) return ''+ const cell = (s: string) => s.replace(/\|/g, '\\|').replace(/\s+/g, ' ').trim()+ return [+ `### ${flaky.length} flaky e2e ${flaky.length === 1 ? 'test' : 'tests'} (red, then green on the CI retry)`,+ '',+ 'Each one is a race in the test or in the app. The retry kept the run green; it does not make the finding go away.',+ '',+ '| Test | Where | First error |',+ '|---|---|---|',+ ...flaky.map((f) => `| ${cell(f.title)} | \`${f.file}:${f.line}\` | ${cell(f.error).slice(0, 200)} |`),+ '',+ ].join('\n')+}++export function flakyAnnotation(f: Flaky): string {+ const escape = (s: string) => s.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A')+ return `::warning file=${f.file},line=${f.line},title=Flaky e2e test::${escape(`${f.title}: ${f.error}`)}`+}++export default class FlakyReport implements Reporter {+ private flaky: Flaky[] = []++ onTestEnd(test: TestCase) {+ // Called once per attempt. After the red first one the outcome is still "unexpected"; the green retry makes it flaky.+ if (test.outcome() !== 'flaky') return+ const first = test.results.find((r) => r.status !== 'passed' && r.status !== 'skipped')+ this.flaky.push({+ title: test.titlePath().filter(Boolean).join(' › '),+ file: test.location.file.replace(`${process.cwd()}/`, ''),+ line: test.location.line,+ error: stripVTControlCharacters(first?.error?.message ?? first?.status ?? 'unknown').split('\n')[0],+ })+ }++ onEnd() {+ if (!this.flaky.length) return+ for (const f of this.flaky) console.log(flakyAnnotation(f))+ const summary = process.env.GITHUB_STEP_SUMMARY+ if (summary) appendFileSync(summary, flakySummary(this.flaky))+ }++ printsToStdio() {+ return false+ }+}diff --git a/playwright.config.ts b/playwright.config.tsindex bfa8269d..343058d2 100644--- a/playwright.config.ts+++ b/playwright.config.ts@@ -42,12 +42,13 @@ export default defineConfig({testDir: './e2e',fullyParallel: false,forbidOnly: !!process.env.CI,- // No second try, on CI either. 3.0.8 gave CI two and skipped two tests there; both turned out to be real races- // that only the slower runner hit (a "trained" toast after a stopped training, a tray read during its fade,- // 3.0.9). A retry hides that kind of finding, so a red test stays red everywhere.- retries: 0,+ // Locally no second try: a red test stays red. CI gets one (David, 3.0.9), so one race on the slower runner does+ // not block a release, but it may not hide either: 3.0.8 gave CI two retries and two skipped tests, and both+ // turned out to be real races (a "trained" toast after a stopped training, a tray read during its fade). The+ // flaky report names every test that needed the retry, as a warning and in the job summary.+ retries: process.env.CI ? 1 : 0,workers: 1,- reporter: [['list']],+ reporter: process.env.CI ? [['list'], ['./e2e/support/flaky-report.ts']] : [['list']],timeout: 60_000,expect: { timeout: 15_000 },use: {