Deflakey threads
cypress test (#10632)
`inviteUser` is asynchronous so you can't just call it and plough straight on. Also some logging improvements which helped debug this
This commit is contained in:
parent
ac2855789f
commit
e350b4c2c2
3 changed files with 24 additions and 15 deletions
|
@ -31,7 +31,6 @@ describe("Threads", () => {
|
||||||
});
|
});
|
||||||
cy.startHomeserver("default").then((data) => {
|
cy.startHomeserver("default").then((data) => {
|
||||||
homeserver = data;
|
homeserver = data;
|
||||||
|
|
||||||
cy.initTestUser(homeserver, "Tom");
|
cy.initTestUser(homeserver, "Tom");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -50,10 +49,13 @@ describe("Threads", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
cy.createRoom({}).then((_roomId) => {
|
cy.createRoom({})
|
||||||
|
.then((_roomId) => {
|
||||||
roomId = _roomId;
|
roomId = _roomId;
|
||||||
cy.inviteUser(roomId, bot.getUserId());
|
return cy.inviteUser(roomId, bot.getUserId());
|
||||||
bot.joinRoom(roomId);
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await bot.joinRoom(roomId);
|
||||||
cy.visit("/#/room/" + roomId);
|
cy.visit("/#/room/" + roomId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -407,10 +409,13 @@ describe("Threads", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
cy.createRoom({}).then((_roomId) => {
|
cy.createRoom({})
|
||||||
|
.then((_roomId) => {
|
||||||
roomId = _roomId;
|
roomId = _roomId;
|
||||||
cy.inviteUser(roomId, bot.getUserId());
|
return cy.inviteUser(roomId, bot.getUserId());
|
||||||
bot.joinRoom(roomId);
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await bot.joinRoom(roomId);
|
||||||
cy.visit("/#/room/" + roomId);
|
cy.visit("/#/room/" + roomId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,9 @@ Cypress.Commands.add("createSpace", (options: ICreateRoomOpts): Chainable<string
|
||||||
|
|
||||||
Cypress.Commands.add("inviteUser", (roomId: string, userId: string): Chainable<{}> => {
|
Cypress.Commands.add("inviteUser", (roomId: string, userId: string): Chainable<{}> => {
|
||||||
return cy.getClient().then(async (cli: MatrixClient) => {
|
return cy.getClient().then(async (cli: MatrixClient) => {
|
||||||
return cli.invite(roomId, userId);
|
const res = await cli.invite(roomId, userId);
|
||||||
|
Cypress.log({ name: "inviteUser", message: `sent invite in ${roomId} for ${userId}` });
|
||||||
|
return res;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,9 @@ declare global {
|
||||||
|
|
||||||
function startHomeserver(template: string): Chainable<HomeserverInstance> {
|
function startHomeserver(template: string): Chainable<HomeserverInstance> {
|
||||||
const homeserverName = Cypress.env("HOMESERVER");
|
const homeserverName = Cypress.env("HOMESERVER");
|
||||||
return cy.task<HomeserverInstance>(homeserverName + "Start", template);
|
return cy.task<HomeserverInstance>(homeserverName + "Start", template, { log: false }).then((x) => {
|
||||||
|
Cypress.log({ name: "startHomeserver", message: `Started homeserver instance ${x.serverId}` });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopHomeserver(homeserver?: HomeserverInstance): Chainable<AUTWindow> {
|
function stopHomeserver(homeserver?: HomeserverInstance): Chainable<AUTWindow> {
|
||||||
|
|
Loading…
Reference in a new issue