Find a plugin toast in e2e while the previous toast still fades out (#10168)
* test(app): find a plugin toast while the previous one still fades A toast that times out stays in the page during its 140 ms fade. When the next toast appears in that window, the plugin helper's locator matched both and failed in strict mode. Wait for the toast that carries the message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(app): match toast text with case so Installed differs from Uninstalled A string passed to hasText matches part of the text and ignores case, so "Installed e2e-plugin" also matched the "Uninstalled e2e-plugin" toast that the spec shows just before it reinstalls. Use a case-sensitive pattern, as toContainText did before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(app): find a plugin toast while a toast with the same text fades Two "Reloaded e2e-plugin" toasts can share the screen during the 140 ms fade, and the filtered locator then matched both. Either one shows the message, so take the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
51baa2beb8
commit
4663f3e40f
1 file changed
+11
-1
@@ -2,6 +2,7 @@ import { buildSettingsHostSectionRoute } from "@/utils/host-routes";
|
||||
import { expect, type Page } from "../fixtures";
|
||||
import { getServerId } from "./server-id";
|
||||
import { expectAppRoute } from "./route-assertions";
|
||||
import { escapeRegex } from "./regex";
|
||||
|
||||
/**
|
||||
* Settings → Host → Plugins: the Installed and Browse tabs, the page menu, the install sheet and a
|
||||
@@ -28,8 +29,17 @@ function pluginSwitch(page: Page, name: string, action: "Disable" | "Enable") {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A toast that times out stays in the page while it fades, so the next toast can share the screen
|
||||
* with it, even when both have the same text. The pattern matches case, so "Installed x" does not
|
||||
* match "Uninstalled x".
|
||||
*/
|
||||
export async function expectToast(page: Page, message: string): Promise<void> {
|
||||
await expect(page.getByTestId("app-toast-message")).toContainText(message);
|
||||
const toast = page
|
||||
.getByTestId("app-toast-message")
|
||||
.filter({ hasText: new RegExp(escapeRegex(message)) })
|
||||
.first();
|
||||
await expect(toast).toBeVisible();
|
||||
}
|
||||
|
||||
// Tabs and search
|
||||
|
||||
Reference in new issue
Block a user