From af6d23569a97f2bde3fa47f9ada6b866360275d0 Mon Sep 17 00:00:00 2001 From: Call Delegation <106365423+calldelegation@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:02:01 -0500 Subject: [PATCH] another --- tests/utils/fixtures/index.ts | 5 ++-- .../fixtures/utils/waitForExtenssions.ts | 27 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/utils/fixtures/index.ts b/tests/utils/fixtures/index.ts index 6f3427125..cec9f8184 100644 --- a/tests/utils/fixtures/index.ts +++ b/tests/utils/fixtures/index.ts @@ -4,7 +4,7 @@ import type { BrowserContext } from '@playwright/test'; import { test as base, chromium } from '@playwright/test'; import { getExtensionsData } from './utils/getExtensionsData'; -import { waitForExtensions } from './utils/waitForExtenssions'; +// import { waitForExtensions } from './utils/waitForExtenssions'; import { readFileSync } from 'fs'; import { join } from 'path'; @@ -38,7 +38,8 @@ export const test = base.extend<{ // Ge extenssions data const extensions = await getExtensionsData(context); // Wait for Fuel Wallet to load - await waitForExtensions(context, extensions); + // TODO: reintroduce check + // await waitForExtensions(context, extensions); // Set context to playwright await use(context); }, diff --git a/tests/utils/fixtures/utils/waitForExtenssions.ts b/tests/utils/fixtures/utils/waitForExtenssions.ts index c0798a175..391600d1f 100644 --- a/tests/utils/fixtures/utils/waitForExtenssions.ts +++ b/tests/utils/fixtures/utils/waitForExtenssions.ts @@ -12,21 +12,18 @@ export async function waitForExtensions( >, attempts = 0 ) { - // console.log('Checking extensions...'); - // const pages = context.pages(); - // console.log('PAGES', pages); - // console.log('INCLUDES', extensions['fuel wallet']?.id); - // const hasFuelWallet = pages.find((page) => { - // return page.url().includes(extensions['fuel wallet']?.id); - // }); - // console.log('HELLO', hasFuelWallet); - // if (!hasFuelWallet) { - // if (attempts > 5) { - // throw new Error('Too many attempts to wait for the extensions'); - // } - // await setTimeout(3000); - // return waitForExtensions(context, extensions, attempts + 1); - // } + console.log('Checking extensions...'); + const pages = context.pages(); + const hasFuelWallet = pages.find((page) => { + return page.url().includes(extensions['fuel wallet']?.id); + }); + if (!hasFuelWallet) { + if (attempts > 5) { + throw new Error('Too many attempts to wait for the extensions'); + } + await setTimeout(3000); + return waitForExtensions(context, extensions, attempts + 1); + } console.log('Extensions ready!'); return true; }