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>
pull/28881/head
Michael Telatynski 2025-01-06 13:31:33 +00:00 committed by GitHub
parent 69ee8fd96a
commit d8f6c12c3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 9 deletions

View File

@ -253,7 +253,6 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
// Find and click "Reply" button // Find and click "Reply" button
const clickButtonReply = async () => { const clickButtonReply = async () => {
await tile.scrollIntoViewIfNeeded();
await tile.hover(); await tile.hover();
await tile.getByRole("button", { name: "Reply", exact: true }).click(); await tile.getByRole("button", { name: "Reply", exact: true }).click();
}; };

View File

@ -79,9 +79,8 @@ test.describe("Composer", () => {
// Enter some more text, then send the message // Enter some more text, then send the message
await page.getByRole("textbox").pressSequentially("this is the spoiler text "); await page.getByRole("textbox").pressSequentially("this is the spoiler text ");
await page.getByRole("button", { name: "Send message" }).click(); await page.getByRole("button", { name: "Send message" }).click();
// Check that a spoiler item has appeared in the timeline and locator the spoiler command text // Check that a spoiler item has appeared in the timeline and contains the spoiler text
await expect(page.locator("button.mx_EventTile_spoiler")).toBeVisible(); await expect(page.locator("button.mx_EventTile_spoiler")).toHaveText("this is the spoiler text");
await expect(page.getByText("this is the spoiler text")).toBeVisible();
}); });
}); });
}); });

View File

@ -32,7 +32,9 @@ test.describe("Soft logout", () => {
// back to the welcome page // back to the welcome page
await expect(page).toHaveURL(/\/#\/home/); await expect(page).toHaveURL(/\/#\/home/);
await expect(page.getByRole("heading", { name: `Welcome ${user.userId}`, exact: true })).toBeVisible(); await expect(
page.getByRole("heading", { name: "Now, let's help you get started", exact: true }),
).toBeVisible();
}); });
test("still shows the soft-logout page when the page is reloaded after a soft-logout", async ({ test("still shows the soft-logout page when the page is reloaded after a soft-logout", async ({

View File

@ -11,6 +11,8 @@ Please see LICENSE files in the repository root for full details.
import { customEvent, many, test } from "."; import { customEvent, many, test } from ".";
test.describe("Read receipts", { tag: "@mergequeue" }, () => { test.describe("Read receipts", { tag: "@mergequeue" }, () => {
test.slow();
test.describe("Ignored events", () => { test.describe("Ignored events", () => {
test("If all events after receipt are unimportant, the room is read", async ({ test("If all events after receipt are unimportant, the room is read", async ({
roomAlpha: room1, roomAlpha: room1,

View File

@ -37,7 +37,9 @@ test.describe("Roles & Permissions room settings tab", () => {
// Change the role of Alice to Moderator (50) // Change the role of Alice to Moderator (50)
await combobox.selectOption("Moderator"); await combobox.selectOption("Moderator");
await expect(combobox).toHaveValue("50"); await expect(combobox).toHaveValue("50");
const respPromise = page.waitForRequest("**/state/**");
await applyButton.click(); await applyButton.click();
await respPromise;
// Reload and check Alice is still Moderator (50) // Reload and check Alice is still Moderator (50)
await page.reload(); await page.reload();

View File

@ -125,7 +125,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator).toHaveCount(1); await expect(resultLocator).toHaveCount(1);
await expect(resultLocator.first()).toContainText(room1Name); await expect(resultLocator.first()).toContainText(room1Name);
await resultLocator.first().click(); await resultLocator.first().click();
expect(page.url()).toContain(room1Id); await expect(page).toHaveURL(new RegExp(`#/room/${room1Id}`));
await expect(roomHeaderName(page)).toContainText(room1Name); await expect(roomHeaderName(page)).toContainText(room1Name);
}); });
@ -139,7 +139,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room1Name); await expect(resultLocator.first()).toContainText(room1Name);
await expect(resultLocator.first()).toContainText("View"); await expect(resultLocator.first()).toContainText("View");
await resultLocator.first().click(); await resultLocator.first().click();
expect(page.url()).toContain(room1Id); await expect(page).toHaveURL(new RegExp(`#/room/${room1Id}`));
await expect(roomHeaderName(page)).toContainText(room1Name); await expect(roomHeaderName(page)).toContainText(room1Name);
}); });
@ -153,7 +153,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room2Name); await expect(resultLocator.first()).toContainText(room2Name);
await expect(resultLocator.first()).toContainText("Join"); await expect(resultLocator.first()).toContainText("Join");
await resultLocator.first().click(); 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(page.locator(".mx_RoomView_MessageList")).toHaveCount(1);
await expect(roomHeaderName(page)).toContainText(room2Name); await expect(roomHeaderName(page)).toContainText(room2Name);
}); });
@ -168,7 +168,7 @@ test.describe("Spotlight", () => {
await expect(resultLocator.first()).toContainText(room3Name); await expect(resultLocator.first()).toContainText(room3Name);
await expect(resultLocator.first()).toContainText("View"); await expect(resultLocator.first()).toContainText("View");
await resultLocator.first().click(); 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 page.getByRole("button", { name: "Join the discussion" }).click();
await expect(roomHeaderName(page)).toHaveText(room3Name); await expect(roomHeaderName(page)).toHaveText(room3Name);
}); });