From ca8a4bd134e7825edb1371649bd69a8a8503f837 Mon Sep 17 00:00:00 2001 From: Derek Date: Wed, 27 Mar 2024 19:44:48 +0900 Subject: [PATCH] feat(canary): use playwright for duration calculation (#2075) --- apps/laboratory/tests/canary.spec.ts | 38 ++++++++++++---------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/apps/laboratory/tests/canary.spec.ts b/apps/laboratory/tests/canary.spec.ts index fb13fdcfba..1562e17d8d 100644 --- a/apps/laboratory/tests/canary.spec.ts +++ b/apps/laboratory/tests/canary.spec.ts @@ -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( @@ -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() } )