From 3623643248bd7710c76cb0892ee34ec80e65fa0d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 19 May 2023 14:55:13 +0100 Subject: [PATCH] Cypress: allow enabling Rust Crypto via env var (#10951) * Cypress: allow enabling Rust Crypto via env var * prettify --- cypress/support/config.json.ts | 10 +++++++++- docs/cypress.md | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cypress/support/config.json.ts b/cypress/support/config.json.ts index ca91d9eeef..fd3787939b 100644 --- a/cypress/support/config.json.ts +++ b/cypress/support/config.json.ts @@ -37,5 +37,13 @@ const CONFIG_JSON = { }; beforeEach(() => { - cy.intercept({ method: "GET", pathname: "/config.json" }, { body: CONFIG_JSON }); + const configJson = CONFIG_JSON; + + // configure element to use rust crypto if the env var tells us so + if (Cypress.env("RUST_CRYPTO")) { + configJson["features"] = { + feature_rust_crypto: true, + }; + } + cy.intercept({ method: "GET", pathname: "/config.json" }, { body: configJson }); }); diff --git a/docs/cypress.md b/docs/cypress.md index d140a34d4f..d66c9675cf 100644 --- a/docs/cypress.md +++ b/docs/cypress.md @@ -45,6 +45,16 @@ To launch it: yarn run test:cypress:open ``` +### Running with Rust cryptography + +`matrix-js-sdk` is currently in the +[process](https://github.com/vector-im/element-web/issues/21972) of being +updated to replace its end-to-end encryption implementation to use the [Matrix +Rust SDK](https://github.com/matrix-org/matrix-rust-sdk). This is not currently +enabled by default, but it is possible to have Cypress configure Element to use +the Rust crypto implementation by setting the environment variable +`CYPRESS_RUST_CRYPTO=1`. + ## How the Tests Work Everything Cypress-related lives in the `cypress/` subdirectory of react-sdk