Fix docs and naming of `utils.createBot`

florianduros/encryption-tab
Florian Duros 2025-01-08 10:53:57 +01:00
parent 0b254e51a0
commit 6f236bd325
No known key found for this signature in database
GPG Key ID: A5BBB4041B493F15
2 changed files with 9 additions and 9 deletions

View File

@ -30,7 +30,7 @@ test.describe("Device verification", { tag: "@no-webkit" }, () => {
test.beforeEach(async ({ page, homeserver, credentials }) => {
const res = await createBot(page, homeserver, credentials);
aliceBotClient = res.aliceBotClient;
aliceBotClient = res.botClient;
expectedBackupVersion = res.expectedBackupVersion;
});

View File

@ -24,7 +24,7 @@ import { ElementAppPage } from "../../pages/ElementAppPage";
import { Bot } from "../../pages/bot";
/**
* Create a new device for the Alice user.
* Create a bot client and wait for the key backup to be ready.
* This function will wait for the key backup to be ready.
* @param page - the page to use
* @param homeserver - the homeserver to use
@ -34,21 +34,21 @@ export async function createBot(
page: Page,
homeserver: HomeserverInstance,
credentials: Credentials,
): Promise<{ aliceBotClient: Bot; recoveryKey: GeneratedSecretStorageKey; expectedBackupVersion: string }> {
): Promise<{ botClient: Bot; recoveryKey: GeneratedSecretStorageKey; expectedBackupVersion: string }> {
// Visit the login page of the app, to load the matrix sdk
await page.goto("/#/login");
// wait for the page to load
await page.waitForSelector(".mx_AuthPage", { timeout: 30000 });
// Create a new device for alice
const aliceBotClient = new Bot(page, homeserver, {
// Create a new bot client
const botClient = new Bot(page, homeserver, {
bootstrapCrossSigning: true,
bootstrapSecretStorage: true,
});
aliceBotClient.setCredentials(credentials);
botClient.setCredentials(credentials);
// Backup is prepared in the background. Poll until it is ready.
const botClientHandle = await aliceBotClient.prepareClient();
const botClientHandle = await botClient.prepareClient();
let expectedBackupVersion: string;
await expect
.poll(async () => {
@ -59,9 +59,9 @@ export async function createBot(
})
.not.toBe(null);
const recoveryKey = await aliceBotClient.getRecoveryKey();
const recoveryKey = await botClient.getRecoveryKey();
return { aliceBotClient, recoveryKey, expectedBackupVersion };
return { botClient, recoveryKey, expectedBackupVersion };
}
/**