Skip to content

Commit

Permalink
feat(canary): use playwright for duration calculation (#2075)
Browse files Browse the repository at this point in the history
  • Loading branch information
arein committed Mar 27, 2024
1 parent c2007db commit ca8a4bd
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions apps/laboratory/tests/canary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ import { expectConnection } from './shared/utils/validation'
const ENV = process.env['ENVIRONMENT'] || 'dev'
const REGION = process.env['REGION'] || 'eu-central-1'

let startTime = 0

testConnectedMW.beforeEach(async ({ modalValidator, walletValidator }) => {
// Give us extra time in a potentially slow canary deployment
testConnectedMW.setTimeout(120_000)

startTime = Date.now()
await expectConnection(modalValidator, walletValidator)
})

testConnectedMW.afterEach(async ({ modalPage, modalValidator, walletValidator, browserName }) => {
testConnectedMW.afterEach(async ({ browserName }, testInfo) => {
if (browserName === 'firefox') {
return
}
await modalPage.disconnect()
await modalValidator.expectDisconnected()
await walletValidator.expectDisconnected()

if (ENV !== 'dev') {
const duration: number = testInfo.duration
await uploadCanaryResultsToCloudWatch(
ENV,
REGION,
'https://lab.web3modal.com/',
'HappyPath.sign',
true,
duration
)
}
})

testConnectedMW(
Expand All @@ -31,17 +34,8 @@ testConnectedMW(
await walletValidator.expectReceivedSign({})
await walletPage.handleRequest({ accept: true })
await modalValidator.expectAcceptedSign()

if (ENV !== 'dev') {
const duration: number = Date.now() - startTime
await uploadCanaryResultsToCloudWatch(
ENV,
REGION,
'https://lab.web3modal.com/',
'HappyPath.sign',
true,
duration
)
}
await modalPage.disconnect()
await modalValidator.expectDisconnected()
await walletValidator.expectDisconnected()
}
)

0 comments on commit ca8a4bd

Please sign in to comment.