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>
164 lines
6.0 KiB
TypeScript
164 lines
6.0 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 { many, test } 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("new messages", () => {
|
|
test.describe("in the main timeline", () => {
|
|
test("Receiving a message makes a room unread", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I am in a different room
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
|
|
// When I receive some messages
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
|
|
// Then the room is marked as unread
|
|
await util.assertUnread(room2, 1);
|
|
});
|
|
test("Reading latest message makes the room read", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I have some unread messages
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
|
|
// When I read the main timeline
|
|
await util.goTo(room2);
|
|
|
|
// Then the room becomes read
|
|
await util.assertRead(room2);
|
|
});
|
|
test("Reading an older message leaves the room unread", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given there are lots of messages in a room
|
|
await util.goTo(room1);
|
|
await util.receiveMessages(room2, many("Msg", 30));
|
|
await util.assertUnread(room2, 30);
|
|
|
|
// When I jump to one of the older messages
|
|
await msg.jumpTo(room2, "Msg0001");
|
|
|
|
// Then the room is still unread, but some messages were read
|
|
await util.assertUnreadLessThan(room2, 30);
|
|
});
|
|
test("Marking a room as read makes it read", async ({ roomAlpha: room1, roomBeta: room2, util, msg }) => {
|
|
// Given I have some unread messages
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
|
|
// When I mark the room as read
|
|
await util.markAsRead(room2);
|
|
|
|
// Then it is read
|
|
await util.assertRead(room2);
|
|
});
|
|
test("Receiving a new message after marking as read makes it unread", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I have marked my messages as read
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.markAsRead(room2);
|
|
await util.assertRead(room2);
|
|
|
|
// When I receive a new message
|
|
await util.receiveMessages(room2, ["Msg2"]);
|
|
|
|
// Then the room is unread
|
|
await util.assertUnread(room2, 1);
|
|
});
|
|
test("A room with a new message is still unread after restart", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I have an unread message
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
|
|
// When I restart
|
|
await util.saveAndReload();
|
|
|
|
// Then I still have an unread message
|
|
await util.assertUnread(room2, 1);
|
|
});
|
|
test("A room where all messages are read is still read after restart", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I have read all messages
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.goTo(room2);
|
|
await util.assertRead(room2);
|
|
|
|
// When I restart
|
|
await util.saveAndReload();
|
|
|
|
// Then all messages are still read
|
|
await util.assertRead(room2);
|
|
});
|
|
test("A room that was marked as read is still read after restart", async ({
|
|
roomAlpha: room1,
|
|
roomBeta: room2,
|
|
util,
|
|
msg,
|
|
}) => {
|
|
// Given I have marked all messages as read
|
|
await util.goTo(room1);
|
|
await util.assertRead(room2);
|
|
await util.receiveMessages(room2, ["Msg1"]);
|
|
await util.assertUnread(room2, 1);
|
|
await util.markAsRead(room2);
|
|
await util.assertRead(room2);
|
|
|
|
// When I restart
|
|
await util.saveAndReload();
|
|
|
|
// Then all messages are still read
|
|
await util.assertRead(room2);
|
|
});
|
|
});
|
|
});
|
|
});
|