Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.7 KiB
TypeScript
Raw Permalink Normal View History

2024-06-12 23:35:02 +01:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
2024-06-12 23:35:02 +01:00
Copyright 2024 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
2024-09-09 14:57:16 +01:00
Please see LICENSE files in the repository root for full details.
2024-06-12 23:35:02 +01:00
*/
import { test, expect } from "../../element-web-test";
import { getSampleFilePath } from "../../sample-files";
2024-06-12 23:35:02 +01:00
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", { tag: "@screenshot" }, async ({ page, app }) => {
2026-04-30 13:49:27 +01:00
await app.setComposerInputFiles("room", getSampleFilePath("riot.png"));
2024-06-12 23:35:02 +01:00
2024-07-23 16:26:25 +05:30
await expect(page.getByRole("button", { name: "Upload" })).toBeEnabled();
await expect(page.getByRole("button", { name: "Close dialog" })).toBeEnabled();
2024-07-30 09:20:07 +01:00
await expect(page.locator(".mx_Dialog")).toMatchScreenshot("image-upload-preview.png");
2024-06-12 23:35:02 +01:00
});
2026-04-30 13:49:27 +01:00
test("should allow upload via drag and drop", { tag: "@screenshot" }, async ({ page, app }) => {
await app.composerDragAndUploadFiles("room", getSampleFilePath("riot.png"), "image/png");
await app.timeline.scrollToBottom();
const imgTile = page.locator(".mx_ImageBody").first();
2026-04-30 13:49:27 +01:00
await expect(imgTile).toBeVisible();
});
2024-06-12 23:35:02 +01:00
});