Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some flaky playwright tests #28855

Merged
merged 5 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion playwright/e2e/audio-player/audio-player.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check failure on line 1 in playwright/e2e/audio-player/audio-player.spec.ts

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 1/6

[Chrome] › audio-player/audio-player.spec.ts:243:9 › Audio player › should support creating a reply chain with multiple audio files @no-firefox @no-webkit @screenshot

1) [Chrome] › audio-player/audio-player.spec.ts:243:9 › Audio player › should support creating a reply chain with multiple audio files @no-firefox @no-webkit @screenshot Test timeout of 30000ms exceeded.
Copyright 2024 New Vector Ltd.
Copyright 2023 Suguru Hirahara
Copyright 2023 The Matrix.org Foundation C.I.C.
Expand Down Expand Up @@ -253,9 +253,8 @@

// Find and click "Reply" button
const clickButtonReply = async () => {
await tile.scrollIntoViewIfNeeded();
await tile.hover();
await tile.getByRole("button", { name: "Reply", exact: true }).click();

Check failure on line 257 in playwright/e2e/audio-player/audio-player.spec.ts

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 1/6

[Chrome] › audio-player/audio-player.spec.ts:243:9 › Audio player › should support creating a reply chain with multiple audio files @no-firefox @no-webkit @screenshot

1) [Chrome] › audio-player/audio-player.spec.ts:243:9 › Audio player › should support creating a reply chain with multiple audio files @no-firefox @no-webkit @screenshot Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for locator('.mx_EventTile_last').getByRole('button', { name: 'Reply', exact: true }) 255 | const clickButtonReply = async () => { 256 | await tile.hover(); > 257 | await tile.getByRole("button", { name: "Reply", exact: true }).click(); | ^ 258 | }; 259 | 260 | await uploadFile(page, "playwright/sample-files/upload-first.ogg"); at clickButtonReply (/home/runner/work/element-web/element-web/playwright/e2e/audio-player/audio-player.spec.ts:257:80) at /home/runner/work/element-web/element-web/playwright/e2e/audio-player/audio-player.spec.ts:273:13
};

await uploadFile(page, "playwright/sample-files/upload-first.ogg");
Expand Down
5 changes: 2 additions & 3 deletions playwright/e2e/composer/RTE.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
});

test.beforeEach(async ({ room }) => {}); // trigger room fixture

Check failure on line 27 in playwright/e2e/composer/RTE.spec.ts

View workflow job for this annotation

GitHub Actions / Run Tests [Chrome] 1/6

[Chrome] › composer/RTE.spec.ts:281:17 › Composer › Rich text editor › Drafts › draft with replies

2) [Chrome] › composer/RTE.spec.ts:281:17 › Composer › Rich text editor › Drafts › draft with replies Test timeout of 30000ms exceeded while running "beforeEach" hook. 25 | }); 26 | > 27 | test.beforeEach(async ({ room }) => {}); // trigger room fixture | ^ 28 | 29 | test.describe("Rich text editor", () => { 30 | test.use({ at /home/runner/work/element-web/element-web/playwright/e2e/composer/RTE.spec.ts:27:10

test.describe("Rich text editor", () => {
test.use({
Expand Down Expand Up @@ -79,9 +79,8 @@
// Enter some more text, then send the message
await page.getByRole("textbox").pressSequentially("this is the spoiler text ");
await page.getByRole("button", { name: "Send message" }).click();
// Check that a spoiler item has appeared in the timeline and locator the spoiler command text
await expect(page.locator("button.mx_EventTile_spoiler")).toBeVisible();
await expect(page.getByText("this is the spoiler text")).toBeVisible();
// Check that a spoiler item has appeared in the timeline and contains the spoiler text
await expect(page.locator("button.mx_EventTile_spoiler")).toHaveText("this is the spoiler text");
});
});
});
Expand Down
4 changes: 3 additions & 1 deletion playwright/e2e/login/soft_logout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ test.describe("Soft logout", () => {

// back to the welcome page
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 ({
Expand Down
2 changes: 2 additions & 0 deletions playwright/e2e/read-receipts/high-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Please see LICENSE files in the repository root for full details.
import { customEvent, many, test } from ".";

test.describe("Read receipts", { tag: "@mergequeue" }, () => {
test.slow();

test.describe("Ignored events", () => {
test("If all events after receipt are unimportant, the room is read", async ({
roomAlpha: room1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ test.describe("Roles & Permissions room settings tab", () => {
// Change the role of Alice to Moderator (50)
await combobox.selectOption("Moderator");
await expect(combobox).toHaveValue("50");
const respPromise = page.waitForRequest("**/state/**");
await applyButton.click();
await respPromise;

// Reload and check Alice is still Moderator (50)
await page.reload();
Expand Down
8 changes: 4 additions & 4 deletions playwright/e2e/spotlight/spotlight.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand All @@ -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);
});

Expand All @@ -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);
});
Expand All @@ -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);
});
Expand Down
Loading