|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
import { importUser } from './testUtils';
|
|
|
|
|
|
|
|
test('Add contact', async ({ page }) => {
|
|
|
|
// Import user 01
|
|
|
|
await importUser(page, '01');
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
});
|