diff --git a/playwright/e2e/crypto/event-shields.spec.ts b/playwright/e2e/crypto/event-shields.spec.ts index 98142089fb..fa9d1959da 100644 --- a/playwright/e2e/crypto/event-shields.spec.ts +++ b/playwright/e2e/crypto/event-shields.spec.ts @@ -6,12 +6,16 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only Please see LICENSE files in the repository root for full details. */ -import { Page } from "@playwright/test"; - import { expect, test } from "../../element-web-test"; -import { autoJoin, createSharedRoomWithUser, enableKeyBackup, logIntoElement, logOutOfElement, verify } from "./utils"; -import { Bot } from "../../pages/bot"; -import { HomeserverInstance } from "../../plugins/homeserver"; +import { + autoJoin, + createSecondBotDevice, + createSharedRoomWithUser, + enableKeyBackup, + logIntoElement, + logOutOfElement, + verify, +} from "./utils"; test.describe("Cryptography", function () { test.use({ @@ -296,13 +300,3 @@ test.describe("Cryptography", function () { }); }); }); - -async function createSecondBotDevice(page: Page, homeserver: HomeserverInstance, bob: Bot) { - const bobSecondDevice = new Bot(page, homeserver, { - bootstrapSecretStorage: false, - bootstrapCrossSigning: false, - }); - bobSecondDevice.setCredentials(await homeserver.loginUser(bob.credentials.userId, bob.credentials.password)); - await bobSecondDevice.prepareClient(); - return bobSecondDevice; -} diff --git a/playwright/e2e/crypto/utils.ts b/playwright/e2e/crypto/utils.ts index a4d9769eb9..c198633733 100644 --- a/playwright/e2e/crypto/utils.ts +++ b/playwright/e2e/crypto/utils.ts @@ -377,3 +377,14 @@ export async function awaitVerifier( return verificationRequest.verifier; }); } + +/** Log in a second device for the given bot user */ +export async function createSecondBotDevice(page: Page, homeserver: HomeserverInstance, bob: Bot) { + const bobSecondDevice = new Bot(page, homeserver, { + bootstrapSecretStorage: false, + bootstrapCrossSigning: false, + }); + bobSecondDevice.setCredentials(await homeserver.loginUser(bob.credentials.userId, bob.credentials.password)); + await bobSecondDevice.prepareClient(); + return bobSecondDevice; +}