diff --git a/test-playwright/40-add-contact.spec.ts b/test-playwright/40-add-contact.spec.ts index 691ea7f2..c0142c0b 100644 --- a/test-playwright/40-add-contact.spec.ts +++ b/test-playwright/40-add-contact.spec.ts @@ -130,11 +130,13 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { // Refresh home view and check gift await page.goto('./'); + // Wait for async data (e.g. "new offers" banner) to finish loading so the layout + // is stable before clicking — otherwise a layout shift can redirect the click. + await page.waitForLoadState('networkidle'); - // Firefox complains on load the initial feed here when we use the test server. - // It may be similar to the CORS problem below. - const item = await page.locator('li:first-child').filter({ hasText: finalTitle }); - await item.locator('[data-testid="circle-info-link"]').click(); + const item = page.locator('li').filter({ hasText: finalTitle }).locator('[data-testid="circle-info-link"]'); + await expect(item).toBeVisible(); + await item.click(); await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible(); await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();