Browse Source

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)
playwright-test-60-fix
Jose Olarte III 3 days ago
parent
commit
9f976f011a
  1. 7
      test-playwright/60-new-activity.spec.ts
  2. 4
      test-playwright/testUtils.ts

7
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 page.getByPlaceholder('URL or DID, Name, Public Key').fill(autoCreatedDid + ', A Friend');
await expect(page.locator('button > svg.fa-plus')).toBeVisible(); await expect(page.locator('button > svg.fa-plus')).toBeVisible();
await page.locator('button > svg.fa-plus').click(); 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(); // wait for info alert to be visible…
await expect(page.locator('div[role="alert"] h4:has-text("Success")')).toBeVisible(); await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // …and dismiss it
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone 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 // show buttons to make offers directly to people
await page.getByRole('button').filter({ hasText: /See Actions/i }).click(); await page.getByRole('button').filter({ hasText: /See Actions/i }).click();

4
test-playwright/testUtils.ts

@ -158,10 +158,10 @@ export async function generateAndRegisterEthrUser(page: Page): Promise<string> {
.fill(`${newDid}, ${contactName}`); .fill(`${newDid}, ${contactName}`);
await page.locator("button > svg.fa-plus").click(); await page.locator("button > svg.fa-plus").click();
// register them // 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 // wait for it to disappear because the next steps may depend on alerts being gone
await expect( await expect(
page.locator('div[role="alert"] button:has-text("Yes")') page.locator('div[role="alert"] button:text-is("Yes")')
).toBeHidden(); ).toBeHidden();
await expect(page.locator("li", { hasText: contactName })).toBeVisible(); await expect(page.locator("li", { hasText: contactName })).toBeVisible();

Loading…
Cancel
Save