Compare commits

...
Author SHA1 Message Date
Mohamed Boudra acdce33a7c test(e2e): desktop browser-tabs hides developer toasts on its attached page 2026-10-20 09:50:27 +02:00
Mohamed Boudra 6c383fbf8c test(e2e): hide the developer error toast instead of clicking it away
The locator handler that dismissed #error-toast could match a toast that closed before its
click; dispatchEvent then waited for the gone button until the test timed out. Hiding the toast
with CSS keeps it off app actions with no race.
2026-10-20 09:29:37 +02:00
3 changed files with 16 additions and 11 deletions
+12 -7
View File
@@ -1,10 +1,15 @@
const HIDE_DEVELOPER_TOASTS = "#error-toast { display: none !important; }";
/** @param {import('@playwright/test').Page} page */
export async function installDeveloperToastDismissal(page) {
export async function hideDeveloperToasts(page) {
// Developer chrome must not cover app actions or move the test's pointer/focus.
// Console errors remain in the runner's logs.
const dismiss = page.locator("#error-toast").getByRole("button", { name: "", exact: true });
await page.addLocatorHandler(dismiss, () => dismiss.dispatchEvent("click"), {
// A new logged error can replace the toast before the old one disappears.
noWaitAfter: true,
});
// Console errors remain in the runner's logs. Hiding the toast, instead of clicking it away,
// leaves no race with a toast that closes or is replaced between matching and clicking.
await page.addInitScript((css) => {
const style = document.createElement("style");
style.textContent = css;
document.addEventListener("DOMContentLoaded", () => document.head.append(style));
}, HIDE_DEVELOPER_TOASTS);
// A page attached after it loaded (Electron over CDP) runs no init script until it navigates.
await page.addStyleTag({ content: HIDE_DEVELOPER_TOASTS });
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { test as base, expect, type Page } from "@playwright/test";
import { installDeveloperToastDismissal } from "./developer-ui.mjs";
import { hideDeveloperToasts } from "./developer-ui.mjs";
import { startOutdatedDaemon, type OutdatedDaemon } from "./helpers/daemon-update";
import { startE2EWorker } from "./helpers/e2e-worker";
import { getE2EDaemonPort } from "./helpers/daemon-port";
@@ -131,7 +131,7 @@ const test = daemonTest.extend<{
await ws.close({ code: 1008, reason: "Blocked connection to localhost:6767 during e2e." });
});
await installDeveloperToastDismissal(page);
await hideDeveloperToasts(page);
const entries: string[] = [];
+2 -2
View File
@@ -12,7 +12,7 @@ import { fileURLToPath } from "node:url";
import { experimental_createMCPClient } from "ai";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { chromium } from "playwright";
import { installDeveloperToastDismissal } from "../../app/e2e/support/developer-ui.mjs";
import { hideDeveloperToasts } from "../../app/e2e/support/developer-ui.mjs";
import { runAppearanceFontSizeRegression } from "./appearance-font-size.electron.mjs";
import { runSettingsMemoryRegression } from "./settings-memory.electron.mjs";
@@ -1189,7 +1189,7 @@ async function main() {
browser = await chromium.connectOverCDP(`http://127.0.0.1:${cdpPort}`);
const page = await waitForAppPage(browser, expoPort);
await installDeveloperToastDismissal(page);
await hideDeveloperToasts(page);
const status = await waitForDesktopStatus(page);
const checkPluginLinks = () =>