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

Commit 4f5a65f

Browse files
authored
Add a test to check whether ReadReceiptGroup exists on ThreadView in the bubble layout (#10284)
1 parent 727afdc commit 4f5a65f

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

cypress/e2e/threads/threads.spec.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ limitations under the License.
1818

1919
import { HomeserverInstance } from "../../plugins/utils/homeserver";
2020
import { MatrixClient } from "../../global";
21+
import { SettingLevel } from "../../../src/settings/SettingLevel";
22+
import { Layout } from "../../../src/settings/enums/Layout";
2123

2224
describe("Threads", () => {
2325
let homeserver: HomeserverInstance;
@@ -54,6 +56,11 @@ describe("Threads", () => {
5456
cy.visit("/#/room/" + roomId);
5557
});
5658

59+
// Around 200 characters
60+
const MessageLong =
61+
"Hello there. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt " +
62+
"ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi";
63+
5764
// --MessageTimestamp-color = #acacac = rgb(172, 172, 172)
5865
// See: _MessageTimestamp.pcss
5966
const MessageTimestampColor = "rgb(172, 172, 172)";
@@ -76,7 +83,8 @@ describe("Threads", () => {
7683
// Bot starts thread
7784
cy.get<string>("@threadId").then((threadId) => {
7885
bot.sendMessage(roomId, threadId, {
79-
body: "Hello there",
86+
// Send a message long enough to be wrapped to check if avatars inside the ReadReceiptGroup are visible
87+
body: MessageLong,
8088
msgtype: "m.text",
8189
});
8290
});
@@ -86,11 +94,36 @@ describe("Threads", () => {
8694
cy.get(".mx_RoomView_body .mx_ThreadSummary .mx_ThreadSummary_content").should("contain", "Hello there");
8795
cy.get(".mx_RoomView_body .mx_ThreadSummary").click();
8896

97+
cy.get(".mx_ThreadView .mx_EventTile[data-layout='group'].mx_EventTile_last").within(() => {
98+
// Wait until the messages are rendered
99+
cy.get(".mx_EventTile_line .mx_MTextBody").should("have.text", MessageLong);
100+
101+
// Make sure the avatar inside ReadReceiptGroup is visible on the group layout
102+
cy.get(".mx_ReadReceiptGroup .mx_BaseAvatar_image").should("be.visible");
103+
});
104+
105+
// Enable the bubble layout
106+
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
107+
108+
cy.get(".mx_ThreadView .mx_EventTile[data-layout='bubble'].mx_EventTile_last").within(() => {
109+
// TODO: remove this after fixing the issue of ReadReceiptGroup being hidden on the bubble layout
110+
// See: https://github.com/vector-im/element-web/issues/23569
111+
cy.get(".mx_ReadReceiptGroup .mx_BaseAvatar_image").should("exist");
112+
113+
// Make sure the avatar inside ReadReceiptGroup is visible on bubble layout
114+
// TODO: enable this after fixing the issue of ReadReceiptGroup being hidden on the bubble layout
115+
// See: https://github.com/vector-im/element-web/issues/23569
116+
// cy.get(".mx_ReadReceiptGroup .mx_BaseAvatar_image").should("be.visible");
117+
});
118+
119+
// Re-enable the group layout
120+
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Group);
121+
89122
// User responds in thread
90123
cy.get(".mx_ThreadView .mx_BasicMessageComposer_input").type("Test{enter}");
91124

92125
// Check the colour of timestamp on EventTile in a thread (mx_ThreadView)
93-
cy.get(".mx_ThreadView .mx_EventTile_last .mx_EventTile_line .mx_MessageTimestamp").should(
126+
cy.get(".mx_ThreadView .mx_EventTile_last[data-layout='group'] .mx_EventTile_line .mx_MessageTimestamp").should(
94127
"have.css",
95128
"color",
96129
MessageTimestampColor,

0 commit comments

Comments
 (0)