From 67afe6a95234e0836aa608451d6733635b1950fe Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 17 Feb 2025 08:46:46 -0700 Subject: [PATCH] wait for some elements before calling 'click' --- test-playwright/40-add-contact.spec.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test-playwright/40-add-contact.spec.ts b/test-playwright/40-add-contact.spec.ts index 56821eca..8d5416a4 100644 --- a/test-playwright/40-add-contact.spec.ts +++ b/test-playwright/40-add-contact.spec.ts @@ -137,8 +137,15 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { // Switch to user 00 await page.goto('./account'); await page.getByRole('heading', { name: 'Advanced' }).click(); - await page.getByRole('link', { name: 'Switch Identifier' }).click(); - await page.getByRole('link', { name: 'Add Another Identity…' }).click(); + + const switchIdentifierLink = page.getByRole('link', { name: 'Switch Identifier' }); + await expect(switchIdentifierLink).toBeVisible(); + await switchIdentifierLink.click(); + + const addAnotherIdentityLink = page.getByRole('link', { name: 'Add Another Identity…' }); + await expect(addAnotherIdentityLink).toBeVisible(); + await addAnotherIdentityLink.click(); + await page.getByText('You have a seed').click(); await page.getByPlaceholder('Seed Phrase').fill('rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage'); await page.getByRole('button', { name: 'Import' }).click(); @@ -147,7 +154,9 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { // Go to home view and look for gift await page.goto('./'); await page.getByTestId('closeOnboardingAndFinish').click(); - await page.locator('li').filter({ hasText: finalTitle }).locator('a').click(); + const giftLink = page.locator('li').filter({ hasText: finalTitle }).locator('a'); + await expect(giftLink).toBeVisible(); + await giftLink.click(); // Confirm gift as user 00 await page.getByTestId('confirmGiftLink').click();