From 68070b2e9788f0e5396f4c9d532b05e146e6ad60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?YONGJAE=20LEE=28=EC=9D=B4=EC=9A=A9=EC=9E=AC=29?= Date: Tue, 17 Mar 2026 03:00:22 +0900 Subject: [PATCH] Fix E2E test quality issues: always-passing assertions, unawaited checks, and dead code (#32801) * Fix E2E test quality issues: always-passing assertions, unawaited checks, and dead code Co-Authored-By: Claude Sonnet 4.6 * apply review --------- Co-authored-by: Claude Sonnet 4.6 --- apps/web/playwright/e2e/crypto/utils.ts | 2 +- apps/web/playwright/e2e/devtools/devtools.spec.ts | 2 +- apps/web/playwright/e2e/spotlight/spotlight.spec.ts | 2 -- apps/web/playwright/e2e/threads/threads.spec.ts | 6 +++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/web/playwright/e2e/crypto/utils.ts b/apps/web/playwright/e2e/crypto/utils.ts index 792dcedd63..1a68cb6521 100644 --- a/apps/web/playwright/e2e/crypto/utils.ts +++ b/apps/web/playwright/e2e/crypto/utils.ts @@ -337,7 +337,7 @@ export async function disableKeyBackup(app: ElementAppPage): Promise { if (await keyStorageToggle.isChecked()) { await encryptionTab.getByRole("switch", { name: "Allow key storage" }).click(); await encryptionTab.getByRole("button", { name: "Delete key storage" }).click(); - await encryptionTab.getByRole("switch", { name: "Allow key storage" }).isVisible(); + await expect(encryptionTab.getByRole("switch", { name: "Allow key storage" })).toBeVisible(); // Wait for the update to account data to stick await new Promise((resolve) => setTimeout(resolve, 2000)); diff --git a/apps/web/playwright/e2e/devtools/devtools.spec.ts b/apps/web/playwright/e2e/devtools/devtools.spec.ts index 1f9217d7eb..da45b647fc 100644 --- a/apps/web/playwright/e2e/devtools/devtools.spec.ts +++ b/apps/web/playwright/e2e/devtools/devtools.spec.ts @@ -35,6 +35,6 @@ test.describe("Devtools", () => { await input.fill("https://example.com"); await input.press("Enter"); // expect EW NOT to reload - await page.getByText("Saved").isVisible(); + await expect(page.getByText("Saved")).toBeVisible(); }); }); diff --git a/apps/web/playwright/e2e/spotlight/spotlight.spec.ts b/apps/web/playwright/e2e/spotlight/spotlight.spec.ts index c1eb2b5923..d2caf93d9f 100644 --- a/apps/web/playwright/e2e/spotlight/spotlight.spec.ts +++ b/apps/web/playwright/e2e/spotlight/spotlight.spec.ts @@ -203,8 +203,6 @@ test.describe("Spotlight", () => { .locator("..") .locator("[role=menuitemradio]") .click(); - await page.waitForTimeout(3_600_000); - await page.waitForTimeout(500); // wait for the dialog to settle const resultLocator = spotlight.results; diff --git a/apps/web/playwright/e2e/threads/threads.spec.ts b/apps/web/playwright/e2e/threads/threads.spec.ts index e9e40dc4b4..16a2ead379 100644 --- a/apps/web/playwright/e2e/threads/threads.spec.ts +++ b/apps/web/playwright/e2e/threads/threads.spec.ts @@ -441,7 +441,7 @@ test.describe("Threads", () => { textbox = locator.getByRole("textbox", { name: "Send an unencrypted message…" }); await textbox.fill("Hello Mr. User"); await textbox.press("Enter"); - await expect(locator.locator(".mx_EventTile_last").getByText("Hello Mr. User")).toBeAttached(); + await expect(locator.locator(".mx_EventTile_last").getByText("Hello Mr. User")).toBeVisible(); // Close thread await locator.getByTestId("base-card-close-button").click(); @@ -454,8 +454,8 @@ test.describe("Threads", () => { await expect(page.locator(".mx_ThreadView_timelinePanelWrapper")).toHaveCount(1); locator = page.locator(".mx_BaseCard"); - await expect(locator.locator(".mx_EventTile").first().getByText("Hello Mr. Bot")).toBeAttached(); - await expect(locator.locator(".mx_EventTile").last().getByText("Hello Mr. User")).toBeAttached(); + await expect(locator.locator(".mx_EventTile").first().getByText("Hello Mr. Bot")).toBeVisible(); + await expect(locator.locator(".mx_EventTile").last().getByText("Hello Mr. User")).toBeVisible(); }); test("navigate through right panel", { tag: "@screenshot" }, async ({ page, app, user }) => {