From a2356f3261b2ea0d929a325b513486d11edc10c6 Mon Sep 17 00:00:00 2001 From: Sero <69639595+Seroxdesign@users.noreply.github.com> Date: Tue, 25 Jun 2024 06:16:55 -0400 Subject: [PATCH] optional tagging setuo --- packages/cache/src/defineWalletSetup.ts | 2 +- packages/core/src/testWithSynpress.ts | 7 +++++-- wallets/metamask/src/fixtures/metaMaskFixtures.ts | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cache/src/defineWalletSetup.ts b/packages/cache/src/defineWalletSetup.ts index e61f717f2..51725bd9d 100644 --- a/packages/cache/src/defineWalletSetup.ts +++ b/packages/cache/src/defineWalletSetup.ts @@ -4,7 +4,7 @@ import { getWalletSetupFuncHash } from './utils/getWalletSetupFuncHash' // TODO: Should we export this type in the `release` package? export type WalletSetupFunction = (context: BrowserContext, walletPage: Page) => Promise -// TODO: This runs at least twice. Should we cache it somehow? +// TODO: Is this still true? -> This runs at least twice. Should we cache it somehow? /** * This function is used to define how a wallet should be set up. * Based on the contents of this function, a browser with the wallet extension is set up and cached so that it can be used by the tests later. diff --git a/packages/core/src/testWithSynpress.ts b/packages/core/src/testWithSynpress.ts index 498a8a58e..43ad7b3ba 100644 --- a/packages/core/src/testWithSynpress.ts +++ b/packages/core/src/testWithSynpress.ts @@ -2,7 +2,10 @@ import type { Fixtures, TestType } from '@playwright/test' import { mergeTests, test as base } from '@playwright/test' export default function testWithSynpress( - customFixtures: TestType + customFixtures: TestType, + useCache?: boolean ) { - return mergeTests(base, customFixtures) + return mergeTests(base, customFixtures, { + useCache: useCache ?? true, + }) } diff --git a/wallets/metamask/src/fixtures/metaMaskFixtures.ts b/wallets/metamask/src/fixtures/metaMaskFixtures.ts index cc2019e4b..704032741 100644 --- a/wallets/metamask/src/fixtures/metaMaskFixtures.ts +++ b/wallets/metamask/src/fixtures/metaMaskFixtures.ts @@ -30,6 +30,7 @@ let _metamaskPage: Page export const metaMaskFixtures = (walletSetup: ReturnType, slowMo = 0) => { return base.extend({ _contextPath: async ({ browserName }, use, testInfo) => { + const contextPath = await createTempContextDir(browserName, testInfo.testId) await use(contextPath)