mirror of
https://github.com/element-hq/element-web
synced 2024-11-29 12:58:53 +03:00
Cypress: skip tests known to fail when using Rust crypto (#10873)
* Cypress: skip tests known to fail when using Rust crypto ... which means we can then run the cypress test suite against Element Web R to check we aren't introducing regressions. * Update cypress/e2e/register/register.spec.ts * Use env var to detect rust crypto * Hoist `skipIfRustCrypto` call earlier
This commit is contained in:
parent
0c30f0c838
commit
2571f54e8b
5 changed files with 30 additions and 3 deletions
|
@ -18,6 +18,7 @@ import type { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/
|
||||||
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
||||||
import { handleVerificationRequest, waitForVerificationRequest } from "./utils";
|
import { handleVerificationRequest, waitForVerificationRequest } from "./utils";
|
||||||
import { CypressBot } from "../../support/bot";
|
import { CypressBot } from "../../support/bot";
|
||||||
|
import { skipIfRustCrypto } from "../../support/util";
|
||||||
|
|
||||||
describe("Complete security", () => {
|
describe("Complete security", () => {
|
||||||
let homeserver: HomeserverInstance;
|
let homeserver: HomeserverInstance;
|
||||||
|
@ -46,6 +47,8 @@ describe("Complete security", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should walk through device verification if we have a signed device", () => {
|
it("should walk through device verification if we have a signed device", () => {
|
||||||
|
skipIfRustCrypto();
|
||||||
|
|
||||||
// create a new user, and have it bootstrap cross-signing
|
// create a new user, and have it bootstrap cross-signing
|
||||||
let botClient: CypressBot;
|
let botClient: CypressBot;
|
||||||
cy.getBot(homeserver, { displayName: "Jeff" })
|
cy.getBot(homeserver, { displayName: "Jeff" })
|
||||||
|
|
|
@ -20,6 +20,7 @@ import type { CypressBot } from "../../support/bot";
|
||||||
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
||||||
import { UserCredentials } from "../../support/login";
|
import { UserCredentials } from "../../support/login";
|
||||||
import { EmojiMapping, handleVerificationRequest, waitForVerificationRequest } from "./utils";
|
import { EmojiMapping, handleVerificationRequest, waitForVerificationRequest } from "./utils";
|
||||||
|
import { skipIfRustCrypto } from "../../support/util";
|
||||||
|
|
||||||
interface CryptoTestContext extends Mocha.Context {
|
interface CryptoTestContext extends Mocha.Context {
|
||||||
homeserver: HomeserverInstance;
|
homeserver: HomeserverInstance;
|
||||||
|
@ -152,6 +153,7 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("setting up secure key backup should work", () => {
|
it("setting up secure key backup should work", () => {
|
||||||
|
skipIfRustCrypto();
|
||||||
cy.openUserSettings("Security & Privacy");
|
cy.openUserSettings("Security & Privacy");
|
||||||
cy.findByRole("button", { name: "Set up Secure Backup" }).click();
|
cy.findByRole("button", { name: "Set up Secure Backup" }).click();
|
||||||
cy.get(".mx_Dialog").within(() => {
|
cy.get(".mx_Dialog").within(() => {
|
||||||
|
@ -175,6 +177,7 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("creating a DM should work, being e2e-encrypted / user verification", function (this: CryptoTestContext) {
|
it("creating a DM should work, being e2e-encrypted / user verification", function (this: CryptoTestContext) {
|
||||||
|
skipIfRustCrypto();
|
||||||
cy.bootstrapCrossSigning(aliceCredentials);
|
cy.bootstrapCrossSigning(aliceCredentials);
|
||||||
startDMWithBob.call(this);
|
startDMWithBob.call(this);
|
||||||
// send first message
|
// send first message
|
||||||
|
@ -196,6 +199,7 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should allow verification when there is no existing DM", function (this: CryptoTestContext) {
|
it("should allow verification when there is no existing DM", function (this: CryptoTestContext) {
|
||||||
|
skipIfRustCrypto();
|
||||||
cy.bootstrapCrossSigning(aliceCredentials);
|
cy.bootstrapCrossSigning(aliceCredentials);
|
||||||
autoJoin(this.bob);
|
autoJoin(this.bob);
|
||||||
|
|
||||||
|
@ -214,6 +218,7 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show the correct shield on edited e2e events", function (this: CryptoTestContext) {
|
it("should show the correct shield on edited e2e events", function (this: CryptoTestContext) {
|
||||||
|
skipIfRustCrypto();
|
||||||
cy.bootstrapCrossSigning(aliceCredentials);
|
cy.bootstrapCrossSigning(aliceCredentials);
|
||||||
|
|
||||||
// bob has a second, not cross-signed, device
|
// bob has a second, not cross-signed, device
|
||||||
|
|
|
@ -19,6 +19,7 @@ import type { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||||
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
import { HomeserverInstance } from "../../plugins/utils/homeserver";
|
||||||
import { UserCredentials } from "../../support/login";
|
import { UserCredentials } from "../../support/login";
|
||||||
import { handleVerificationRequest } from "./utils";
|
import { handleVerificationRequest } from "./utils";
|
||||||
|
import { skipIfRustCrypto } from "../../support/util";
|
||||||
|
|
||||||
const ROOM_NAME = "Test room";
|
const ROOM_NAME = "Test room";
|
||||||
const TEST_USER = "Alia";
|
const TEST_USER = "Alia";
|
||||||
|
@ -67,6 +68,7 @@ describe("Decryption Failure Bar", () => {
|
||||||
let roomId: string;
|
let roomId: string;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
skipIfRustCrypto();
|
||||||
cy.startHomeserver("default").then((hs: HomeserverInstance) => {
|
cy.startHomeserver("default").then((hs: HomeserverInstance) => {
|
||||||
homeserver = hs;
|
homeserver = hs;
|
||||||
cy.initTestUser(homeserver, TEST_USER)
|
cy.initTestUser(homeserver, TEST_USER)
|
||||||
|
|
|
@ -20,6 +20,8 @@ limitations under the License.
|
||||||
* we make requests to the live `matrix.org`, which makes our tests dependent on matrix.org being up and responsive.
|
* we make requests to the live `matrix.org`, which makes our tests dependent on matrix.org being up and responsive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { isRustCryptoEnabled } from "./util";
|
||||||
|
|
||||||
const CONFIG_JSON = {
|
const CONFIG_JSON = {
|
||||||
// This is deliberately quite a minimal config.json, so that we can test that the default settings
|
// This is deliberately quite a minimal config.json, so that we can test that the default settings
|
||||||
// actually work.
|
// actually work.
|
||||||
|
@ -40,7 +42,7 @@ beforeEach(() => {
|
||||||
const configJson = CONFIG_JSON;
|
const configJson = CONFIG_JSON;
|
||||||
|
|
||||||
// configure element to use rust crypto if the env var tells us so
|
// configure element to use rust crypto if the env var tells us so
|
||||||
if (Cypress.env("RUST_CRYPTO")) {
|
if (isRustCryptoEnabled()) {
|
||||||
configJson["features"] = {
|
configJson["features"] = {
|
||||||
feature_rust_crypto: true,
|
feature_rust_crypto: true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,5 +56,20 @@ cy.all = function all(commands): Cypress.Chainable {
|
||||||
return cy.wrap(resultArray, { log: false });
|
return cy.wrap(resultArray, { log: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
// Needed to make this file a module
|
/**
|
||||||
export {};
|
* Check if Cypress has been configured to enable rust crypto, and bail out if so.
|
||||||
|
*/
|
||||||
|
export function skipIfRustCrypto() {
|
||||||
|
if (isRustCryptoEnabled()) {
|
||||||
|
cy.log("Skipping due to rust crypto");
|
||||||
|
//@ts-ignore: 'state' is a secret internal command
|
||||||
|
cy.state("runnable").skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if Cypress has been configured to enable rust crypto (by checking the environment variable)
|
||||||
|
*/
|
||||||
|
export function isRustCryptoEnabled(): boolean {
|
||||||
|
return !!Cypress.env("RUST_CRYPTO");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue