fix race in playwright sticky test

This commit is contained in:
Timo K
2026-04-14 16:23:05 +02:00
parent 2ae1df467d
commit 57f12d3d1c
2 changed files with 14 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ test.skip(
'This test is not working on firefox, page.keyboard.press("Tab") not reliable in headless mode',
);
test("can only interact with header and footer while reconnecting", async ({
test("can not interact with media tiles while reconnecting (only with header and footer)", async ({
page,
}) => {
await page.goto("/");

View File

@@ -29,6 +29,9 @@ async function setupTwoUserSpaCall(
let androlHasSentStickyEvent = false;
const { promise: stickyAndrolPromise, resolve: stickyAndrolResolve } =
Promise.withResolvers<void>();
await interceptEventSend(
page,
// This room is not encrypted, so the event is sent in clear
@@ -36,6 +39,9 @@ async function setupTwoUserSpaCall(
(req) => {
androlHasSentStickyEvent =
androlHasSentStickyEvent || isStickySend(req.url());
if (androlHasSentStickyEvent) {
stickyAndrolResolve();
}
},
);
@@ -53,6 +59,8 @@ async function setupTwoUserSpaCall(
let pevaraHasSentStickyEvent = false;
const { promise: stickyPevaraPromise, resolve: stickyPevaraResolve } =
Promise.withResolvers<void>();
await interceptEventSend(
guestPage,
// This room is not encrypted, so the event is sent in clear
@@ -60,6 +68,9 @@ async function setupTwoUserSpaCall(
(req) => {
pevaraHasSentStickyEvent =
pevaraHasSentStickyEvent || isStickySend(req.url());
if (pevaraHasSentStickyEvent) {
stickyPevaraResolve();
}
},
);
@@ -70,7 +81,9 @@ async function setupTwoUserSpaCall(
"2_0",
);
// Assert both sides have sent sticky membership events
await stickyAndrolPromise;
expect(androlHasSentStickyEvent).toEqual(true);
await stickyPevaraPromise;
expect(pevaraHasSentStickyEvent).toEqual(true);
return { guestPage };