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 https://github.com/vector-im/crypto-internal/issues/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 <florianduros@element.io>pull/28217/head
parent
cf2340bcad
commit
50ee43c4a5
|
@ -259,7 +259,6 @@ 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(); // needs working event shields
|
|
||||||
cy.bootstrapCrossSigning(aliceCredentials);
|
cy.bootstrapCrossSigning(aliceCredentials);
|
||||||
startDMWithBob.call(this);
|
startDMWithBob.call(this);
|
||||||
// send first message
|
// send first message
|
||||||
|
@ -325,8 +324,6 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show the correct shield on e2e events", function (this: CryptoTestContext) {
|
it("should show the correct shield on e2e events", function (this: CryptoTestContext) {
|
||||||
skipIfRustCrypto();
|
|
||||||
|
|
||||||
// Bob has a second, not cross-signed, device
|
// Bob has a second, not cross-signed, device
|
||||||
let bobSecondDevice: MatrixClient;
|
let bobSecondDevice: MatrixClient;
|
||||||
cy.loginBot(homeserver, bob.getUserId(), bob.__cypress_password, {}).then(async (data) => {
|
cy.loginBot(homeserver, bob.getUserId(), bob.__cypress_password, {}).then(async (data) => {
|
||||||
|
@ -426,7 +423,7 @@ describe("Cryptography", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should show a grey padlock for a key restored from backup", () => {
|
it("Should show a grey padlock for a key restored from backup", () => {
|
||||||
skipIfRustCrypto();
|
skipIfRustCrypto(); // requires key backup (https://github.com/vector-im/element-web/issues/24828)
|
||||||
|
|
||||||
enableKeyBackup();
|
enableKeyBackup();
|
||||||
|
|
||||||
|
@ -460,8 +457,6 @@ 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();
|
|
||||||
|
|
||||||
// bob has a second, not cross-signed, device
|
// bob has a second, not cross-signed, device
|
||||||
cy.loginBot(this.homeserver, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
|
cy.loginBot(this.homeserver, this.bob.getUserId(), this.bob.__cypress_password, {}).as("bobSecondDevice");
|
||||||
|
|
||||||
|
|
|
@ -589,7 +589,14 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
||||||
this.verifyEvent();
|
this.verifyEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
private async verifyEvent(): Promise<void> {
|
private verifyEvent(): void {
|
||||||
|
this.doVerifyEvent().catch((e) => {
|
||||||
|
const event = this.props.mxEvent;
|
||||||
|
logger.error("Error getting encryption info on event", e, event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async doVerifyEvent(): Promise<void> {
|
||||||
// if the event was edited, show the verification info for the edit, not
|
// if the event was edited, show the verification info for the edit, not
|
||||||
// the original
|
// the original
|
||||||
const mxEvent = this.props.mxEvent.replacingEvent() ?? this.props.mxEvent;
|
const mxEvent = this.props.mxEvent.replacingEvent() ?? this.props.mxEvent;
|
||||||
|
|
Loading…
Reference in New Issue