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

Commit 2211a43

Browse files
committed
fixing files
1 parent 3588dba commit 2211a43

File tree

120 files changed

+5575
-925
lines changed

Some content is hidden

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

120 files changed

+5575
-925
lines changed

cypress/e2e/lazy-loading/lazy-loading.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,21 @@ describe("Lazy Loading", () => {
115115
});
116116
}
117117

118-
function getMembersInMemberlist(): Chainable<JQuery> {
119-
return cy.get(".mx_MemberList .mx_EntityTile_name");
118+
function getMemberInMemberlist(name: string): Chainable<JQuery> {
119+
return cy.contains(".mx_MemberList .mx_EntityTile_name", name);
120120
}
121121

122122
function checkMemberList(charlies: Charly[]) {
123-
getMembersInMemberlist().contains("Alice").should("exist");
124-
getMembersInMemberlist().contains("Bob").should("exist");
123+
getMemberInMemberlist("Alice").should("exist");
124+
getMemberInMemberlist("Bob").should("exist");
125125
charlies.forEach(charly => {
126-
getMembersInMemberlist().contains(charly.displayName).should("exist");
126+
getMemberInMemberlist(charly.displayName).should("exist");
127127
});
128128
}
129129

130130
function checkMemberListLacksCharlies(charlies: Charly[]) {
131131
charlies.forEach(charly => {
132-
getMembersInMemberlist().contains(charly.displayName).should("not.exist");
132+
getMemberInMemberlist(charly.displayName).should("not.exist");
133133
});
134134
}
135135

cypress/e2e/location/location.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ limitations under the License.
1818

1919
import { SynapseInstance } from "../../plugins/synapsedocker";
2020
import Chainable = Cypress.Chainable;
21-
import { SettingLevel } from "../../../src/settings/SettingLevel";
2221

2322
describe("Location sharing", () => {
2423
let synapse: SynapseInstance;
@@ -40,9 +39,6 @@ describe("Location sharing", () => {
4039

4140
cy.initTestUser(synapse, "Tom");
4241
});
43-
44-
// enable pin drop location sharing feature
45-
cy.setSettingValue("feature_location_share_pin_drop", null, SettingLevel.DEVICE, true);
4642
});
4743

4844
afterEach(() => {

cypress/e2e/regression-tests/pills-click-in-app.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ describe("Pills", () => {
5959
// find the pill in the timeline and click it
6060
cy.get(".mx_EventTile_body .mx_Pill").click();
6161

62+
const localUrl = `/#/room/#${targetLocalpart}:`;
6263
// verify we landed at a sane place
63-
cy.url().should("contain", `/#/room/#${targetLocalpart}:`);
64+
cy.url().should("contain", localUrl);
6465

6566
cy.wait(250); // let the room list settle
6667

@@ -69,7 +70,7 @@ describe("Pills", () => {
6970
cy.get(".mx_EventTile_body .mx_Pill .mx_Pill_linkText")
7071
.should("have.css", "pointer-events", "none")
7172
.click({ force: true }); // force is to ensure we bypass pointer-events
72-
cy.url().should("contain", `https://matrix.to/#/#${targetLocalpart}:`);
73+
cy.url().should("contain", localUrl);
7374
});
7475
});
7576
});
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
function seedLabs(synapse: SynapseInstance, labsVal: boolean | null): void {
22+
cy.initTestUser(synapse, "Sally", () => {
23+
// seed labs flag
24+
cy.window({ log: false }).then(win => {
25+
if (typeof labsVal === "boolean") {
26+
// stringify boolean
27+
win.localStorage.setItem("mx_labs_feature_feature_hidden_read_receipts", `${labsVal}`);
28+
}
29+
});
30+
});
31+
}
32+
33+
function testForVal(settingVal: boolean | null): void {
34+
const testRoomName = "READ RECEIPTS";
35+
cy.createRoom({ name: testRoomName }).as("roomId");
36+
cy.all([cy.get<string>("@roomId")]).then(() => {
37+
cy.viewRoomByName(testRoomName).then(() => {
38+
// if we can see the room, then sync is working for us. It's time to see if the
39+
// migration even ran.
40+
41+
cy.getSettingValue("sendReadReceipts", null, true).should("satisfy", (val) => {
42+
if (typeof settingVal === "boolean") {
43+
return val === settingVal;
44+
} else {
45+
return !val; // falsy - we don't actually care if it's undefined, null, or a literal false
46+
}
47+
});
48+
});
49+
});
50+
}
51+
52+
describe("Hidden Read Receipts Setting Migration", () => {
53+
// We run this as a full-blown end-to-end test to ensure it works in an integration
54+
// sense. If we unit tested it, we'd be testing that the code works but not that the
55+
// migration actually runs.
56+
//
57+
// Here, we get to test that not only the code works but also that it gets run. Most
58+
// of our interactions are with the JS console as we're honestly just checking that
59+
// things got set correctly.
60+
//
61+
// For a security-sensitive feature like hidden read receipts, it's absolutely vital
62+
// that we migrate the setting appropriately.
63+
64+
let synapse: SynapseInstance;
65+
66+
beforeEach(() => {
67+
cy.startSynapse("default").then(data => {
68+
synapse = data;
69+
});
70+
});
71+
72+
afterEach(() => {
73+
cy.stopSynapse(synapse);
74+
});
75+
76+
it('should not migrate the lack of a labs flag', () => {
77+
seedLabs(synapse, null);
78+
testForVal(null);
79+
});
80+
81+
it('should migrate labsHiddenRR=false as sendRR=true', () => {
82+
seedLabs(synapse, false);
83+
testForVal(true);
84+
});
85+
86+
it('should migrate labsHiddenRR=true as sendRR=false', () => {
87+
seedLabs(synapse, true);
88+
testForVal(false);
89+
});
90+
});

cypress/e2e/spaces/spaces.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ describe("Spaces", () => {
100100
cy.get(".mx_AccessibleButton").contains("Go to my first room").click();
101101

102102
// Assert rooms exist in the room list
103-
cy.get(".mx_RoomTile").contains("General").should("exist");
104-
cy.get(".mx_RoomTile").contains("Random").should("exist");
105-
cy.get(".mx_RoomTile").contains("Jokes").should("exist");
103+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "General").should("exist");
104+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "Random").should("exist");
105+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "Jokes").should("exist");
106106
});
107107

108108
it("should allow user to create private space", () => {
@@ -128,14 +128,14 @@ describe("Spaces", () => {
128128
cy.get(".mx_AccessibleButton").contains("Skip for now").click();
129129

130130
// Assert rooms exist in the room list
131-
cy.get(".mx_RoomTile").contains("General").should("exist");
132-
cy.get(".mx_RoomTile").contains("Random").should("exist");
133-
cy.get(".mx_RoomTile").contains("Projects").should("exist");
131+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "General").should("exist");
132+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "Random").should("exist");
133+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "Projects").should("exist");
134134

135135
// Assert rooms exist in the space explorer
136-
cy.get(".mx_SpaceHierarchy_roomTile").contains("General").should("exist");
137-
cy.get(".mx_SpaceHierarchy_roomTile").contains("Random").should("exist");
138-
cy.get(".mx_SpaceHierarchy_roomTile").contains("Projects").should("exist");
136+
cy.get(".mx_SpaceHierarchy_list").contains(".mx_SpaceHierarchy_roomTile", "General").should("exist");
137+
cy.get(".mx_SpaceHierarchy_list").contains(".mx_SpaceHierarchy_roomTile", "Random").should("exist");
138+
cy.get(".mx_SpaceHierarchy_list").contains(".mx_SpaceHierarchy_roomTile", "Projects").should("exist");
139139
});
140140

141141
it("should allow user to create just-me space", () => {
@@ -157,8 +157,8 @@ describe("Spaces", () => {
157157
cy.get(".mx_AddExistingToSpace_entry").click();
158158
cy.get(".mx_AccessibleButton").contains("Add").click();
159159

160-
cy.get(".mx_RoomTile").contains("Sample Room").should("exist");
161-
cy.get(".mx_SpaceHierarchy_roomTile").contains("Sample Room").should("exist");
160+
cy.get(".mx_RoomList").contains(".mx_RoomTile", "Sample Room").should("exist");
161+
cy.get(".mx_SpaceHierarchy_list").contains(".mx_SpaceHierarchy_roomTile", "Sample Room").should("exist");
162162
});
163163

164164
it("should allow user to invite another to a space", () => {
@@ -233,8 +233,8 @@ describe("Spaces", () => {
233233
cy.viewSpaceHomeByName(spaceName);
234234
});
235235
cy.get(".mx_SpaceRoomView .mx_SpaceHierarchy_list").within(() => {
236-
cy.get(".mx_SpaceHierarchy_roomTile").contains("Music").should("exist");
237-
cy.get(".mx_SpaceHierarchy_roomTile").contains("Gaming").should("exist");
236+
cy.contains(".mx_SpaceHierarchy_roomTile", "Music").should("exist");
237+
cy.contains(".mx_SpaceHierarchy_roomTile", "Gaming").should("exist");
238238
});
239239
});
240240
});

cypress/e2e/timeline/timeline.spec.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe("Timeline", () => {
155155
cy.visit("/#/room/" + roomId);
156156
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC);
157157
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary[data-layout=irc] " +
158-
".mx_GenericEventListSummary_summary", "created and configured the room.");
158+
".mx_GenericEventListSummary_summary", "created and configured the room.").should("exist");
159159
cy.get(".mx_Spinner").should("not.exist");
160160
cy.percySnapshot("Configured room on IRC layout");
161161
});
@@ -166,7 +166,7 @@ describe("Timeline", () => {
166166

167167
// Wait until configuration is finished
168168
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary " +
169-
".mx_GenericEventListSummary_summary", "created and configured the room.");
169+
".mx_GenericEventListSummary_summary", "created and configured the room.").should("exist");
170170

171171
// Click "expand" link button
172172
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
@@ -193,14 +193,14 @@ describe("Timeline", () => {
193193
cy.visit("/#/room/" + roomId);
194194
cy.setSettingValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true);
195195
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary .mx_GenericEventListSummary_summary",
196-
"created and configured the room.");
196+
"created and configured the room.").should("exist");
197197

198198
// Edit message
199199
cy.contains(".mx_RoomView_body .mx_EventTile .mx_EventTile_line", "Message").within(() => {
200200
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover
201201
cy.get(".mx_BasicMessageComposer_input").type("Edit{enter}");
202202
});
203-
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile[data-scroll-tokens]", "MessageEdit");
203+
cy.contains(".mx_EventTile[data-scroll-tokens]", "MessageEdit").should("exist");
204204

205205
// Click timestamp to highlight hidden event line
206206
cy.get(".mx_RoomView_body .mx_EventTile_info .mx_MessageTimestamp").click();
@@ -228,18 +228,19 @@ describe("Timeline", () => {
228228
cy.visit("/#/room/" + roomId);
229229
cy.setSettingValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true);
230230
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary " +
231-
".mx_GenericEventListSummary_summary", "created and configured the room.");
231+
".mx_GenericEventListSummary_summary", "created and configured the room.").should("exist");
232232

233233
// Edit message
234234
cy.contains(".mx_RoomView_body .mx_EventTile .mx_EventTile_line", "Message").within(() => {
235235
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover
236236
cy.get(".mx_BasicMessageComposer_input").type("Edit{enter}");
237237
});
238-
cy.contains(".mx_RoomView_body .mx_EventTile[data-scroll-tokens]", "MessageEdit");
238+
cy.contains(".mx_RoomView_body .mx_EventTile[data-scroll-tokens]", "MessageEdit").should("exist");
239239

240240
// Click top left of the event toggle, which should not be covered by MessageActionBar's safe area
241-
cy.get(".mx_EventTile .mx_ViewSourceEvent").realHover()
242-
.get(".mx_EventTile .mx_ViewSourceEvent .mx_ViewSourceEvent_toggle").click('topLeft', { force: false });
241+
cy.get(".mx_EventTile .mx_ViewSourceEvent").realHover().within(() => {
242+
cy.get(".mx_ViewSourceEvent_toggle").click('topLeft', { force: false });
243+
});
243244

244245
// Make sure the expand toggle worked
245246
cy.get(".mx_EventTile .mx_ViewSourceEvent_expanded .mx_ViewSourceEvent_toggle").should("be.visible");
@@ -249,17 +250,17 @@ describe("Timeline", () => {
249250
cy.visit("/#/room/" + roomId);
250251
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.Bubble);
251252
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary[data-layout=bubble] " +
252-
".mx_GenericEventListSummary_summary", "created and configured the room.");
253+
".mx_GenericEventListSummary_summary", "created and configured the room.").should("exist");
253254

254255
// Click "expand" link button
255256
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click();
256257

257258
// Click "collapse" link button on the first hovered info event line
258-
cy.get(".mx_GenericEventListSummary_unstyledList .mx_EventTile_info:first-of-type").realHover()
259-
.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").click({ force: false });
259+
cy.get(".mx_GenericEventListSummary_unstyledList .mx_EventTile_info:first-of-type").realHover();
260+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=true]").click({ force: false });
260261

261262
// Make sure "collapse" link button worked
262-
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]");
263+
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").should("exist");
263264
});
264265

265266
it("should highlight search result words regardless of formatting", () => {
@@ -285,7 +286,7 @@ describe("Timeline", () => {
285286
cy.getComposer().type(`${MESSAGE}{enter}`);
286287

287288
// Reply to the message
288-
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile_line", "Hello world").within(() => {
289+
cy.get(".mx_RoomView_body").contains(".mx_EventTile_line", "Hello world").within(() => {
289290
cy.get('[aria-label="Reply"]').click({ force: true }); // Cypress has no ability to hover
290291
});
291292
};
@@ -296,20 +297,22 @@ describe("Timeline", () => {
296297

297298
cy.getComposer().type(`${reply}{enter}`);
298299

299-
cy.get(".mx_RoomView_body .mx_EventTile .mx_EventTile_line").find(".mx_ReplyTile .mx_MTextBody")
300+
cy.get(".mx_RoomView_body .mx_EventTile .mx_EventTile_line .mx_ReplyTile .mx_MTextBody")
300301
.should("contain", MESSAGE);
301-
cy.get(".mx_RoomView_body .mx_EventTile > .mx_EventTile_line > .mx_MTextBody").contains(reply)
302+
cy.contains(".mx_RoomView_body .mx_EventTile > .mx_EventTile_line > .mx_MTextBody", reply)
302303
.should("have.length", 1);
303304
});
304305

305-
xit("can reply with a voice message", () => {
306+
it("can reply with a voice message", () => {
306307
viewRoomSendMessageAndSetupReply();
307308

308-
cy.openMessageComposerOptions().find(`[aria-label="Voice Message"]`).click();
309+
cy.openMessageComposerOptions().within(() => {
310+
cy.get(`[aria-label="Voice Message"]`).click();
311+
});
309312
cy.wait(3000);
310-
cy.getComposer().find(".mx_MessageComposer_sendMessage").click();
313+
cy.get(".mx_RoomView_body .mx_MessageComposer .mx_MessageComposer_sendMessage").click();
311314

312-
cy.get(".mx_RoomView_body .mx_EventTile .mx_EventTile_line").find(".mx_ReplyTile .mx_MTextBody")
315+
cy.get(".mx_RoomView_body .mx_EventTile .mx_EventTile_line .mx_ReplyTile .mx_MTextBody")
313316
.should("contain", MESSAGE);
314317
cy.get(".mx_RoomView_body .mx_EventTile > .mx_EventTile_line > .mx_MVoiceMessageBody")
315318
.should("have.length", 1);

cypress/e2e/user-onboarding/user-onboarding-new.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ describe("User Onboarding (new user)", () => {
4949

5050
it("page is shown", () => {
5151
cy.get('.mx_UserOnboardingPage').should('exist');
52-
cy.percySnapshot("User onboarding page");
52+
cy.get('.mx_UserOnboardingList')
53+
.should('exist')
54+
.should(($list) => {
55+
const list = $list.get(0);
56+
expect(getComputedStyle(list).opacity).to.be.eq("1");
57+
});
58+
cy.get('.mx_UserOnboardingPage')
59+
.percySnapshotElement("User onboarding page");
5360
});
5461

5562
it("app download dialog", () => {
@@ -58,7 +65,10 @@ describe("User Onboarding (new user)", () => {
5865
cy.get('[role=dialog]')
5966
.contains("#mx_BaseDialog_title", "Download Element")
6067
.should("exist");
61-
cy.percySnapshot("App download dialog");
68+
cy.get('[role=dialog]')
69+
.percySnapshotElement("App download dialog", {
70+
widths: [640],
71+
});
6272
});
6373

6474
it("using find friends action should increase progress", () => {

cypress/plugins/docker/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,14 @@ export function dockerExec(args: {
6161
childProcess.execFile("docker", [
6262
"exec", args.containerId,
6363
...args.params,
64-
], { encoding: 'utf8' }, err => {
65-
if (err) reject(err);
66-
else resolve();
64+
], { encoding: 'utf8' }, (err, stdout, stderr) => {
65+
if (err) {
66+
console.log(stdout);
67+
console.log(stderr);
68+
reject(err);
69+
return;
70+
}
71+
resolve();
6772
});
6873
});
6974
}

0 commit comments

Comments
 (0)