fix flaky test by waiting for chat panel before counting messages (#31633)

* fix flaky test by waiting for chat panel before counting messages

* improve test stability by waiting for visibility before elements count()
This commit is contained in:
Valere Fedronic 2026-01-06 16:49:48 +01:00 committed by GitHub
parent b8ecc0e07e
commit 126b216d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -647,6 +647,10 @@ test.describe("Element Call", () => {
// For this test we want to display the chat area alongside the widget
await page.getByRole("button", { name: "Chat" }).click();
// Wait for the right panel to show the timeline.
await expect(
page.locator(".mx_RightPanel .mx_TimelineCard").getByText("Alice created and configured the room."),
).toBeVisible();
await page
.locator('iframe[title="Element Call"]')
@ -654,7 +658,12 @@ test.describe("Element Call", () => {
.getByRole("button", { name: "Send Room Message" })
.click();
const messageSent = await page.getByText("I sent this once!!").count();
const timelineLocator = page.locator(".mx_RightPanel .mx_TimelineCard");
// First wait for the message to appear in the timeline then
// check the count. This improves test stability as we know the message has been sent.
await expect(timelineLocator.getByText("I sent this once!!")).toBeVisible();
const messageSent = await timelineLocator.getByText("I sent this once!!").count();
expect(messageSent).toBe(1);
});