|
| 1 | +/* |
| 2 | +Copyright 2024 The Matrix.org Foundation C.I.C. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +import { test, expect } from "../../element-web-test"; |
| 18 | + |
| 19 | +test.describe("Image Upload", () => { |
| 20 | + test.use({ |
| 21 | + displayName: "Alice", |
| 22 | + }); |
| 23 | + |
| 24 | + test.beforeEach(async ({ page, app, user }) => { |
| 25 | + await app.client.createRoom({ name: "My Pictures" }); |
| 26 | + await app.viewRoomByName("My Pictures"); |
| 27 | + |
| 28 | + // Wait until configuration is finished |
| 29 | + await expect( |
| 30 | + page |
| 31 | + .locator(".mx_GenericEventListSummary[data-layout='group'] .mx_GenericEventListSummary_summary") |
| 32 | + .getByText(`${user.displayName} created and configured the room.`), |
| 33 | + ).toBeVisible(); |
| 34 | + }); |
| 35 | + |
| 36 | + test("should show image preview when uploading an image", async ({ page, app }) => { |
| 37 | + await page |
| 38 | + .locator(".mx_MessageComposer_actions input[type='file']") |
| 39 | + .setInputFiles("playwright/sample-files/riot.png"); |
| 40 | + |
| 41 | + expect(page.getByRole("button", { name: "Upload" })).toBeEnabled(); |
| 42 | + expect(page.getByRole("button", { name: "Close dialog" })).toBeEnabled(); |
| 43 | + expect(page).toMatchScreenshot("image-upload-preview.png"); |
| 44 | + }); |
| 45 | +}); |
0 commit comments