You've already forked element-web
mirror of
https://github.com/element-hq/element-web.git
synced 2025-08-05 05:21:16 +03:00
* basic implementation of an /share?msg=foo endpoint * SharePayload * add sharing html & md while we're at it * remove whitespace from imports to appease linter * lint * Add unit test * More tests * Test for showScreen * Use one of the typed strings * Test nasty tags stripped out * Add playwright test * Fix flake by not relying on the name being synced as soon as we load --------- Co-authored-by: David Baker <dbkr@users.noreply.github.com>
35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
/*
|
|
* Copyright 2025 New Vector Ltd.
|
|
*
|
|
* 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("share from URL", () => {
|
|
test.use({
|
|
displayName: "Alice",
|
|
room: async ({ app }, use) => {
|
|
const roomId = await app.client.createRoom({ name: "A test room" });
|
|
await use({ roomId });
|
|
},
|
|
});
|
|
|
|
test("should share message when users navigates to share URL", async ({ page, user, room, app }) => {
|
|
await page.goto("/#/share?msg=Hello+world");
|
|
// The forward message dialog doesn't update as new infomation arrives via sync, which means sometimes
|
|
// this is just says, "Empty room". For the same reason, we can't reliably write a test for loading the
|
|
// app straight away with a /#/share url as the room doesn't appear until the client syncs.]
|
|
// Ideally we should fix the forward dialog to update and eliminate races, until then, there is only one
|
|
// room so we click the first button.
|
|
await page.getByRole("listitem" /*, { name: "A test room" }*/).getByRole("button", { name: "Send" }).click();
|
|
await page.keyboard.press("Escape");
|
|
await app.viewRoomByName("A test room");
|
|
const lastMessage = page.locator(".mx_RoomView_MessageList .mx_EventTile_last");
|
|
await expect(lastMessage).toBeVisible();
|
|
const lastMessageText = await lastMessage.locator(".mx_EventTile_body").innerText();
|
|
await expect(lastMessageText).toBe("Hello world");
|
|
});
|
|
});
|