Fix some flaky playwright tests (#28855)

* Fix some flaky playwright tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix more flaky tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Reuse existing assertion

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-01-06 13:31:33 +00:00
committed by GitHub
parent 69ee8fd96a
commit d8f6c12c3d
6 changed files with 13 additions and 9 deletions
+4 -4
View File
@@ -125,7 +125,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator).toHaveCount(1);
await expect(resultLocator.first()).toContainText(room1Name);
await resultLocator.first().click();
expect(page.url()).toContain(room1Id);
await expect(page).toHaveURL(new RegExp(`#/room/${room1Id}`));
await expect(roomHeaderName(page)).toContainText(room1Name);
});
@@ -139,7 +139,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room1Name);
await expect(resultLocator.first()).toContainText("View");
await resultLocator.first().click();
expect(page.url()).toContain(room1Id);
await expect(page).toHaveURL(new RegExp(`#/room/${room1Id}`));
await expect(roomHeaderName(page)).toContainText(room1Name);
});
@@ -153,7 +153,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room2Name);
await expect(resultLocator.first()).toContainText("Join");
await resultLocator.first().click();
expect(page.url()).toContain(room2Id);
await expect(page).toHaveURL(new RegExp(`#/room/${room2Id}`));
await expect(page.locator(".mx_RoomView_MessageList")).toHaveCount(1);
await expect(roomHeaderName(page)).toContainText(room2Name);
});
@@ -168,7 +168,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room3Name);
await expect(resultLocator.first()).toContainText("View");
await resultLocator.first().click();
expect(page.url()).toContain(room3Id);
await expect(page).toHaveURL(new RegExp(`#/room/${room3Id}`));
await page.getByRole("button", { name: "Join the discussion" }).click();
await expect(roomHeaderName(page)).toHaveText(room3Name);
});