Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into germain-gg/summary-card-header
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry authored Nov 9, 2023
2 parents a6ca1d9 + 9448469 commit 088e13d
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 378 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,12 @@ jobs:
wait-on: "http://localhost:8080"
record: true
parallel: false
command: "yarn percy exec --parallel -- npx cypress-cloud run"
command-prefix: "yarn percy exec --parallel --"
ci-build-id: ${{ needs.prepare.outputs.uuid }}-${{ matrix.crypto }}
spec: cypress/e2e/[${{ matrix.segment }}]*/**
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CURRENTS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CURRENTS_PROJECT_ID: ${{ github.repository }}
CURRENTS_API_URL: ${{ vars.CURRENTS_API_URL }}

# Use existing chromium rather than downloading another
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
29 changes: 10 additions & 19 deletions cypress/e2e/read-receipts/editing-messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ describe("Read receipts", () => {

describe("editing messages", () => {
describe("in the main timeline", () => {
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
it("Editing a message leaves a room read", () => {
// Given I am not looking at the room
goTo(room1);
Expand Down Expand Up @@ -165,8 +164,7 @@ describe("Read receipts", () => {
// Then it remains read
assertStillRead(room2);
});
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
it.skip("Editing a reply after marking as read makes the room unread", () => {
it("Editing a reply after marking as read makes the room unread", () => {
// Given a reply is marked as read
goTo(room1);
receiveMessages(room2, ["Msg1", replyTo("Msg1", "Reply1")]);
Expand All @@ -180,8 +178,7 @@ describe("Read receipts", () => {
// Then the room remains read
assertStillRead(room2);
});
// https://github.com/vector-im/element-web/issues/26273
it.skip("A room with an edit is still read after restart", () => {
it("A room with an edit is still read after restart", () => {
// Given a message is marked as read
goTo(room2);
receiveMessages(room2, ["Msg1"]);
Expand Down Expand Up @@ -227,8 +224,7 @@ describe("Read receipts", () => {
});

describe("in threads", () => {
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
it.skip("An edit of a threaded message makes the room unread", () => {
it("An edit of a threaded message makes the room unread", () => {
// Given we have read the thread
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
Expand All @@ -247,8 +243,7 @@ describe("Read receipts", () => {
goTo(room2);
assertReadThread("Msg1");
});
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
it.skip("Reading an edit of a threaded message makes the room read", () => {
it("Reading an edit of a threaded message makes the room read", () => {
// Given an edited thread message appears after we read it
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
Expand All @@ -269,12 +264,12 @@ describe("Read receipts", () => {
assertStillRead(room2);
assertReadThread("Msg1");
});
// XXX: fails because the room is still "bold" even though the notification counts all disappear
// XXX: fails because the unread dot remains after marking as read
it.skip("Marking a room as read after an edit in a thread makes it read", () => {
// Given an edit in a thread is making the room unread
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
assertUnread(room2, 3); // TODO: the edit counts as a message!
assertUnread(room2, 2);

// When I mark the room as read
markAsRead(room2);
Expand Down Expand Up @@ -312,8 +307,7 @@ describe("Read receipts", () => {
// Then is it still unread
assertRead(room2);
});
// XXX: fails because it flakes, sometimes having 2 unread messages instead of 1
it.skip("A room where all threaded edits are read is still read after restart", () => {
it("A room where all threaded edits are read is still read after restart", () => {
goTo(room2);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1"), editOf("Resp1", "Edit1")]);
assertUnread(room2, 1);
Expand Down Expand Up @@ -342,8 +336,7 @@ describe("Read receipts", () => {
});

describe("thread roots", () => {
// XXX: fails because we see a dot instead of an unread number - probably the server and client disagree
it.skip("An edit of a thread root leaves the room read", () => {
it("An edit of a thread root leaves the room read", () => {
// Given I have read a thread
goTo(room1);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
Expand Down Expand Up @@ -385,8 +378,7 @@ describe("Read receipts", () => {
goTo(room1);
assertStillRead(room2);
});
// XXX: fails because it shows a dot instead of unread count
it.skip("Editing a thread root after reading leaves the room read", () => {
it("Editing a thread root after reading leaves the room read", () => {
// Given a fully-read thread exists
goTo(room2);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Resp1")]);
Expand Down Expand Up @@ -440,8 +432,7 @@ describe("Read receipts", () => {
goTo(room2);
assertReadThread("EditedReply");
});
// XXX: fails because the room has an unread dot after I marked it as read
it.skip("Marking a room as read after an edit of a thread root that is a reply leaves it read", () => {
it("Marking a room as read after an edit of a thread root that is a reply leaves it read", () => {
// Given a thread based on a reply exists and the reply has been edited
goTo(room1);
receiveMessages(room2, ["Msg", replyTo("Msg", "Reply"), threadedOff("Reply", "InThread")]);
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/read-receipts/high-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ describe("Read receipts", () => {
assertReadThread("Root2");
assertReadThread("Root3");
});
// https://github.com/vector-im/element-web/issues/26294
it.skip("Paging up to find old threads that were never read keeps the room unread", () => {
it("Paging up to find old threads that were never read keeps the room unread", () => {
// Given lots of messages in threads that are unread
goTo(room1);
receiveMessages(room2, [
Expand Down Expand Up @@ -300,8 +299,7 @@ describe("Read receipts", () => {
assertUnreadThread("Root2");
assertUnreadThread("Root3");
});
// XXX: fails because flakes, sometimes finding 7 unread instead of 6
it.skip("Looking in thread view to find old threads that were never read makes the room unread", () => {
it("Looking in thread view to find old threads that were never read makes the room unread", () => {
// Given lots of messages in threads that are unread
goTo(room1);
receiveMessages(room2, [
Expand Down
32 changes: 32 additions & 0 deletions cypress/e2e/read-receipts/reactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,38 @@ describe("Read receipts", () => {
assertReadThread("Msg1");
assertReadThread("Msg2");
});
it("Can remove a reaction in a thread", () => {
// 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
goTo(room1);
assertRead(room2);
receiveMessages(room2, ["Msg1", threadedOff("Msg1", "Reply1a")]);
assertUnread(room2, 2);

// When I react to a thread message
goTo(room2);
openThread("Msg1");
cy.get(".mx_ThreadPanel").findByText("Reply1a").realHover();
cy.findByRole("button", { name: "React" }).click();
cy.get(".mx_EmojiPicker_body").findByText("😀").click();

// And cancel the reaction
cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").click();

// Then it disappears
cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").should("not.exist");

// And I can do it all again without an error
cy.get(".mx_ThreadPanel").findByText("Reply1a").realHover();
cy.findByRole("button", { name: "React" }).click();
cy.get(".mx_EmojiPicker_body").findAllByText("😀").first().click();
cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").click();
cy.get(".mx_ThreadPanel").findByLabelText("Mae reacted with 😀").should("not.exist");
});
});

describe("thread roots", () => {
Expand Down
9 changes: 3 additions & 6 deletions cypress/e2e/read-receipts/redactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ describe("Read receipts", () => {
// Then it becomes read
assertRead(room2);
});
// XXX: fails because it flakes with the room unread when it should be read
it.skip("Sending and redacting a message after marking the room as read makes it read", () => {
it("Sending and redacting a message after marking the room as read makes it read", () => {
// Given a room that is marked as read
goTo(room1);
receiveMessages(room2, ["Msg1", "Msg2"]);
Expand Down Expand Up @@ -236,8 +235,7 @@ describe("Read receipts", () => {
// Then the unread count is still reduced
assertUnread(room2, 1);
});
// XXX: fails because flakes with matrix-js-sdk#3798 (only when all other tests are enabled!)
it.skip("Redacting all unread messages makes the room read", () => {
it("Redacting all unread messages makes the room read", () => {
// Given an unread room
goTo(room1);
receiveMessages(room2, ["Msg1", "Msg2"]);
Expand Down Expand Up @@ -266,8 +264,7 @@ describe("Read receipts", () => {
// Then the room is still read
assertRead(room2);
});
// Flakes because sometimes the unread count stays at 2
it.skip("Reacting to a redacted message leaves the room read", () => {
it("Reacting to a redacted message leaves the room read", () => {
// Given a redacted message exists
goTo(room1);
receiveMessages(room2, ["Msg1", "Msg2"]);
Expand Down
13 changes: 1 addition & 12 deletions cypress/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.

/// <reference types="cypress" />
import installLogsPrinter from "cypress-terminal-report/src/installLogsPrinter";
import cloudPlugin from "cypress-cloud/plugin";
import { initPlugins } from "cypress-plugin-init";

import PluginEvents = Cypress.PluginEvents;
Expand All @@ -36,17 +35,7 @@ import { mailhogDocker } from "./mailhog";
export default function (on: PluginEvents, config: PluginConfigOptions) {
initPlugins(
on,
[
cloudPlugin,
docker,
synapseDocker,
dendriteDocker,
slidingSyncProxyDocker,
webserver,
oAuthServer,
log,
mailhogDocker,
],
[docker, synapseDocker, dendriteDocker, slidingSyncProxyDocker, webserver, oAuthServer, log, mailhogDocker],
config,
);
installLogsPrinter(on, {
Expand Down
1 change: 0 additions & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import "@percy/cypress";
import "cypress-real-events";
import "@testing-library/cypress/add-commands";
import installLogsCollector from "cypress-terminal-report/src/installLogsCollector";
import "cypress-cloud/support";

import "./config.json";
import "./homeserver";
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@matrix-org/analytics-events": "^0.8.0",
"@matrix-org/emojibase-bindings": "^1.1.2",
"@matrix-org/matrix-wysiwyg": "2.4.1",
"@matrix-org/react-sdk-module-api": "^2.2.0",
"@matrix-org/react-sdk-module-api": "^2.2.1",
"@matrix-org/spec": "^1.7.0",
"@sentry/browser": "^7.0.0",
"@sentry/tracing": "^7.0.0",
Expand Down Expand Up @@ -189,7 +189,6 @@
"chokidar": "^3.5.1",
"cypress": "^12.0.0",
"cypress-axe": "^1.0.0",
"cypress-cloud": "^2.0.0-beta.0",
"cypress-multi-reporters": "^1.6.1",
"cypress-plugin-init": "^0.0.8",
"cypress-real-events": "^1.7.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/LegacyRoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
}}
title={label}
>
{props.icon}
{typeof props.icon === "function" ? props.icon() : props.icon}
</IconButton>
</Tooltip>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/RoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default function RoomHeader({
props.onClick();
}}
>
{props.icon}
{typeof props.icon === "function" ? props.icon() : props.icon}
</IconButton>
</Tooltip>
);
Expand Down
4 changes: 2 additions & 2 deletions test/components/views/rooms/LegacyRoomHeader-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ describe("LegacyRoomHeader", () => {
it("renders additionalButtons", async () => {
const additionalButtons: ViewRoomOpts["buttons"] = [
{
icon: <>test-icon</>,
icon: () => <>test-icon</>,
id: "test-id",
label: () => "test-label",
onClick: () => {},
Expand All @@ -757,7 +757,7 @@ describe("LegacyRoomHeader", () => {
const callback = jest.fn();
const additionalButtons: ViewRoomOpts["buttons"] = [
{
icon: <>test-icon</>,
icon: () => <>test-icon</>,
id: "test-id",
label: () => "test-label",
onClick: callback,
Expand Down
4 changes: 2 additions & 2 deletions test/components/views/rooms/RoomHeader-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ describe("RoomHeader", () => {
it("renders additionalButtons", async () => {
const additionalButtons: ViewRoomOpts["buttons"] = [
{
icon: <>test-icon</>,
icon: () => <>test-icon</>,
id: "test-id",
label: () => "test-label",
onClick: () => {},
Expand All @@ -539,7 +539,7 @@ describe("RoomHeader", () => {
const callback = jest.fn();
const additionalButtons: ViewRoomOpts["buttons"] = [
{
icon: <>test-icon</>,
icon: () => <>test-icon</>,
id: "test-id",
label: () => "test-label",
onClick: callback,
Expand Down
Loading

0 comments on commit 088e13d

Please sign in to comment.