import { test, expect } from '@playwright/test'; test('Add contact', async ({ page }) => { // Create new ID using seed phrase "island fever beef…" await page.goto('./start'); await page.getByText('You have a seed').click(); await page.getByPlaceholder('Seed Phrase').fill('island fever beef wine urban aim vacant quit afford total poem flame service calm better adult neither color gaze forum month sister imitate excite'); await page.getByRole('button', { name: 'Import' }).click(); // Set name await page.getByRole('link', { name: 'Set Your Name' }).click(); await page.getByPlaceholder('Name').fill('User One'); await page.getByRole('button', { name: 'Save Changes' }).click(); // Add new contact 00 await page.goto('./contacts'); await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); await page.locator('button > svg.fa-plus').click(); await expect(page.locator('div[role="alert"]')).toBeVisible(); // Why doesn't the alert box come up every time? // await page.locator('div[role="alert"] button:has-text("Yes")').click(); // Verify added contact await expect(page.locator('li.border-b')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); // Rename contact await page.locator('li.border-b h2 > button[title="Edit"]').click(); await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible(); await page.getByPlaceholder('Name', { exact: true }).fill('Contact 00'); await page.locator('.dialog > .flex > button').first().click(); // Confirm that home shows contact in "Record Something…" and "Latest Activity" await page.goto('./'); await expect(page.locator('#sectionRecordSomethingGiven ul li').filter({ hasText: 'Contact 00' }).nth(0)).toBeVisible(); await expect(page.locator('ul#listLatestActivity li').filter({ hasText: 'Contact 00 received' }).nth(0)).toBeVisible(); });