@@ -297,9 +297,17 @@ export async function enableKeyBackup(app: ElementAppPage): Promise<string> {
297
297
*
298
298
* Assumes the dialog is already open for some reason (see also {@link enableKeyBackup}).
299
299
*
300
+ * @param page - The playwright `Page` fixture.
301
+ * @param opts - Options object
302
+ * @param opts.accountPassword - The user's account password. If we are also resetting cross-signing, then we will need
303
+ * to upload the public cross-signing keys, which will cause the app to prompt for the password.
304
+ *
300
305
* @returns the new recovery key.
301
306
*/
302
- export async function completeCreateSecretStorageDialog ( page : Page ) : Promise < string > {
307
+ export async function completeCreateSecretStorageDialog (
308
+ page : Page ,
309
+ opts ?: { accountPassword ?: string } ,
310
+ ) : Promise < string > {
303
311
const currentDialogLocator = page . locator ( ".mx_Dialog" ) ;
304
312
305
313
await expect ( currentDialogLocator . getByRole ( "heading" , { name : "Set up Secure Backup" } ) ) . toBeVisible ( ) ;
@@ -311,8 +319,14 @@ export async function completeCreateSecretStorageDialog(page: Page): Promise<str
311
319
const recoveryKey = await page . evaluate ( ( ) => navigator . clipboard . readText ( ) ) ;
312
320
await currentDialogLocator . getByRole ( "button" , { name : "Continue" , exact : true } ) . click ( ) ;
313
321
314
- // If the device is unverified, there should be a "Setting up keys" step; however, it
315
- // can be quite quick, and playwright can miss it, so we can't test for it.
322
+ // If the device is unverified, there should be a "Setting up keys" step.
323
+ // If this is not the first time we are setting up cross-signing, the app will prompt for our password; otherwise
324
+ // the step is quite quick, and playwright can miss it, so we can't test for it.
325
+ if ( Object . hasOwn ( opts , "accountPassword" ) ) {
326
+ await expect ( currentDialogLocator . getByRole ( "heading" , { name : "Setting up keys" } ) ) . toBeVisible ( ) ;
327
+ await page . getByPlaceholder ( "Password" ) . fill ( opts ! . accountPassword ) ;
328
+ await currentDialogLocator . getByRole ( "button" , { name : "Continue" } ) . click ( ) ;
329
+ }
316
330
317
331
// Either way, we end up at a success dialog:
318
332
await expect ( currentDialogLocator . getByRole ( "heading" , { name : "Secure Backup successful" } ) ) . toBeVisible ( ) ;
0 commit comments