diff --git a/packages/e2e/tests/connectButton/universal.e2e.ts b/packages/e2e/tests/connectButton/universal.e2e.ts index e3ced9fe..77c3d56f 100644 --- a/packages/e2e/tests/connectButton/universal.e2e.ts +++ b/packages/e2e/tests/connectButton/universal.e2e.ts @@ -47,11 +47,15 @@ test.describe('Connect Button Hack', () => { } = site; for (const url of testUrls || urls) { testCounter++; - test(`${url} (${sitesConfig.findIndex((e) => e.urls.includes(url))}-${testCounter})`, async ({ page }, testInfo) => { + const index = sitesConfig.findIndex((e) => (e.testUrls || e.urls).includes(url)); + + test(`${url} (${index}-${testCounter})`, async ({ page }, testInfo) => { const { project: { name }, } = testInfo; - const index = sitesConfig.findIndex((e) => e.urls.includes(url)); // @ts-ignore - testInfo['index'] = index; + testInfo['siteIndex'] = index; + // @ts-ignore + testInfo['siteUrl'] = url; + const device = name.includes('Mobile') ? 'mobile' : 'desktop'; if (typeof skip === 'object' && skip !== null && skip[device] === true) { return; @@ -104,18 +108,18 @@ test.describe('Connect Button Hack', () => { } } //@ts-ignore - test.afterEach(async ({ page }, { project: { name }, status, index }) => { + test.afterEach(async ({ page }, { project: { name }, status, siteIndex, siteUrl }) => { const isMobile = name.includes('Mobile'); - const url = page.url() || 'unknown-url'; - let hostname = url; + // const url = page.url() || 'unknown-url'; + let hostname = siteUrl as string; try { - hostname = new URL(url).hostname; + hostname = new URL(siteUrl as string).hostname; } catch (error) { console.error('Failed to parse URL:', error); } // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - const screenshotPath = `test-results/screenshots/connectButton/universal/${status}/${index}-${hostname}-${isMobile ? 'mobile' : 'desktop'}-${status}.png` + const screenshotPath = `test-results/screenshots/connectButton/universal/${status}/${siteIndex}-${hostname}-${isMobile ? 'mobile' : 'desktop'}-${status}.png` await page.screenshot({ path: screenshotPath, diff --git a/packages/providers/inpage-providers-hub/src/connectButtonHack/universal/config.ts b/packages/providers/inpage-providers-hub/src/connectButtonHack/universal/config.ts index 53658c0c..52b1864f 100644 --- a/packages/providers/inpage-providers-hub/src/connectButtonHack/universal/config.ts +++ b/packages/providers/inpage-providers-hub/src/connectButtonHack/universal/config.ts @@ -156,7 +156,8 @@ export type WalletInfo = { skip?: boolean | ((page: Page) => Promise) | { mobile?: boolean; desktop?: boolean }; }; export type SitesInfo = { - urls: string[]; + urls: string[]; // www.ankr.com + testUrls?: string[]; // url for e2e testing, like: www.ankr.com/staking/stake/ walletsForProvider: { [k in IInjectedProviderNames]?: WalletInfo[]; }; @@ -170,7 +171,6 @@ export type SitesInfo = { * path for connect wallet modal used for testing */ testPath?: string[] | { mobile?: string[]; desktop?: string[] } | ((page: Page) => Promise); - testUrls?: string[]; only?: boolean; skip?: boolean | { mobile?: boolean; desktop?: boolean }; };