Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 50ee43c

Browse files
Enable cypress tests for shields with rust crypto (#11589)
* Use new crypto-api for cross user verification * update verification flow with new APIs * Replace some calls to `checkUserTrust` A start on element-hq/crypto-internal#147 * Enable cypress tests * update tests * Delegate decisions on event shields to the js-sdk * rerender after editing events This is required because a transition from "valid event" to "unencrypted event" no longer triggers a state change, so the component does not render itself. Previously, this would be a transition from `verified: E2EState.Normal` to `verified: null`. * Update tests * prettier * Test coverage * Enable cypress tests for shields with rust crypto --------- Co-authored-by: Florian Duros <[email protected]>
1 parent cf2340b commit 50ee43c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cypress/e2e/crypto/crypto.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ describe("Cryptography", function () {
259259
}
260260

261261
it("creating a DM should work, being e2e-encrypted / user verification", function (this: CryptoTestContext) {
262-
skipIfRustCrypto(); // needs working event shields
263262
cy.bootstrapCrossSigning(aliceCredentials);
264263
startDMWithBob.call(this);
265264
// send first message
@@ -325,8 +324,6 @@ describe("Cryptography", function () {
325324
});
326325

327326
it("should show the correct shield on e2e events", function (this: CryptoTestContext) {
328-
skipIfRustCrypto();
329-
330327
// Bob has a second, not cross-signed, device
331328
let bobSecondDevice: MatrixClient;
332329
cy.loginBot(homeserver, bob.getUserId(), bob.__cypress_password, {}).then(async (data) => {
@@ -426,7 +423,7 @@ describe("Cryptography", function () {
426423
});
427424

428425
it("Should show a grey padlock for a key restored from backup", () => {
429-
skipIfRustCrypto();
426+
skipIfRustCrypto(); // requires key backup (https://github.com/vector-im/element-web/issues/24828)
430427

431428
enableKeyBackup();
432429

@@ -460,8 +457,6 @@ describe("Cryptography", function () {
460457
});
461458

462459
it("should show the correct shield on edited e2e events", function (this: CryptoTestContext) {
463-
skipIfRustCrypto();
464-
465460
// bob has a second, not cross-signed, device
466461
cy.loginBot(this.homeserver, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
467462

src/components/views/rooms/EventTile.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,14 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
589589
this.verifyEvent();
590590
};
591591

592-
private async verifyEvent(): Promise<void> {
592+
private verifyEvent(): void {
593+
this.doVerifyEvent().catch((e) => {
594+
const event = this.props.mxEvent;
595+
logger.error("Error getting encryption info on event", e, event);
596+
});
597+
}
598+
599+
private async doVerifyEvent(): Promise<void> {
593600
// if the event was edited, show the verification info for the edit, not
594601
// the original
595602
const mxEvent = this.props.mxEvent.replacingEvent() ?? this.props.mxEvent;

0 commit comments

Comments
 (0)