mirror of https://github.com/vector-im/riot-web
Deflake verification playwright tests (#12669)
Turns out the sleep that got removed in https://github.com/matrix-org/matrix-react-sdk/pull/12667 was useful.t3chguy/dedup-icons-17oct
parent
5eb5ea81d5
commit
736b083a79
|
@ -113,6 +113,13 @@ export async function checkDeviceIsConnectedKeyBackup(
|
||||||
expectedBackupVersion: string,
|
expectedBackupVersion: string,
|
||||||
checkBackupKeyInCache: boolean,
|
checkBackupKeyInCache: boolean,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
// Sanity check the given backup version: if it's null, something went wrong earlier in the test.
|
||||||
|
if (!expectedBackupVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Invalid backup version passed to \`checkDeviceIsConnectedKeyBackup\`: ${expectedBackupVersion}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await page.getByRole("button", { name: "User menu" }).click();
|
await page.getByRole("button", { name: "User menu" }).click();
|
||||||
await page.locator(".mx_UserMenu_contextMenu").getByRole("menuitem", { name: "Security & Privacy" }).click();
|
await page.locator(".mx_UserMenu_contextMenu").getByRole("menuitem", { name: "Security & Privacy" }).click();
|
||||||
await expect(page.locator(".mx_Dialog").getByRole("button", { name: "Restore from Backup" })).toBeVisible();
|
await expect(page.locator(".mx_Dialog").getByRole("button", { name: "Restore from Backup" })).toBeVisible();
|
||||||
|
|
|
@ -50,11 +50,17 @@ test.describe("Device verification", () => {
|
||||||
bootstrapSecretStorage: true,
|
bootstrapSecretStorage: true,
|
||||||
});
|
});
|
||||||
aliceBotClient.setCredentials(credentials);
|
aliceBotClient.setCredentials(credentials);
|
||||||
const mxClientHandle = await aliceBotClient.prepareClient();
|
|
||||||
|
|
||||||
expectedBackupVersion = await mxClientHandle.evaluate(async (mxClient) => {
|
// Backup is prepared in the background. Poll until it is ready.
|
||||||
return await mxClient.getCrypto()!.getActiveSessionBackupVersion();
|
const botClientHandle = await aliceBotClient.prepareClient();
|
||||||
});
|
await expect
|
||||||
|
.poll(async () => {
|
||||||
|
expectedBackupVersion = await botClientHandle.evaluate((cli) =>
|
||||||
|
cli.getCrypto()!.getActiveSessionBackupVersion(),
|
||||||
|
);
|
||||||
|
return expectedBackupVersion;
|
||||||
|
})
|
||||||
|
.not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click the "Verify with another device" button, and have the bot client auto-accept it.
|
// Click the "Verify with another device" button, and have the bot client auto-accept it.
|
||||||
|
|
Loading…
Reference in New Issue