fix test 40 for adding contacts (though clipboard is still broken)

This commit is contained in:
2026-01-01 20:25:40 -07:00
parent f64846ae17
commit 4a3b968ee2
2 changed files with 71 additions and 64 deletions

View File

@@ -92,12 +92,13 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, ' + userName);
await page.locator('button > svg.fa-plus').click();
// Commenting the following lines because user 00 is already registered
// await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible();
// await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await expect(page.locator('div[role="alert"] span:has-text("Success")')).toBeVisible();
await expect(page.getByRole('alert').filter({ hasText: 'Success' })).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible(); // register prompt
await page.getByRole('button', { name: 'No', exact: true }).click(); // don't register
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
await expect(page.getByRole('button', { name: 'No, Not Yet', exact: true })).toBeVisible(); // backup prompt
await page.getByRole('button', { name: 'No, Not Yet', exact: true }).click(); // don't backup contacts
// Verify added contact
await expect(page.locator('li.border-b')).toContainText(userName);
@@ -118,10 +119,10 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.getByRole('button', { name: 'Thank' }).click();
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName })).toBeVisible();
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName }).first()).toBeVisible();
// Record something given by new contact
await page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName }).click();
await page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName }).first().click();
await page.getByPlaceholder('What was given').fill(finalTitle);
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
await page.getByRole('button', { name: 'Sign & Send' }).click();
@@ -156,7 +157,7 @@ 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.getByTestId('closeOnboardingAndFinish').click();
const giftLink = page.locator('li:first-child').filter({ hasText: finalTitle }).locator('[data-testid="circle-info-link"]');
await expect(giftLink).toBeVisible();
await giftLink.click();
@@ -179,11 +180,13 @@ test('Without being registered, add contacts without registration', async ({ pag
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, User #111');
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"] span:has-text("Success")')).toBeVisible();
await expect(page.getByRole('alert').filter({ hasText: 'Success' })).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
// wait for the alert to disappear, which also ensures that there is no "Register" button waiting
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.getByRole('button', { name: 'No, Not Yet', exact: true })).toBeVisible(); // backup prompt
await page.getByRole('button', { name: 'No, Not Yet', exact: true }).click(); // don't backup contacts
await expect(page.getByRole('button', { name: 'No, Not Yet', exact: true })).toBeHidden();
// wait for all alerts to disappear
await expect(page.locator('div[role="alert"]')).toHaveCount(0);
});
test('Add contact, copy details, delete, and import from paste & from file', async ({ page, context }) => {
@@ -193,22 +196,26 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, User #111');
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"]')).toBeVisible();
await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible();
await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await expect(page.locator('div[role="alert"] span:has-text("Success")')).toBeVisible();
await expect(page.locator('div[role="alert"]').first()).toBeVisible();
await expect(page.getByRole('alert').filter({ hasText: 'Success' })).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.getByRole('button', { name: 'No', exact: true })).toBeVisible();
await page.getByRole('button', { name: 'No', exact: true }).click(); // don't register
await expect(page.getByRole('button', { name: 'No, Not Yet', exact: true })).toBeVisible(); // backup prompt
await page.getByRole('button', { name: 'No, Not Yet', exact: true }).click(); // don't backup contacts
// wait for the alert to disappear
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.locator('div[role="alert"]')).toHaveCount(0);
// Add another new contact
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x222BB77E6Ff3774d34c751f3c1260866357B677b, User #222, asdf1234');
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible();
await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await expect(page.locator('div[role="alert"] span:has-text("Success")')).toBeVisible();
await expect(page.getByRole('alert').filter({ hasText: 'Success' })).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.getByRole('button', { name: 'No', exact: true })).toBeVisible();
await page.getByRole('button', { name: 'No', exact: true }).click(); // don't register
await expect(page.getByRole('button', { name: 'No, Not Yet', exact: true })).toBeVisible(); // backup prompt
await page.getByRole('button', { name: 'No, Not Yet', exact: true }).click(); // don't backup contacts
await expect(page.locator('div[role="alert"]')).toHaveCount(0);
await expect(page.getByTestId('contactListItem')).toHaveCount(2);