Fix cypress test in spotlight tests (#10884)

Sometimes, when I ran these tests locally, they would fail. The problem appears
to be that the join takes some time and can end up racing against the body of
the test. The solution is to wait for the join to complete before proceeding.
pull/28217/head
Richard van der Hoff 2023-05-15 11:37:24 +01:00 committed by GitHub
parent fb3f20f70c
commit ed06219dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -170,10 +170,9 @@ describe("Spotlight", () => {
)
.then(() =>
cy.window({ log: false }).then(({ matrixcs: { Visibility } }) => {
cy.createRoom({ name: room1Name, visibility: Visibility.Public }).then((_room1Id) => {
cy.createRoom({ name: room1Name, visibility: Visibility.Public }).then(async (_room1Id) => {
room1Id = _room1Id;
bot1.joinRoom(room1Id);
cy.visit("/#/room/" + room1Id);
await bot1.joinRoom(room1Id);
});
bot2.createRoom({ name: room2Name, visibility: Visibility.Public }).then(
({ room_id: _room2Id }) => {
@ -199,7 +198,10 @@ describe("Spotlight", () => {
});
}),
)
.then(() => cy.get(".mx_RoomSublist_skeletonUI").should("not.exist"));
.then(() => {
cy.visit("/#/room/" + room1Id);
cy.get(".mx_RoomSublist_skeletonUI").should("not.exist");
});
});
});