Skip to content

Commit

Permalink
chore: more canary timings
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed May 6, 2024
1 parent 75a897a commit e184c8e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,48 @@ export const testConnectedMW = base.extend<ModalWalletFixture>({
} 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().indexOf('set') > -1 && msg.text().indexOf('core/pairing/pairing') > -1) {
pairingCreatedTime = new Date()
}
if (msg.text().indexOf('resolving attestation') > -1) {
verificationStartedTime = new Date()
}
if (msg.text().indexOf('session_proposal') > -1 && msg.text().indexOf('verifyContext') > -1) {
// 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()
})
} else {
throw new Error('pairingCreatedTime not yet set')
}
await use(walletPage)
}
},
Expand Down

0 comments on commit e184c8e

Please sign in to comment.