2024-06-12 22:35:02 +00:00
|
|
|
/*
|
2024-09-09 13:57:16 +00:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2024-06-12 22:35:02 +00:00
|
|
|
Copyright 2024 The Matrix.org Foundation C.I.C.
|
|
|
|
|
2024-09-09 13:57:16 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
Please see LICENSE files in the repository root for full details.
|
2024-06-12 22:35:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { test, expect } from "../../element-web-test";
|
|
|
|
|
|
|
|
test.describe("Image Upload", () => {
|
|
|
|
test.use({
|
|
|
|
displayName: "Alice",
|
|
|
|
});
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page, app, user }) => {
|
|
|
|
await app.client.createRoom({ name: "My Pictures" });
|
|
|
|
await app.viewRoomByName("My Pictures");
|
|
|
|
|
|
|
|
// Wait until configuration is finished
|
|
|
|
await expect(
|
|
|
|
page
|
|
|
|
.locator(".mx_GenericEventListSummary[data-layout='group'] .mx_GenericEventListSummary_summary")
|
|
|
|
.getByText(`${user.displayName} created and configured the room.`),
|
|
|
|
).toBeVisible();
|
|
|
|
});
|
|
|
|
|
|
|
|
test("should show image preview when uploading an image", async ({ page, app }) => {
|
|
|
|
await page
|
|
|
|
.locator(".mx_MessageComposer_actions input[type='file']")
|
|
|
|
.setInputFiles("playwright/sample-files/riot.png");
|
|
|
|
|
2024-07-23 10:56:25 +00:00
|
|
|
await expect(page.getByRole("button", { name: "Upload" })).toBeEnabled();
|
|
|
|
await expect(page.getByRole("button", { name: "Close dialog" })).toBeEnabled();
|
2024-07-30 08:20:07 +00:00
|
|
|
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("image-upload-preview.png");
|
2024-06-12 22:35:02 +00:00
|
|
|
});
|
|
|
|
});
|