From 65467062aac9b390f17c218974fbe986fd994135 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 3 Jul 2025 23:05:32 +0200 Subject: [PATCH 1/4] Reset currentRun to initial state when starting new test run --- code/addons/vitest/src/preset.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/code/addons/vitest/src/preset.ts b/code/addons/vitest/src/preset.ts index 4c7b84310a56..6a0dfc854415 100644 --- a/code/addons/vitest/src/preset.ts +++ b/code/addons/vitest/src/preset.ts @@ -103,6 +103,7 @@ export const experimental_serverChannel = async (channel: Channel, options: Opti testProviderStore.setState('test-provider-state:running'); store.setState((s) => ({ ...s, + currentRun: storeOptions.initialState.currentRun, fatalError: undefined, })); runTestRunner({ From 02174c2bcf1d1ea88e1659bebdc0cfaf19aa9a2c Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 3 Jul 2025 23:10:54 +0200 Subject: [PATCH 2/4] Check for Starting text as well --- .../react/e2e-tests/component-testing.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts b/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts index 7ba21230ae73..6e28a7abc4a6 100644 --- a/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts +++ b/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts @@ -216,8 +216,8 @@ test.describe("component testing", () => { await runTestsButton.click(); await expect(watchModeButton).toBeDisabled(); - - await expect(testingModuleDescription).toContainText("Testing"); + await expect(testingModuleDescription).toContainText("Starting..."); + await expect(testingModuleDescription).toContainText("Testing..."); // Wait for test results to appear await expect(testingModuleDescription).toHaveText(/Ran \d+ tests/, { From 3943452fca2a11d64ff25f5582cbefbfbe4e0dd5 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Thu, 3 Jul 2025 23:11:13 +0200 Subject: [PATCH 3/4] Avoid noisy logs, they aren't helpful --- .../react/playwright-e2e.config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/test-storybooks/portable-stories-kitchen-sink/react/playwright-e2e.config.ts b/test-storybooks/portable-stories-kitchen-sink/react/playwright-e2e.config.ts index 03142a650659..4448147bcc95 100644 --- a/test-storybooks/portable-stories-kitchen-sink/react/playwright-e2e.config.ts +++ b/test-storybooks/portable-stories-kitchen-sink/react/playwright-e2e.config.ts @@ -56,7 +56,5 @@ export default defineConfig({ command: "yarn storybook", url: "http://127.0.0.1:6006", reuseExistingServer: true, - stdout: "pipe", - stderr: "pipe", }, }); From ecc53a4fdf8deb16f7085b12f31ed52a0af5a4a4 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 4 Jul 2025 09:28:32 +0200 Subject: [PATCH 4/4] Reevaluate locator for each assertion --- .../react/e2e-tests/component-testing.spec.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts b/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts index 6e28a7abc4a6..5f77aafc1514 100644 --- a/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts +++ b/test-storybooks/portable-stories-kitchen-sink/react/e2e-tests/component-testing.spec.ts @@ -205,10 +205,6 @@ test.describe("component testing", () => { "Run component tests" ); - const testingModuleDescription = await page.locator( - "#testing-module-description" - ); - const runTestsButton = await page.getByLabel("Start test run"); const watchModeButton = await page.getByLabel("Enable watch mode"); await expect(runTestsButton).toBeEnabled(); @@ -216,13 +212,18 @@ test.describe("component testing", () => { await runTestsButton.click(); await expect(watchModeButton).toBeDisabled(); - await expect(testingModuleDescription).toContainText("Starting..."); - await expect(testingModuleDescription).toContainText("Testing..."); + await expect(page.locator("#testing-module-description")).toHaveText( + /Starting/ + ); + await expect(page.locator("#testing-module-description")).toHaveText( + /Testing/ + ); // Wait for test results to appear - await expect(testingModuleDescription).toHaveText(/Ran \d+ tests/, { - timeout: 30000, - }); + await expect(page.locator("#testing-module-description")).toHaveText( + /Ran \d+ tests/, + { timeout: 30000 } + ); await expect(runTestsButton).toBeEnabled(); await expect(watchModeButton).toBeEnabled();