From 9f976f011a458a30163dd40c3e06a99ed9d484b4 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Tue, 19 Aug 2025 18:43:33 +0800 Subject: [PATCH] Fix: account for new Export Data dialog - Stricter targeting of buttons since Register and Export Data dialogs appear on screen at the same time - Locate success notification first since it appears first (and cannot be "clicked" through the overlapping dialog-overlay) --- test-playwright/60-new-activity.spec.ts | 7 ++++--- test-playwright/testUtils.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test-playwright/60-new-activity.spec.ts b/test-playwright/60-new-activity.spec.ts index 6dcd7640..23171c63 100644 --- a/test-playwright/60-new-activity.spec.ts +++ b/test-playwright/60-new-activity.spec.ts @@ -23,10 +23,11 @@ test('New offers for another user', async ({ page }) => { await page.getByPlaceholder('URL or DID, Name, Public Key').fill(autoCreatedDid + ', A Friend'); await expect(page.locator('button > svg.fa-plus')).toBeVisible(); await page.locator('button > svg.fa-plus').click(); - await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register - await expect(page.locator('div[role="alert"] h4:has-text("Success")')).toBeVisible(); - await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert + await expect(page.locator('div[role="alert"] h4:has-text("Success")')).toBeVisible(); // wait for info alert to be visible… + await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // …and dismiss it await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone + await page.locator('div[role="alert"] button:text-is("No")').click(); // Dismiss register prompt + await page.locator('div[role="alert"] button:text-is("No, Not Now")').click(); // Dismiss export data prompt // show buttons to make offers directly to people await page.getByRole('button').filter({ hasText: /See Actions/i }).click(); diff --git a/test-playwright/testUtils.ts b/test-playwright/testUtils.ts index 71df89f6..c82be500 100644 --- a/test-playwright/testUtils.ts +++ b/test-playwright/testUtils.ts @@ -158,10 +158,10 @@ export async function generateAndRegisterEthrUser(page: Page): Promise { .fill(`${newDid}, ${contactName}`); await page.locator("button > svg.fa-plus").click(); // register them - await page.locator('div[role="alert"] button:has-text("Yes")').click(); + await page.locator('div[role="alert"] button:text-is("Yes")').click(); // wait for it to disappear because the next steps may depend on alerts being gone await expect( - page.locator('div[role="alert"] button:has-text("Yes")') + page.locator('div[role="alert"] button:text-is("Yes")') ).toBeHidden(); await expect(page.locator("li", { hasText: contactName })).toBeVisible();