Start DM on first message (#8612)

This commit is contained in:
Michael Weimann 2022-08-04 08:19:52 +02:00 committed by GitHub
parent 0e0be08781
commit ed8ccb5d80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 482 additions and 65 deletions

View file

@ -57,7 +57,7 @@ const startDMWithBob = function(this: CryptoTestContext) {
};
const testMessages = function(this: CryptoTestContext) {
cy.get(".mx_BasicMessageComposer_input").should("have.focus").type("Hey!{enter}");
// check the invite message
cy.contains(".mx_EventTile_body", "Hey!")
.closest(".mx_EventTile")
.should("not.have.descendants", ".mx_EventTile_e2eIcon_warning")
@ -150,6 +150,11 @@ describe("Cryptography", function() {
it("creating a DM should work, being e2e-encrypted / user verification", function(this: CryptoTestContext) {
cy.bootstrapCrossSigning();
startDMWithBob.call(this);
// send first message
cy.get(".mx_BasicMessageComposer_input")
.click()
.should("have.focus")
.type("Hey!{enter}");
checkDMRoom();
bobJoin.call(this);
testMessages.call(this);

View file

@ -118,10 +118,13 @@ Cypress.Commands.add("startDM", (name: string) => {
cy.spotlightResults().should("have.length", 1);
cy.spotlightResults().eq(0).should("contain", name);
cy.spotlightResults().eq(0).click();
}).then(() => {
cy.roomHeaderName().should("contain", name);
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", name);
});
// send first message to start DM
cy.get(".mx_BasicMessageComposer_input")
.should("have.focus")
.type("Hey!{enter}");
cy.contains(".mx_EventTile_body", "Hey!");
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", name);
});
describe("Spotlight", () => {
@ -324,11 +327,19 @@ describe("Spotlight", () => {
cy.spotlightResults().should("have.length", 1);
cy.spotlightResults().eq(0).should("contain", bot2Name);
cy.spotlightResults().eq(0).click();
}).then(() => {
cy.roomHeaderName().should("contain", bot2Name);
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", bot2Name);
});
// Send first message to actually start DM
cy.roomHeaderName().should("contain", bot2Name);
cy.get(".mx_BasicMessageComposer_input")
.click()
.should("have.focus")
.type("Hey!{enter}");
// Assert DM exists by checking for the first message and the room being in the room list
cy.contains(".mx_EventTile_body", "Hey!");
cy.get(".mx_RoomSublist[aria-label=People]").should("contain", bot2Name);
// Invite BotBob into existing DM with ByteBot
cy.getDmRooms(bot2.getUserId()).then(dmRooms => dmRooms[0])
.then(groupDmId => cy.inviteUser(groupDmId, bot1.getUserId()))