11// Copyright (c) 2025 IOTA Stiftung
22// SPDX-License-Identifier: Apache-2.0
3- import { getNetwork } from '@iota/iota-sdk/client' ;
4- import { requestIotaFromFaucetV0 } from '@iota/iota-sdk/faucet' ;
5- import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519' ;
6- import type { BrowserContext , Page } from '@playwright/test' ;
7-
8- import 'dotenv/config' ;
9-
103import { execFileSync } from 'child_process' ;
114import { IotaNamesTransaction , isSubname , NameRecord } from '@iota/iota-names-sdk' ;
5+ import { getNetwork } from '@iota/iota-sdk/client' ;
126import type { Signer } from '@iota/iota-sdk/cryptography' ;
7+ import { requestIotaFromFaucetV0 } from '@iota/iota-sdk/faucet' ;
8+ import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519' ;
139import { Transaction } from '@iota/iota-sdk/transactions' ;
1410import { NANOS_PER_IOTA } from '@iota/iota-sdk/utils' ;
11+ import type { BrowserContext , Page } from '@playwright/test' ;
1512
1613import { buildCreateAuctionTransaction , buildPlaceBidTransaction } from '@/auctions' ;
1714import { CONFIG } from '@/config' ;
@@ -23,17 +20,27 @@ export async function connectWallet(page: Page, context: BrowserContext, extensi
2320 await page . getByRole ( 'button' , { name : / C o n n e c t / i } ) . click ( ) ;
2421
2522 const pagePromise = context . waitForEvent ( 'page' , { timeout : 20_000 } ) ;
26- const walletButton = page . getByText ( new RegExp ( extensionName , 'i' ) ) ;
27-
28- await walletButton . click ( ) ;
23+ await page . getByText ( extensionName , { exact : true } ) . click ( ) ;
2924 const walletApprovePage = await pagePromise ;
30- if ( walletApprovePage ) {
31- await walletApprovePage . waitForLoadState ( 'domcontentloaded' ) ;
32- await walletApprovePage . bringToFront ( ) ;
33- await walletApprovePage . getByRole ( 'button' , { name : / C o n t i n u e / i } ) . click ( ) ;
34- await walletApprovePage . getByRole ( 'button' , { name : / C o n n e c t / i } ) . click ( ) ;
35- await page . bringToFront ( ) ;
36- }
25+
26+ await walletApprovePage . waitForLoadState ( 'load' ) ;
27+ await walletApprovePage . bringToFront ( ) ;
28+
29+ await walletApprovePage . getByRole ( 'button' , { name : 'Continue' } ) . click ( ) ;
30+
31+ await Promise . race ( [
32+ walletApprovePage
33+ . getByRole ( 'button' , { name : 'Connect' } )
34+ . click ( )
35+ . catch ( ( ) => { } ) ,
36+ walletApprovePage . waitForEvent ( 'close' ) ,
37+ ] ) ;
38+
39+ await page . bringToFront ( ) ;
40+
41+ await expect ( page . getByRole ( 'button' , { name : 'Connect' } ) ) . not . toBeVisible ( {
42+ timeout : 5_000 ,
43+ } ) ;
3744}
3845
3946export async function createWallet ( page : Page ) {
0 commit comments