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.
This commit is contained in:
parent
5eb5ea81d5
commit
736b083a79
2 changed files with 17 additions and 4 deletions
|
@ -113,6 +113,13 @@ export async function checkDeviceIsConnectedKeyBackup(
|
|||
expectedBackupVersion: string,
|
||||
checkBackupKeyInCache: boolean,
|
||||
): 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.locator(".mx_UserMenu_contextMenu").getByRole("menuitem", { name: "Security & Privacy" }).click();
|
||||
await expect(page.locator(".mx_Dialog").getByRole("button", { name: "Restore from Backup" })).toBeVisible();
|
||||
|
|
|
@ -50,11 +50,17 @@ test.describe("Device verification", () => {
|
|||
bootstrapSecretStorage: true,
|
||||
});
|
||||
aliceBotClient.setCredentials(credentials);
|
||||
const mxClientHandle = await aliceBotClient.prepareClient();
|
||||
|
||||
expectedBackupVersion = await mxClientHandle.evaluate(async (mxClient) => {
|
||||
return await mxClient.getCrypto()!.getActiveSessionBackupVersion();
|
||||
});
|
||||
// Backup is prepared in the background. Poll until it is ready.
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue