You've already forked element-web
mirror of
https://github.com/element-hq/element-web.git
synced 2025-09-13 06:06:34 +03:00
* Switch to TestContainers for manging services in Playwright Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Flip fixture dependency order Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove mas dep Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update matrix-authentication-service in Playwright tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix SMTP port Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Comments Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Strip ansi from playwright logs to make them more readable Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Actually do the update Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove access to homeserver.config.baseUrl field in favour of homeserver.baseUrl Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Use sane default_server_config and specify server.invalid in the specific tests which demand it Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix mas run Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * break cycle Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * typo Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * prettier Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Wire up basics of dendriteHomeserver Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Run Playwright tests against Dendrite & Pinecone periodically Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix playwright-image-updates.yaml workflow Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add `X-Run-All-Tests` label for running all tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Ignore failing tests in stale-screenshot-reporter.ts to avoid confusing errors Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Specify Synapse ui_auth.session_timeout only on tests which require it As Dendrite lacks this configuration option Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * React to MatrixEvent sender/target sentinels being updated for rendering state events Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove test code Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * React to sentinel changes in EventListSummary Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Docs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Avoid reusing user1234 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix stale-screenshot-reporter.ts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Clean up public rooms between tests on reused homeserver Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Deflake spotlight when homeserver is reused Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Deflake more tests using existing username Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Clean mailhog between tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix more flakes Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix missing _request Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix playwright flaky tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Wipe mailhog between test runs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Deflake more tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix flaky tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix flaky tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix mas config Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix another flaky test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix playwright flakes due to floating promises Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix flaky playwright tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update services.ts --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
201 lines
8.3 KiB
TypeScript
201 lines
8.3 KiB
TypeScript
/*
|
|
Copyright 2024 New Vector Ltd.
|
|
Copyright 2023 The Matrix.org Foundation C.I.C.
|
|
|
|
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.
|
|
*/
|
|
|
|
/* See readme.md for tips on writing these tests. */
|
|
|
|
import { test, expect } from ".";
|
|
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
|
|
|
test.describe("Read receipts", { tag: "@mergequeue" }, () => {
|
|
test.skip(isDendrite, "due to Dendrite bug https://github.com/element-hq/dendrite/issues/2970");
|
|
|
|
test.describe("reactions", () => {
|
|
test.describe("in threads", () => {
|
|
test("A reaction to a threaded message does not make the room unread", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given a thread exists and I have read it
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.goTo(room2);
|
|
await util.openThread("Msg1");
|
|
await util.assertRead(room2);
|
|
await util.assertReadThread("Msg1");
|
|
await util.goTo(room1);
|
|
|
|
// When someone reacts to a thread message
|
|
await util.receiveMessages(room2, [msg.reactionTo("Reply1", "πͺΏ")]);
|
|
|
|
// Then the room remains read
|
|
await util.assertStillRead(room2);
|
|
await util.assertReadThread("Msg1");
|
|
});
|
|
|
|
test("Marking a room as read after a reaction in a thread makes it read", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given a thread exists with a reaction
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, [
|
|
"Msg1",
|
|
msg.threadedOff("Msg1", "Reply1"),
|
|
msg.reactionTo("Reply1", "πͺΏ"),
|
|
]);
|
|
await util.assertUnread(room2, 1);
|
|
|
|
// When I mark the room as read
|
|
await util.markAsRead(room2);
|
|
|
|
// Then it becomes read
|
|
await util.assertRead(room2);
|
|
});
|
|
|
|
test("Reacting to a thread message after marking as read does not make the room unread", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given a thread exists and I have marked it as read
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.markAsRead(room2);
|
|
await util.assertRead(room2);
|
|
|
|
// When someone reacts to a thread message
|
|
await util.receiveMessages(room2, [msg.reactionTo("Reply1", "πͺΏ")]);
|
|
|
|
// Then the room remains read
|
|
await util.assertStillRead(room2);
|
|
// as does the thread
|
|
await util.assertReadThread("Msg1");
|
|
});
|
|
|
|
test("A room with a reaction to a threaded message is still unread after restart", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given a thread exists and I have read it
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1")]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.goTo(room2);
|
|
await util.openThread("Msg1");
|
|
await util.assertRead(room2);
|
|
await util.goTo(room1);
|
|
|
|
// And someone reacted to it, which doesn't make it read
|
|
await util.receiveMessages(room2, [msg.reactionTo("Reply1", "πͺΏ")]);
|
|
await util.assertStillRead(room2);
|
|
await util.assertReadThread("Msg1");
|
|
|
|
// When I restart
|
|
await util.saveAndReload();
|
|
|
|
// Then the room is still read
|
|
await util.assertRead(room2);
|
|
await util.assertReadThread("Msg1");
|
|
});
|
|
|
|
test("A room where all reactions in threads are read is still read after restart", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given multiple threads with reactions exist and are read
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, [
|
|
"Msg1",
|
|
msg.threadedOff("Msg1", "Reply1a"),
|
|
msg.reactionTo("Reply1a", "r"),
|
|
"Msg2",
|
|
msg.threadedOff("Msg1", "Reply1b"),
|
|
msg.threadedOff("Msg2", "Reply2a"),
|
|
msg.reactionTo("Msg1", "e"),
|
|
msg.threadedOff("Msg2", "Reply2b"),
|
|
msg.reactionTo("Reply2a", "a"),
|
|
msg.reactionTo("Reply2b", "c"),
|
|
msg.reactionTo("Reply1b", "t"),
|
|
]);
|
|
await util.assertUnread(room2, 2);
|
|
await util.goTo(room2);
|
|
await util.openThread("Msg1");
|
|
await util.assertReadThread("Msg1");
|
|
await util.openThread("Msg2");
|
|
await util.assertReadThread("Msg2");
|
|
await util.assertRead(room2);
|
|
await util.goTo(room1);
|
|
|
|
// When I restart
|
|
await util.saveAndReload();
|
|
|
|
// Then the room is still read
|
|
await util.assertRead(room2);
|
|
await util.goTo(room2);
|
|
await util.assertReadThread("Msg1");
|
|
await util.assertReadThread("Msg2");
|
|
});
|
|
|
|
test("Can remove a reaction in a thread", async ({
|
|
page,
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Note: this is not strictly a read receipt test, but it checks
|
|
// for a bug we caused when we were fixing unreads, so it's
|
|
// included here. The bug is:
|
|
// https://github.com/vector-im/element-web/issues/26498
|
|
|
|
// Given a thread exists
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1", msg.threadedOff("Msg1", "Reply1a")]);
|
|
await util.assertUnread(room2, 1);
|
|
|
|
// When I react to a thread message
|
|
await util.goTo(room2);
|
|
await util.openThread("Msg1");
|
|
await page.locator(".mx_ThreadPanel").getByText("Reply1a").hover();
|
|
await page.getByRole("button", { name: "React" }).click();
|
|
await page.locator(".mx_EmojiPicker_body").getByText("π").click();
|
|
|
|
// And cancel the reaction
|
|
await page.locator(".mx_ThreadPanel").getByLabel("Mae reacted with π").click();
|
|
|
|
// Then it disappears
|
|
await expect(page.locator(".mx_ThreadPanel").getByLabel("Mae reacted with π")).not.toBeVisible();
|
|
|
|
// And I can do it all again without an error
|
|
await page.locator(".mx_ThreadPanel").getByText("Reply1a").hover();
|
|
await page.getByRole("button", { name: "React" }).click();
|
|
await page.locator(".mx_EmojiPicker_body").getByText("π").first().click();
|
|
await page.locator(".mx_ThreadPanel").getByLabel("Mae reacted with π").click();
|
|
await expect(await page.locator(".mx_ThreadPanel").getByLabel("Mae reacted with π")).not.toBeVisible();
|
|
});
|
|
});
|
|
});
|
|
});
|