Playwright test for pasting files (#33350)
* Add tests for pasting * Add tests for pasting files. * Remove redundant fn * rm comment
This commit is contained in:
@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { test, expect } from "../../element-web-test";
|
||||
import { SettingLevel } from "../../../src/settings/SettingLevel";
|
||||
import { getSampleFilePath } from "../../sample-files";
|
||||
|
||||
const CtrlOrMeta = process.platform === "darwin" ? "Meta" : "Control";
|
||||
|
||||
@@ -198,5 +199,16 @@ test.describe("Composer", () => {
|
||||
// Take a screenshot of the autocomplete
|
||||
await expect(autocomplete).toMatchScreenshot("emoji-autocomplete.png");
|
||||
});
|
||||
|
||||
test("can paste a file", async ({ page, bot, app }) => {
|
||||
// Set up a private room so we have another user to mention
|
||||
await app.client.createRoom({
|
||||
is_direct: true,
|
||||
invite: [bot.credentials.userId],
|
||||
});
|
||||
await app.viewRoomByName("Bob");
|
||||
await app.composerDragAndPasteFile("room", getSampleFilePath("riot.png"), "image/png");
|
||||
await expect(page.locator(".mx_MImageBody")).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { test, expect } from "../../element-web-test";
|
||||
import { SettingLevel } from "../../../src/settings/SettingLevel";
|
||||
import { getSampleFilePath } from "../../sample-files";
|
||||
|
||||
const CtrlOrMeta = process.platform === "darwin" ? "Meta" : "Control";
|
||||
|
||||
@@ -195,6 +196,26 @@ test.describe("Composer", () => {
|
||||
await expect(page.locator(".mx_EventTile_body strong").getByText("bold")).toBeVisible();
|
||||
});
|
||||
|
||||
test("can paste a file", async ({ page, bot, app }) => {
|
||||
await app.composerDragAndPasteFile("room", getSampleFilePath("riot.png"), "image/png");
|
||||
await expect(page.locator(".mx_MImageBody")).toBeVisible();
|
||||
});
|
||||
|
||||
test("can paste a file in a thread", async ({ page, app }) => {
|
||||
// Send a message
|
||||
const composer = page.locator("div[contenteditable=true]");
|
||||
await composer.pressSequentially("my first message");
|
||||
await page.getByRole("button", { name: "Send message" }).click();
|
||||
|
||||
// Click reply
|
||||
const tile = page.locator(".mx_EventTile_last");
|
||||
await tile.hover();
|
||||
await tile.getByRole("button", { name: "Reply in thread" }).click();
|
||||
|
||||
await app.composerDragAndPasteFile("thread", getSampleFilePath("riot.png"), "image/png");
|
||||
await expect(page.locator(".mx_MImageBody")).toBeVisible();
|
||||
});
|
||||
|
||||
test.describe("when Control+Enter is required to send", () => {
|
||||
test.beforeEach(async ({ app }) => {
|
||||
await app.settings.setValue("MessageComposerInput.ctrlEnterToSend", null, SettingLevel.ACCOUNT, true);
|
||||
|
||||
Reference in New Issue
Block a user