Add credentials when calling bootstrapCrossSigning in Cypress tests (#9919)
This commit is contained in:
@@ -20,6 +20,7 @@ import type { ISasEvent } from "matrix-js-sdk/src/crypto/verification/SAS";
|
||||
import type { CypressBot } from "../../support/bot";
|
||||
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
||||
import Chainable = Cypress.Chainable;
|
||||
import { UserCredentials } from "../../support/login";
|
||||
|
||||
type EmojiMapping = [emoji: string, name: string];
|
||||
interface CryptoTestContext extends Mocha.Context {
|
||||
@@ -154,11 +155,15 @@ const verify = function (this: CryptoTestContext) {
|
||||
};
|
||||
|
||||
describe("Cryptography", function () {
|
||||
let aliceCredentials: UserCredentials;
|
||||
|
||||
beforeEach(function () {
|
||||
cy.startHomeserver("default")
|
||||
.as("homeserver")
|
||||
.then((homeserver: HomeserverInstance) => {
|
||||
cy.initTestUser(homeserver, "Alice", undefined, "alice_");
|
||||
cy.initTestUser(homeserver, "Alice", undefined, "alice_").then((credentials) => {
|
||||
aliceCredentials = credentials;
|
||||
});
|
||||
cy.getBot(homeserver, { displayName: "Bob", autoAcceptInvites: false, userIdPrefix: "bob_" }).as("bob");
|
||||
});
|
||||
});
|
||||
@@ -183,7 +188,7 @@ describe("Cryptography", function () {
|
||||
});
|
||||
|
||||
it("creating a DM should work, being e2e-encrypted / user verification", function (this: CryptoTestContext) {
|
||||
cy.bootstrapCrossSigning();
|
||||
cy.bootstrapCrossSigning(aliceCredentials);
|
||||
startDMWithBob.call(this);
|
||||
// send first message
|
||||
cy.get(".mx_BasicMessageComposer_input").click().should("have.focus").type("Hey!{enter}");
|
||||
@@ -194,7 +199,7 @@ describe("Cryptography", function () {
|
||||
});
|
||||
|
||||
it("should allow verification when there is no existing DM", function (this: CryptoTestContext) {
|
||||
cy.bootstrapCrossSigning();
|
||||
cy.bootstrapCrossSigning(aliceCredentials);
|
||||
autoJoin(this.bob);
|
||||
|
||||
// we need to have a room with the other user present, so we can open the verification panel
|
||||
@@ -212,7 +217,7 @@ describe("Cryptography", function () {
|
||||
});
|
||||
|
||||
it("should show the correct shield on edited e2e events", function (this: CryptoTestContext) {
|
||||
cy.bootstrapCrossSigning();
|
||||
cy.bootstrapCrossSigning(aliceCredentials);
|
||||
|
||||
// bob has a second, not cross-signed, device
|
||||
cy.loginBot(this.homeserver, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
|
||||
|
||||
@@ -105,15 +105,9 @@ describe("Decryption Failure Bar", () => {
|
||||
"and there are other verified devices or backups",
|
||||
() => {
|
||||
let otherDevice: MatrixClient | undefined;
|
||||
cy.loginBot(homeserver, testUser.username, testUser.password, {})
|
||||
cy.loginBot(homeserver, testUser.username, testUser.password, { bootstrapCrossSigning: true })
|
||||
.then(async (cli) => {
|
||||
otherDevice = cli;
|
||||
await otherDevice.bootstrapCrossSigning({
|
||||
authUploadDeviceSigningKeys: async (makeRequest) => {
|
||||
await makeRequest({});
|
||||
},
|
||||
setupNewCrossSigning: true,
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
cy.botSendMessage(bot, roomId, "test");
|
||||
@@ -169,15 +163,11 @@ describe("Decryption Failure Bar", () => {
|
||||
"should prompt the user to reset keys, if this device isn't verified " +
|
||||
"and there are no other verified devices or backups",
|
||||
() => {
|
||||
cy.loginBot(homeserver, testUser.username, testUser.password, {}).then(async (cli) => {
|
||||
await cli.bootstrapCrossSigning({
|
||||
authUploadDeviceSigningKeys: async (makeRequest) => {
|
||||
await makeRequest({});
|
||||
},
|
||||
setupNewCrossSigning: true,
|
||||
});
|
||||
await cli.logout(true);
|
||||
});
|
||||
cy.loginBot(homeserver, testUser.username, testUser.password, { bootstrapCrossSigning: true }).then(
|
||||
async (cli) => {
|
||||
await cli.logout(true);
|
||||
},
|
||||
);
|
||||
|
||||
cy.botSendMessage(bot, roomId, "test");
|
||||
cy.wait(5000);
|
||||
|
||||
Reference in New Issue
Block a user