You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.8 KiB
37 lines
1.8 KiB
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 feed shows contact
|
|
await page.goto('./');
|
|
await expect(page.locator('li').filter({ hasText: 'Contact 00 gave to' }).nth(0)).toBeVisible();
|
|
await expect(page.locator('li').filter({ hasText: 'Contact 00 received' }).nth(0)).toBeVisible();
|
|
});
|