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

Commit 4208df2

Browse files
committed
Make spotlight test more reliable
1 parent 687af8f commit 4208df2

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

cypress/e2e/spotlight/spotlight.spec.ts

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -349,30 +349,34 @@ describe("Spotlight", () => {
349349
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", bot2Name);
350350

351351
// Invite BotBob into existing DM with ByteBot
352-
cy.getDmRooms(bot2.getUserId()).then(dmRooms => dmRooms[0])
353-
.then(groupDmId => cy.inviteUser(groupDmId, bot1.getUserId()))
354-
.then(() => {
355-
cy.roomHeaderName().should("contain", `${bot1Name} and ${bot2Name}`);
356-
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", `${bot1Name} and ${bot2Name}`);
357-
});
358-
359-
// Search for BotBob by id, should return group DM and user
360-
cy.openSpotlightDialog().within(() => {
361-
cy.spotlightFilter(Filter.People);
362-
cy.spotlightSearch().clear().type(bot1.getUserId());
363-
cy.wait(1000); // wait for the dialog code to settle
364-
cy.spotlightResults().should("have.length", 2);
365-
cy.spotlightResults().eq(0).should("contain", `${bot1Name} and ${bot2Name}`);
366-
});
352+
cy.getDmRooms(bot2.getUserId())
353+
.should("have.length", 1)
354+
.then(dmRooms => cy.getClient().then(client => client.getRoom(dmRooms[0])))
355+
.then(groupDm => {
356+
cy.inviteUser(groupDm.roomId, bot1.getUserId());
357+
cy.roomHeaderName().should(($element) =>
358+
expect($element.get(0).innerText).contains(groupDm.name));
359+
cy.get(".mx_RoomSublist[aria-label=People]").should(($element) =>
360+
expect($element.get(0).innerText).contains(groupDm.name));
361+
362+
// Search for BotBob by id, should return group DM and user
363+
cy.openSpotlightDialog().within(() => {
364+
cy.spotlightFilter(Filter.People);
365+
cy.spotlightSearch().clear().type(bot1.getUserId());
366+
cy.wait(1000); // wait for the dialog code to settle
367+
cy.spotlightResults().should("have.length", 2);
368+
cy.spotlightResults().eq(0).should("contain", groupDm.name);
369+
});
367370

368-
// Search for ByteBot by id, should return group DM and user
369-
cy.openSpotlightDialog().within(() => {
370-
cy.spotlightFilter(Filter.People);
371-
cy.spotlightSearch().clear().type(bot2.getUserId());
372-
cy.wait(1000); // wait for the dialog code to settle
373-
cy.spotlightResults().should("have.length", 2);
374-
cy.spotlightResults().eq(0).should("contain", `${bot1Name} and ${bot2Name}`);
375-
});
371+
// Search for ByteBot by id, should return group DM and user
372+
cy.openSpotlightDialog().within(() => {
373+
cy.spotlightFilter(Filter.People);
374+
cy.spotlightSearch().clear().type(bot2.getUserId());
375+
cy.wait(1000); // wait for the dialog code to settle
376+
cy.spotlightResults().should("have.length", 2);
377+
cy.spotlightResults().eq(0).should("contain", groupDm.name);
378+
});
379+
});
376380
});
377381

378382
// Test against https://github.com/vector-im/element-web/issues/22851

0 commit comments

Comments
 (0)