Skip to content

Commit

Permalink
Merge branch 't3chguy/flaky-playwright-13jan' of https://github.com/v…
Browse files Browse the repository at this point in the history
…ector-im/element-web into t3chguy/flaky-tests-10jan

# Conflicts:
#	playwright/services.ts
#	playwright/stale-screenshot-reporter.ts
#	playwright/testcontainers/mas.ts
#	playwright/testcontainers/synapse.ts
  • Loading branch information
t3chguy committed Jan 13, 2025
2 parents c8e4625 + d27b558 commit 7de0ddd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions playwright/e2e/right-panel/right-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ test.describe("RightPanel", () => {
// Set a local room address
const localAddresses = page.locator(".mx_SettingsFieldset", { hasText: "Local Addresses" });
await localAddresses.getByRole("textbox").fill(ROOM_ADDRESS_LONG);
await expect(page.getByText("This address is available to use")).toBeVisible();
await localAddresses.getByRole("button", { name: "Add" }).click();
await expect(localAddresses.getByText(`#${ROOM_ADDRESS_LONG}:localhost`)).toHaveClass(
"mx_EditableItem_item",
Expand Down
1 change: 1 addition & 0 deletions playwright/e2e/room-directory/room-directory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test.describe("Room Directory", () => {
// First add a local address `gaming`
const localAddresses = page.locator(".mx_SettingsFieldset", { hasText: "Local Addresses" });
await localAddresses.getByRole("textbox").fill("gaming");
await expect(page.getByText("This address is available to use")).toBeVisible();
await localAddresses.getByRole("button", { name: "Add" }).click();
await expect(localAddresses.getByText("#gaming:localhost")).toHaveClass("mx_EditableItem_item");

Expand Down
1 change: 1 addition & 0 deletions playwright/e2e/settings/general-room-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test.describe("General room settings tab", () => {
// 1. Set the room-address to be a really long string
const longString = "abcasdhjasjhdaj1jh1asdhasjdhajsdhjavhjksd".repeat(4);
await settings.locator("#roomAliases input[label='Room address']").fill(longString);
await expect(page.getByText("This address is available to use")).toBeVisible();
await settings.locator("#roomAliases").getByText("Add", { exact: true }).click();

// 2. wait for the new setting to apply ...
Expand Down
19 changes: 9 additions & 10 deletions playwright/pages/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,17 @@ export class Client {
public async createRoom(options: ICreateRoomOpts): Promise<string> {
const client = await this.prepareClient();
return await client.evaluate(async (cli, options) => {
const roomPromise = new Promise<void>((resolve) => {
const onRoom = (room: Room) => {
if (room.roomId === roomId) {
cli.off(window.matrixcs.ClientEvent.Room, onRoom);
resolve();
}
};
cli.on(window.matrixcs.ClientEvent.Room, onRoom);
});
const { room_id: roomId } = await cli.createRoom(options);
if (!cli.getRoom(roomId)) {
await roomPromise;
await new Promise<void>((resolve) => {
const onRoom = (room: Room) => {
if (room.roomId === roomId) {
cli.off(window.matrixcs.ClientEvent.Room, onRoom);
resolve();
}
};
cli.on(window.matrixcs.ClientEvent.Room, onRoom);
});
}
return roomId;
}, options);
Expand Down
1 change: 0 additions & 1 deletion playwright/stale-screenshot-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class StaleScreenshotReporter implements Reporter {

public async onExit(): Promise<void> {
if (this.failing) return;

const screenshotFiles = new Set(await glob(`**/*.png`, { cwd: snapshotRoot }));
for (const screenshot of screenshotFiles) {
if (screenshot.split("-").at(-1) !== "linux.png") {
Expand Down
7 changes: 4 additions & 3 deletions playwright/testcontainers/mas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const DEFAULT_CONFIG = {
{ name: "human" },
{ name: "oauth" },
{ name: "compat" },
{ name: "adminapi" },
{
name: "graphql",
playground: true,
Expand Down Expand Up @@ -164,10 +163,12 @@ const DEFAULT_CONFIG = {
},
rate_limiting: {
login: {
burst: 1000,
burst: 10,
per_second: 1,
},
registration: {
burst: 1000,
burst: 10,
per_second: 1,
},
},
};
Expand Down

0 comments on commit 7de0ddd

Please sign in to comment.