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:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user