test(browser): extend automation coverage

This commit is contained in:
Peter Steinberger
2026-01-12 18:42:25 +00:00
parent 5baba5f84e
commit 523f91758d
3 changed files with 118 additions and 10 deletions

View File

@@ -297,4 +297,42 @@ describe("pw-tools-core", () => {
}),
).rejects.toThrow(/Run a new snapshot/i);
});
it("rewrites not-visible timeouts into snapshot hints", async () => {
const click = vi.fn(async () => {
throw new Error(
'Timeout 5000ms exceeded. waiting for locator("aria-ref=1") to be visible',
);
});
currentRefLocator = { click };
currentPage = {};
const mod = await importModule();
await expect(
mod.clickViaPlaywright({
cdpUrl: "http://127.0.0.1:18792",
targetId: "T1",
ref: "1",
}),
).rejects.toThrow(/not found or not visible/i);
});
it("rewrites covered/hidden errors into interactable hints", async () => {
const click = vi.fn(async () => {
throw new Error(
"Element is not receiving pointer events because another element intercepts pointer events",
);
});
currentRefLocator = { click };
currentPage = {};
const mod = await importModule();
await expect(
mod.clickViaPlaywright({
cdpUrl: "http://127.0.0.1:18792",
targetId: "T1",
ref: "1",
}),
).rejects.toThrow(/not interactable/i);
});
});