mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-30 19:39:22 +00:00
fix race in playwright sticky test
This commit is contained in:
@@ -13,7 +13,7 @@ test.skip(
|
|||||||
'This test is not working on firefox, page.keyboard.press("Tab") not reliable in headless mode',
|
'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,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ async function setupTwoUserSpaCall(
|
|||||||
|
|
||||||
let androlHasSentStickyEvent = false;
|
let androlHasSentStickyEvent = false;
|
||||||
|
|
||||||
|
const { promise: stickyAndrolPromise, resolve: stickyAndrolResolve } =
|
||||||
|
Promise.withResolvers<void>();
|
||||||
|
|
||||||
await interceptEventSend(
|
await interceptEventSend(
|
||||||
page,
|
page,
|
||||||
// This room is not encrypted, so the event is sent in clear
|
// This room is not encrypted, so the event is sent in clear
|
||||||
@@ -36,6 +39,9 @@ async function setupTwoUserSpaCall(
|
|||||||
(req) => {
|
(req) => {
|
||||||
androlHasSentStickyEvent =
|
androlHasSentStickyEvent =
|
||||||
androlHasSentStickyEvent || isStickySend(req.url());
|
androlHasSentStickyEvent || isStickySend(req.url());
|
||||||
|
if (androlHasSentStickyEvent) {
|
||||||
|
stickyAndrolResolve();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -53,6 +59,8 @@ async function setupTwoUserSpaCall(
|
|||||||
|
|
||||||
let pevaraHasSentStickyEvent = false;
|
let pevaraHasSentStickyEvent = false;
|
||||||
|
|
||||||
|
const { promise: stickyPevaraPromise, resolve: stickyPevaraResolve } =
|
||||||
|
Promise.withResolvers<void>();
|
||||||
await interceptEventSend(
|
await interceptEventSend(
|
||||||
guestPage,
|
guestPage,
|
||||||
// This room is not encrypted, so the event is sent in clear
|
// This room is not encrypted, so the event is sent in clear
|
||||||
@@ -60,6 +68,9 @@ async function setupTwoUserSpaCall(
|
|||||||
(req) => {
|
(req) => {
|
||||||
pevaraHasSentStickyEvent =
|
pevaraHasSentStickyEvent =
|
||||||
pevaraHasSentStickyEvent || isStickySend(req.url());
|
pevaraHasSentStickyEvent || isStickySend(req.url());
|
||||||
|
if (pevaraHasSentStickyEvent) {
|
||||||
|
stickyPevaraResolve();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -70,7 +81,9 @@ async function setupTwoUserSpaCall(
|
|||||||
"2_0",
|
"2_0",
|
||||||
);
|
);
|
||||||
// Assert both sides have sent sticky membership events
|
// Assert both sides have sent sticky membership events
|
||||||
|
await stickyAndrolPromise;
|
||||||
expect(androlHasSentStickyEvent).toEqual(true);
|
expect(androlHasSentStickyEvent).toEqual(true);
|
||||||
|
await stickyPevaraPromise;
|
||||||
expect(pevaraHasSentStickyEvent).toEqual(true);
|
expect(pevaraHasSentStickyEvent).toEqual(true);
|
||||||
|
|
||||||
return { guestPage };
|
return { guestPage };
|
||||||
|
|||||||
Reference in New Issue
Block a user