From 2c416f7e7b11680d7fcff45ccb8bd919e0b4f133 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 23 Jun 2025 08:57:19 +0100 Subject: [PATCH] Create new snapshot tests --- .../e2e/create-room/create-room.spec.ts | 4 ++- .../decline-and-block-invite-dialog.spec.ts | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 playwright/e2e/invite/decline-and-block-invite-dialog.spec.ts diff --git a/playwright/e2e/create-room/create-room.spec.ts b/playwright/e2e/create-room/create-room.spec.ts index 087a89e68d..47c1c69670 100644 --- a/playwright/e2e/create-room/create-room.spec.ts +++ b/playwright/e2e/create-room/create-room.spec.ts @@ -11,7 +11,7 @@ import { test, expect } from "../../element-web-test"; test.describe("Create Room", () => { test.use({ displayName: "Jim" }); - test("should allow us to create a public room with name, topic & address set", async ({ page, user, app }) => { + test("should allow us to create a public room with name, topic & address set", { tag: "@screenshot" }, async ({ page, user, app }) => { const name = "Test room 1"; const topic = "This room is dedicated to this test and this test only!"; @@ -26,6 +26,8 @@ test.describe("Create Room", () => { await dialog.getByRole("textbox", { name: "Room address" }).fill("test-room-1"); // Submit await dialog.getByRole("button", { name: "Create room" }).click(); + + await expect(dialog).toMatchScreenshot("create-room.png"); await expect(page).toHaveURL(new RegExp(`/#/room/#test-room-1:${user.homeServer}`)); const header = page.locator(".mx_RoomHeader"); diff --git a/playwright/e2e/invite/decline-and-block-invite-dialog.spec.ts b/playwright/e2e/invite/decline-and-block-invite-dialog.spec.ts new file mode 100644 index 0000000000..97238907de --- /dev/null +++ b/playwright/e2e/invite/decline-and-block-invite-dialog.spec.ts @@ -0,0 +1,31 @@ +/* +Copyright 2024 New Vector Ltd. +Copyright 2023 Suguru Hirahara +Copyright 2023 The Matrix.org Foundation C.I.C. + +SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial +Please see LICENSE files in the repository root for full details. +*/ + +import { test, expect } from "../../element-web-test"; + +test.describe("Decline and block invite dialog", function () { + test.use({ + displayName: "Hanako", + botCreateOpts: { + displayName: "BotAlice", + }, + }); + + const botName = "BotAlice"; + + test("should support rejecting a user invite", { tag: "@screenshot" }, async ({ page, app, user, bot }) => { + // Create and view a room + await bot.createRoom({ name: "Test Room", invite: [user.userId] }); + await app.viewRoomByName("Test Room"); + await page.getByRole("button", { name: "Decline and block" }).click(); + + // Take a snapshot of the invite dialog with a user pill + await expect(page.locator(".mx_Dialog")).toMatchScreenshot("decline-and-block-invite-empty.png"); + }); +});