From 94112ffcd88617fb0a3f91d805e86f262453a072 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Mar 2026 12:28:36 +0100 Subject: [PATCH] test: stabilise flaky type-change E2E test (add settle time after note selection) The test was consistently flaky because it read the editor heading immediately after clicking a note, before the editor content had finished loading. Added an 800ms settle wait after note selection and increased the post-type-change wait to 1500ms. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/smoke/changing-type-data-corruption.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/smoke/changing-type-data-corruption.spec.ts b/tests/smoke/changing-type-data-corruption.spec.ts index b00bf821..fa152c05 100644 --- a/tests/smoke/changing-type-data-corruption.spec.ts +++ b/tests/smoke/changing-type-data-corruption.spec.ts @@ -32,6 +32,8 @@ test.describe('Changing note type preserves content', () => { const editorContainer = page.locator('.bn-editor') await expect(editorContainer).toBeVisible({ timeout: 5000 }) + // Wait for editor content to stabilise after note selection + await page.waitForTimeout(800) const headingBefore = await editorContainer.locator('h1').first().textContent() expect(headingBefore).toBeTruthy() @@ -40,22 +42,20 @@ test.describe('Changing note type preserves content', () => { const targetType = currentType === 'Project' ? 'Experiment' : 'Project' await selectTrigger.click() - await page.waitForTimeout(300) const option = page.getByRole('option', { name: targetType, exact: true }).first() await expect(option).toBeVisible({ timeout: 3000 }) await option.click() - // Wait for toast (either "Note moved" or "Property updated" depending on vault structure) - await page.waitForTimeout(1000) + // Wait for type change to propagate through state + await page.waitForTimeout(1500) // CRITICAL: verify the editor still shows the SAME note's heading const headingAfter = await editorContainer.locator('h1').first().textContent() expect(headingAfter).toBe(headingBefore) // Restore original type - await page.waitForTimeout(1500) await selectTrigger.click() - await page.waitForTimeout(300) + await page.waitForTimeout(500) const restoreOption = page.getByRole('option', { name: currentType, exact: true }) if (await restoreOption.isVisible()) { await restoreOption.click()