fix tests that were broken by contact-edit page changes

This commit is contained in:
2025-01-05 19:37:49 -07:00
parent 3c1731acdf
commit 0a7645b8e7
4 changed files with 18 additions and 10 deletions

View File

@@ -21,15 +21,15 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
// Combine title prefix with the random string
const finalTitle = standardTitle + finalRandomString;
// Contact name
const contactName = 'Contact #000 renamed';
const userName = 'User #000';
// Import user 01
await importUser(page, '01');
// Add new contact
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, User #000');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, ' + userName);
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"] span:has-text("Contact Added")')).toBeVisible();
await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
@@ -37,15 +37,19 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
// Verify added contact
await expect(page.locator('li.border-b')).toContainText('User #000');
await expect(page.locator('li.border-b')).toContainText(userName);
// Rename contact
await page.locator('li.border-b div div > a[title="See more about this person"]').click();
await page.locator('h2 > button > svg.fa-pen').click();
await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible();
await page.getByPlaceholder('Name', { exact: true }).fill(contactName);
await page.locator('.dialog > .flex > button').first().click();
// await page.locator('.dialog > .flex > button').first().click(); // close alert
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${userName}") + span svg.fa-circle-info`).click();
// now on the DID view page
await page.locator('h2 svg.fa-pen').click();
// now on the contact edit page
await expect(page.getByTestId('contactName').locator('input')).toBeVisible();
// check that the input field has userName
await expect(page.getByTestId('contactName').locator('input')).toHaveValue(userName);
await page.getByTestId('contactName').locator('input').fill(contactName);
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.locator('h2', { hasText: contactName })).toBeVisible();
// Confirm that home shows contact in "Record Something…"
await page.goto('./');