From d5cd3da6b5b8741cefc201653c4379deb9c4ddf7 Mon Sep 17 00:00:00 2001 From: Sero <69639595+Seroxdesign@users.noreply.github.com> Date: Wed, 3 Jul 2024 06:02:12 -0400 Subject: [PATCH] fix --- wallets/metamask/src/utils/waitFor.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wallets/metamask/src/utils/waitFor.ts b/wallets/metamask/src/utils/waitFor.ts index af31b5282..c5680567e 100644 --- a/wallets/metamask/src/utils/waitFor.ts +++ b/wallets/metamask/src/utils/waitFor.ts @@ -2,6 +2,8 @@ import type { Page } from '@playwright/test' import { errors } from '@playwright/test' import { ErrorSelectors, LoadingSelectors } from '../selectors' +const DEFAULT_TIMEOUT = 2000 + export const waitUntilStable = async (page: Page) => { await page.waitForLoadState('domcontentloaded') await page.waitForLoadState('networkidle') @@ -25,7 +27,7 @@ export const waitForSelector = async (selector: string, page: Page, timeout: num export const waitForMetaMaskLoad = async (page: Page) => { await Promise.all( LoadingSelectors.loadingIndicators.map(async (selector) => { - await waitForSelector(selector, page, 5000) + await waitForSelector(selector, page, DEFAULT_TIMEOUT) }) ) .then(() => { @@ -43,7 +45,7 @@ export const waitForMetaMaskWindowToBeStable = async (page: Page) => { if ((await page.locator(ErrorSelectors.loadingOverlayErrorButtons).count()) > 0) { const retryButton = await page.locator(ErrorSelectors.loadingOverlayErrorButtonsRetryButton) await retryButton.click() - await waitForSelector(LoadingSelectors.loadingOverlay, page, 300) + await waitForSelector(LoadingSelectors.loadingOverlay, page, DEFAULT_TIMEOUT) } await fixCriticalError(page) }