Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign committed Jul 3, 2024
1 parent 01688a9 commit d5cd3da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wallets/metamask/src/utils/waitFor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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(() => {
Expand All @@ -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)
}
Expand Down

0 comments on commit d5cd3da

Please sign in to comment.