diff --git a/apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts b/apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts index 50910ba33f..3f8c06c105 100644 --- a/apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts +++ b/apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts @@ -50,13 +50,46 @@ export const testConnectedMW = base.extend({ } else { timeStart('doActionAndWaitForNewPage') const page = await doActionAndWaitForNewPage(modalPage.clickWalletDeeplink(), context) + let pairingCreatedTime: Date | null = null + let verificationStartedTime: Date | null = null + page.on('console', msg => { + if (msg.text().includes('set') && msg.text().includes('core/pairing/pairing')) { + pairingCreatedTime = new Date() + } + if (msg.text().includes('resolving attestation')) { + verificationStartedTime = new Date() + } + if (msg.text().includes('session_proposal') && msg.text().includes('verifyContext')) { + // For some reason this log is emitted twice; so only recording the time once + if (verificationStartedTime) { + const verificationEndedTime = new Date() + timingRecords.push({ + item: 'sessionProposalVerification', + timeMs: verificationEndedTime.getTime() - verificationStartedTime.getTime() + }) + verificationStartedTime = null + } + } + }) timeEnd('doActionAndWaitForNewPage') + const connectionInitiated = new Date() timeStart('new WalletPage') const walletPage = new WalletPage(page) timeEnd('new WalletPage') timeStart('walletPage.handleSessionProposal') await walletPage.handleSessionProposal(DEFAULT_SESSION_PARAMS) timeEnd('walletPage.handleSessionProposal') + const proposalReceived = new Date() + timingRecords.push({ + item: 'deeplinkReceiveSessionProposal', + timeMs: proposalReceived.getTime() - connectionInitiated.getTime() + }) + if (pairingCreatedTime) { + timingRecords.push({ + item: 'pairingReceiveSessionProposal', + timeMs: proposalReceived.getTime() - (pairingCreatedTime as Date).getTime() + }) + } await use(walletPage) } },