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

Commit 2e4a638

Browse files
committed
resolved merge conflict
2 parents bbe97c3 + 924865b commit 2e4a638

File tree

236 files changed

+3521
-11729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+3521
-11729
lines changed

cypress/global.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
import "../src/@types/global";
18+
import "../src/@types/svg";
19+
import "../src/@types/raw-loader";
1720
import "matrix-js-sdk/src/@types/global";
1821
import type {
1922
MatrixClient,

cypress/integration/10-user-view/user-view.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("UserView", () => {
2727
synapse = data;
2828

2929
cy.initTestUser(synapse, "Violet");
30-
cy.getBot(synapse, "Usman").as("bot");
30+
cy.getBot(synapse, { displayName: "Usman" }).as("bot");
3131
});
3232
});
3333

cypress/integration/11-room-directory/room-directory.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("Room Directory", () => {
2727
synapse = data;
2828

2929
cy.initTestUser(synapse, "Ray");
30-
cy.getBot(synapse, "Paul").as("bot");
30+
cy.getBot(synapse, { displayName: "Paul" }).as("bot");
3131
});
3232
});
3333

cypress/integration/12-spotlight/spotlight.spec.ts

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,14 @@ describe("Spotlight", () => {
125125
let room2Id: string;
126126

127127
beforeEach(() => {
128-
cy.enableLabsFeature("feature_spotlight");
129128
cy.startSynapse("default").then(data => {
130129
synapse = data;
131130
cy.initTestUser(synapse, "Jim").then(() =>
132-
cy.getBot(synapse, bot1Name).then(_bot1 => {
131+
cy.getBot(synapse, { displayName: bot1Name }).then(_bot1 => {
133132
bot1 = _bot1;
134133
}),
135134
).then(() =>
136-
cy.getBot(synapse, bot2Name).then(_bot2 => {
135+
cy.getBot(synapse, { displayName: bot2Name }).then(_bot2 => {
137136
// eslint-disable-next-line @typescript-eslint/no-unused-vars
138137
bot2 = _bot2;
139138
}),
@@ -157,6 +156,7 @@ describe("Spotlight", () => {
157156
});
158157

159158
afterEach(() => {
159+
cy.visit("/#/home");
160160
cy.stopSynapse(synapse);
161161
});
162162

@@ -265,6 +265,47 @@ describe("Spotlight", () => {
265265
});
266266
});
267267

268+
it("should find group DMs by usernames or user ids", () => {
269+
// First we want to share a room with both bots to ensure we’ve got their usernames cached
270+
cy.inviteUser(room1Id, bot2.getUserId());
271+
272+
// Starting a DM with ByteBot (will be turned into a group dm later)
273+
cy.openSpotlightDialog().within(() => {
274+
cy.spotlightFilter(Filter.People);
275+
cy.spotlightSearch().clear().type(bot2Name);
276+
cy.spotlightResults().should("have.length", 1);
277+
cy.spotlightResults().eq(0).should("contain", bot2Name);
278+
cy.spotlightResults().eq(0).click();
279+
}).then(() => {
280+
cy.roomHeaderName().should("contain", bot2Name);
281+
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", bot2Name);
282+
});
283+
284+
// Invite BotBob into existing DM with ByteBot
285+
cy.getDmRooms(bot2.getUserId()).then(dmRooms => dmRooms[0])
286+
.then(groupDmId => cy.inviteUser(groupDmId, bot1.getUserId()))
287+
.then(() => {
288+
cy.roomHeaderName().should("contain", `${bot1Name} and ${bot2Name}`);
289+
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", `${bot1Name} and ${bot2Name}`);
290+
});
291+
292+
// Search for BotBob by id, should return group DM and user
293+
cy.openSpotlightDialog().within(() => {
294+
cy.spotlightFilter(Filter.People);
295+
cy.spotlightSearch().clear().type(bot1.getUserId());
296+
cy.spotlightResults().should("have.length", 2);
297+
cy.spotlightResults().eq(0).should("contain", `${bot1Name} and ${bot2Name}`);
298+
});
299+
300+
// Search for ByteBot by id, should return group DM and user
301+
cy.openSpotlightDialog().within(() => {
302+
cy.spotlightFilter(Filter.People);
303+
cy.spotlightSearch().clear().type(bot2.getUserId());
304+
cy.spotlightResults().should("have.length", 2);
305+
cy.spotlightResults().eq(0).should("contain", `${bot1Name} and ${bot2Name}`);
306+
});
307+
});
308+
268309
it("should allow opening group chat dialog", () => {
269310
cy.openSpotlightDialog().within(() => {
270311
cy.spotlightFilter(Filter.People);
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/// <reference types="cypress" />
18+
19+
import { SynapseInstance } from "../../plugins/synapsedocker";
20+
21+
describe("Pills", () => {
22+
let synapse: SynapseInstance;
23+
24+
beforeEach(() => {
25+
cy.startSynapse("default").then(data => {
26+
synapse = data;
27+
28+
cy.initTestUser(synapse, "Sally");
29+
});
30+
});
31+
32+
afterEach(() => {
33+
cy.stopSynapse(synapse);
34+
});
35+
36+
it('should navigate clicks internally to the app', () => {
37+
const messageRoom = "Send Messages Here";
38+
const targetLocalpart = "aliasssssssssssss";
39+
cy.createRoom({
40+
name: "Target",
41+
room_alias_name: targetLocalpart,
42+
}).as("targetRoomId");
43+
cy.createRoom({
44+
name: messageRoom,
45+
}).as("messageRoomId");
46+
cy.all([
47+
cy.get<string>("@targetRoomId"),
48+
cy.get<string>("@messageRoomId"),
49+
]).then(([targetRoomId, messageRoomId]) => { // discard the target room ID - we don't need it
50+
cy.viewRoomByName(messageRoom);
51+
cy.url().should("contain", `/#/room/${messageRoomId}`);
52+
53+
// send a message using the built-in room mention functionality (autocomplete)
54+
cy.get(".mx_SendMessageComposer .mx_BasicMessageComposer_input")
55+
.type(`Hello world! Join here: #${targetLocalpart.substring(0, 3)}`);
56+
cy.get(".mx_Autocomplete_Completion_title").click();
57+
cy.get(".mx_MessageComposer_sendMessage").click();
58+
59+
// find the pill in the timeline and click it
60+
cy.get(".mx_EventTile_body .mx_Pill").click();
61+
62+
// verify we landed at a sane place
63+
cy.url().should("contain", `/#/room/#${targetLocalpart}:`);
64+
65+
cy.wait(250); // let the room list settle
66+
67+
// go back to the message room and try to click on the pill text, as a user would
68+
cy.viewRoomByName(messageRoom);
69+
cy.get(".mx_EventTile_body .mx_Pill .mx_Pill_linkText")
70+
.should("have.css", "pointer-events", "none")
71+
.click({ force: true }); // force is to ensure we bypass pointer-events
72+
cy.url().should("contain", `https://matrix.to/#/#${targetLocalpart}:`);
73+
});
74+
});
75+
});

cypress/integration/5-threads/threads.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("Threads", () => {
7373

7474
it("should be usable for a conversation", () => {
7575
let bot: MatrixClient;
76-
cy.getBot(synapse, "BotBob").then(_bot => {
76+
cy.getBot(synapse, { displayName: "BotBob" }).then(_bot => {
7777
bot = _bot;
7878
});
7979

cypress/integration/6-spaces/spaces.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe("Spaces", () => {
167167

168168
it("should allow user to invite another to a space", () => {
169169
let bot: MatrixClient;
170-
cy.getBot(synapse, "BotBob").then(_bot => {
170+
cy.getBot(synapse, { displayName: "BotBob" }).then(_bot => {
171171
bot = _bot;
172172
});
173173

@@ -202,7 +202,7 @@ describe("Spaces", () => {
202202
});
203203
getSpacePanelButton("My Space").should("exist");
204204

205-
cy.getBot(synapse, "BotBob").then({ timeout: 10000 }, async bot => {
205+
cy.getBot(synapse, { displayName: "BotBob" }).then({ timeout: 10000 }, async bot => {
206206
const { room_id: roomId } = await bot.createRoom(spaceCreateOptions("Space Space"));
207207
await bot.invite(roomId, user.userId);
208208
});

0 commit comments

Comments
 (0)