Cypress: Check that the new verified device is connected to key backup (#11686)

* Check that the new verified device is connected to key backup

* Review changes. Extract key backup verification in its own function and chang parameter order of bot `bootstrapSecretStorage` call.
This commit is contained in:
Florian Duros 2023-10-03 14:44:15 +02:00 committed by GitHub
parent 4fd8ab933a
commit 067e338b4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View file

@ -97,6 +97,19 @@ export function checkDeviceIsCrossSigned(): void {
}); });
} }
/**
* Check that the current device is connected to the key backup.
*/
export function checkDeviceIsConnectedKeyBackup() {
cy.findByRole("button", { name: "User menu" }).click();
cy.get(".mx_UserMenu_contextMenu").within(() => {
cy.findByRole("menuitem", { name: "Security & Privacy" }).click();
});
cy.get(".mx_Dialog").within(() => {
cy.findByRole("button", { name: "Restore from Backup" }).should("exist");
});
}
/** /**
* Fill in the login form in element with the given creds. * Fill in the login form in element with the given creds.
* *

View file

@ -21,7 +21,13 @@ import type { VerificationRequest, Verifier } from "matrix-js-sdk/src/crypto-api
import { CypressBot } from "../../support/bot"; import { CypressBot } from "../../support/bot";
import { HomeserverInstance } from "../../plugins/utils/homeserver"; import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { emitPromise } from "../../support/util"; import { emitPromise } from "../../support/util";
import { checkDeviceIsCrossSigned, doTwoWaySasVerification, logIntoElement, waitForVerificationRequest } from "./utils"; import {
checkDeviceIsConnectedKeyBackup,
checkDeviceIsCrossSigned,
doTwoWaySasVerification,
logIntoElement,
waitForVerificationRequest,
} from "./utils";
import { getToast } from "../../support/toasts"; import { getToast } from "../../support/toasts";
import { UserCredentials } from "../../support/login"; import { UserCredentials } from "../../support/login";
@ -111,6 +117,9 @@ describe("Device verification", () => {
// Check that our device is now cross-signed // Check that our device is now cross-signed
checkDeviceIsCrossSigned(); checkDeviceIsCrossSigned();
// Check that the current device is connected to key backup
checkDeviceIsConnectedKeyBackup();
}); });
it("Verify device during login with QR code", () => { it("Verify device during login with QR code", () => {
@ -148,6 +157,9 @@ describe("Device verification", () => {
// Check that our device is now cross-signed // Check that our device is now cross-signed
checkDeviceIsCrossSigned(); checkDeviceIsCrossSigned();
// Check that the current device is connected to key backup
checkDeviceIsConnectedKeyBackup();
}); });
it("Verify device during login with Security Phrase", () => { it("Verify device during login with Security Phrase", () => {
@ -170,6 +182,9 @@ describe("Device verification", () => {
// Check that our device is now cross-signed // Check that our device is now cross-signed
checkDeviceIsCrossSigned(); checkDeviceIsCrossSigned();
// Check that the current device is connected to key backup
checkDeviceIsConnectedKeyBackup();
}); });
it("Verify device during login with Security Key", () => { it("Verify device during login with Security Key", () => {
@ -193,6 +208,9 @@ describe("Device verification", () => {
// Check that our device is now cross-signed // Check that our device is now cross-signed
checkDeviceIsCrossSigned(); checkDeviceIsCrossSigned();
// Check that the current device is connected to key backup
checkDeviceIsConnectedKeyBackup();
}); });
it("Handle incoming verification request with SAS", () => { it("Handle incoming verification request with SAS", () => {

View file

@ -225,6 +225,7 @@ function setupBotClient(
await cli.getCrypto()!.bootstrapSecretStorage({ await cli.getCrypto()!.bootstrapSecretStorage({
setupNewSecretStorage: true, setupNewSecretStorage: true,
setupNewKeyBackup: true,
createSecretStorageKey: () => Promise.resolve(recoveryKey), createSecretStorageKey: () => Promise.resolve(recoveryKey),
}); });
} }