Stabilise flaky tests relying on bots (#31520)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-12-11 16:16:05 +00:00
committed by GitHub
parent 5b900ab6e2
commit 362e34513d
3 changed files with 4 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ export const test = base.extend<{
room1Name: "Room 1", room1Name: "Room 1",
room1: async ({ room1Name: name, app, user, bot }, use) => { room1: async ({ room1Name: name, app, user, bot }, use) => {
const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] }); const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] });
await bot.awaitRoomMembership(roomId);
await use({ name, roomId }); await use({ name, roomId });
}, },

View File

@@ -36,11 +36,13 @@ export const test = base.extend<{
roomAlphaName: "Room Alpha", roomAlphaName: "Room Alpha",
roomAlpha: async ({ roomAlphaName: name, app, user, bot }, use) => { roomAlpha: async ({ roomAlphaName: name, app, user, bot }, use) => {
const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] }); const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] });
await bot.awaitRoomMembership(roomId);
await use({ name, roomId }); await use({ name, roomId });
}, },
roomBetaName: "Room Beta", roomBetaName: "Room Beta",
roomBeta: async ({ roomBetaName: name, app, user, bot }, use) => { roomBeta: async ({ roomBetaName: name, app, user, bot }, use) => {
const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] }); const roomId = await app.client.createRoom({ name, invite: [bot.credentials.userId] });
await bot.awaitRoomMembership(roomId);
await use({ name, roomId }); await use({ name, roomId });
}, },
msg: async ({ page, app, util }, use) => { msg: async ({ page, app, util }, use) => {

View File

@@ -264,6 +264,7 @@ test.describe("Element Call", () => {
preset: "trusted_private_chat" as Preset.TrustedPrivateChat, preset: "trusted_private_chat" as Preset.TrustedPrivateChat,
invite: [bot.credentials.userId], invite: [bot.credentials.userId],
}); });
await bot.awaitRoomMembership(roomId);
await app.client.setAccountData("m.direct" as EventType.Direct, { await app.client.setAccountData("m.direct" as EventType.Direct, {
[bot.credentials.userId]: [roomId], [bot.credentials.userId]: [roomId],
}); });