Skip to content

Commit

Permalink
another
Browse files Browse the repository at this point in the history
  • Loading branch information
calldelegation committed Dec 27, 2024
1 parent 1436334 commit af6d235
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
5 changes: 3 additions & 2 deletions tests/utils/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
},
Expand Down
27 changes: 12 additions & 15 deletions tests/utils/fixtures/utils/waitForExtenssions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit af6d235

Please sign in to comment.