Skip to content

Commit 335c66d

Browse files
Star LordMantis
andcommitted
test(browser): await presence acceptance and settled selection paint
Wait through presence admission retries before delete/reload persistence checks. Await existing chip transitions before sampling selection pixels, preserving normal motion and every assertion. Co-authored-by: Mantis <530af7635ef7d0e1a5189d234338db88cb4ef1ede7119b4ebb4fb05c3eafe3b1@buzz.block.builderlab.xyz> Signed-off-by: Star Lord <b89298dbe87c6b3fd8a425b535d9d161f23c88d555a47925ae0b04dfe02b201e@buzz.block.builderlab.xyz>
1 parent 451c098 commit 335c66d

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎tests/browser/channel-archive-delete-pane.spec.mjs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,16 @@ for (const action of ["archive", "delete"]) {
3131
await page.addInitScript(() => {
3232
localStorage.setItem("buzz-appearance.v1", "dark");
3333
});
34+
const presenceAccepted = () =>
35+
page.waitForResponse(
36+
async (response) =>
37+
response.url().endsWith("/stream-presence") &&
38+
(await response.json()).accepted === true,
39+
);
40+
// Establish startup before observing the publication restarted by deletion.
41+
const initialPresence = presenceAccepted();
3442
await page.goto(app.origin);
43+
await initialPresence;
3544
await openPage(page, "Messages");
3645
const sidebar = page.getByRole("navigation", {
3746
name: "Subscribed channels",
@@ -98,6 +107,7 @@ for (const action of ["archive", "delete"]) {
98107
await route.continue();
99108
},
100109
);
110+
const republished = action === "delete" ? presenceAccepted() : undefined;
101111
try {
102112
await trigger.click();
103113
const confirm = dialog.getByRole("button", {
@@ -140,6 +150,9 @@ for (const action of ["archive", "delete"]) {
140150
page.getByRole("textbox", { name: /^Message #/ }),
141151
).toHaveCount(0);
142152
}
153+
// Revocation restarts presence asynchronously. Wait through any admission
154+
// retry until accepted before reloading; visible UI is not that boundary.
155+
await republished;
143156
await page.reload();
144157
await expect(destination).toBeVisible();
145158
await expect(row).toHaveCount(0);

‎tests/browser/mention-selection.spec.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ for (const variant of variants) {
191191
* the second mention, and in the trailing space. Sampled in CSS pixels at the
192192
* line's vertical centre, away from any glyph, so only highlight paint differs. */
193193
async function paint(page, input) {
194+
// The chip fades its background away to reveal the token's selection paint.
195+
// Sample the settled state, not whichever frame the screenshot happens to win.
196+
await input.evaluate((el) =>
197+
Promise.all(el.getAnimations({ subtree: true }).map((a) => a.finished)),
198+
);
194199
await page.evaluate(() => new Promise(requestAnimationFrame));
195200
const points = await input.evaluate((el) => {
196201
const paragraph = el.querySelector("p");

0 commit comments

Comments
 (0)