@@ -282,6 +282,53 @@ module.exports = {
282
282
await switchToCypressIfNotActive ( ) ;
283
283
return walletAddress ;
284
284
} ,
285
+
286
+ /**
287
+ *
288
+ * @param {ChromiumBrowser } playwrightInstance The playwright instance
289
+ * @param {Object } walletState The wallet local storage state of the extension
290
+ * @param {Object } options Options
291
+ * @returns
292
+ */
293
+ async initialSetupFromWalletState (
294
+ playwrightInstance ,
295
+ walletState ,
296
+ { password } ,
297
+ ) {
298
+ await playwright . init ( playwrightInstance ) ;
299
+ await playwright . assignWindows ( PROVIDER ) ;
300
+ await playwright . assignActiveTabName ( PROVIDER ) ;
301
+ await module . exports . getExtensionDetails ( ) ;
302
+ await playwright . fixBlankPage (
303
+ PROVIDER ,
304
+ playwright . windows ( PROVIDER ) ,
305
+ app . root ,
306
+ ) ;
307
+
308
+ await playwright . switchToWindow ( PROVIDER ) ;
309
+
310
+ await playwright . windows ( PROVIDER ) . evaluate ( walletState => {
311
+ // eslint-disable-next-line no-undef
312
+ chrome . storage . local . set ( walletState ) ;
313
+ } , walletState ) ;
314
+
315
+ await playwright
316
+ . windows ( PROVIDER )
317
+ . goto ( playwright . windows ( PROVIDER ) . url ( ) . replace ( 'onboarding' , 'popup' ) ) ;
318
+
319
+ await module . exports . unlock ( password ) ;
320
+ walletAddress = await module . exports . getWalletAddress ( ) ;
321
+
322
+ // interstitials are triggered after locking/unlocking
323
+
324
+ // 1. lock the extension
325
+ await module . exports . lock ( ) ;
326
+
327
+ // 3. unlock the extension
328
+ await module . exports . unlock ( password ) ;
329
+
330
+ return true ;
331
+ } ,
285
332
async initialSetup (
286
333
playwrightInstance ,
287
334
{
@@ -304,12 +351,6 @@ module.exports = {
304
351
305
352
await playwright . switchToWindow ( PROVIDER ) ;
306
353
307
- if ( process . env . DEBUG != null ) {
308
- await playwright
309
- . windows ( PROVIDER )
310
- . on ( 'console' , msg => console . log ( msg . text ( ) ) ) ;
311
- }
312
-
313
354
const isImportButtonVisible = await playwright
314
355
. windows ( PROVIDER )
315
356
. locator ( firstTimeFlowPageElements . importWalletButton )
0 commit comments