Skip to content

Commit 2b4000d

Browse files
uhoregflorianduros
andauthored
Add delay in test to allow Alice to fetch Bob's device keys (element-hq#28668)
* add delay in test to allow Alice to fetch Bob's device keys * wait until we see bob's device, rather than hard-coding a timeout * Fix comment Co-authored-by: Florian Duros <[email protected]> * fix lint --------- Co-authored-by: Florian Duros <[email protected]>
1 parent 0130443 commit 2b4000d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

playwright/e2e/crypto/user-verification.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
88

99
import { type Preset, type Visibility } from "matrix-js-sdk/src/matrix";
1010

11+
import type { Page } from "@playwright/test";
1112
import { test, expect } from "../../element-web-test";
1213
import { doTwoWaySasVerification, awaitVerifier } from "./utils";
1314
import { Client } from "../../pages/client";
@@ -38,6 +39,8 @@ test.describe("User verification", () => {
3839
toasts,
3940
room: { roomId: dmRoomId },
4041
}) => {
42+
await waitForDeviceKeys(page);
43+
4144
// once Alice has joined, Bob starts the verification
4245
const bobVerificationRequest = await bob.evaluateHandle(
4346
async (client, { dmRoomId, aliceCredentials }) => {
@@ -87,6 +90,8 @@ test.describe("User verification", () => {
8790
toasts,
8891
room: { roomId: dmRoomId },
8992
}) => {
93+
await waitForDeviceKeys(page);
94+
9095
// once Alice has joined, Bob starts the verification
9196
const bobVerificationRequest = await bob.evaluateHandle(
9297
async (client, { dmRoomId, aliceCredentials }) => {
@@ -149,3 +154,15 @@ async function createDMRoom(client: Client, userId: string): Promise<string> {
149154
],
150155
});
151156
}
157+
158+
/**
159+
* Wait until we get the other user's device keys.
160+
* In newer rust-crypto versions, the verification request will be ignored if we
161+
* don't have the sender's device keys.
162+
*/
163+
async function waitForDeviceKeys(page: Page): Promise<void> {
164+
await expect(page.getByRole("button", { name: "Avatar" })).toBeVisible();
165+
const avatar = await page.getByRole("button", { name: "Avatar" });
166+
await avatar.click();
167+
await expect(page.getByText("1 session")).toBeVisible();
168+
}

0 commit comments

Comments
 (0)