|
|
@ -21,26 +21,25 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { |
|
|
|
const finalTitle = standardTitle + finalRandomString; |
|
|
|
|
|
|
|
// Contact name
|
|
|
|
const contactName = 'Contact #000'; |
|
|
|
const contactName = 'Contact #111'; |
|
|
|
|
|
|
|
// Import user 01
|
|
|
|
await importUser(page, '01'); |
|
|
|
|
|
|
|
// Add new contact 00
|
|
|
|
// Add new contact
|
|
|
|
await page.goto('./contacts'); |
|
|
|
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, User #000'); |
|
|
|
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();
|
|
|
|
await page.locator('div[role="alert"] button:has-text("Yes")').click(); |
|
|
|
|
|
|
|
// Verify added contact
|
|
|
|
await expect(page.locator('li.border-b')).toContainText('User #000'); |
|
|
|
|
|
|
|
// Rename contact
|
|
|
|
await page.locator('li.border-b div div > a[title="See more about this person"]').click(); |
|
|
|
await page.locator('h2 > button[title="Edit"]').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(); |
|
|
@ -76,11 +75,73 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { |
|
|
|
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click(); |
|
|
|
|
|
|
|
// Confirm gift as user 00
|
|
|
|
await page.getByTestId('confirmGiftLink').click(); |
|
|
|
await page.getByRole('button', { name: 'Confirm' }).click(); |
|
|
|
await page.getByRole('button', { name: 'Yes' }).click(); |
|
|
|
await expect(page.getByText('Confirmation submitted.')).toBeVisible(); |
|
|
|
|
|
|
|
// Refresh claim page, Confirm button should be hidden
|
|
|
|
// Refresh claim page, Confirm button should throw an alert because they already confirmed
|
|
|
|
await page.reload(); |
|
|
|
await expect(page.getByRole('button', { name: 'Confirm' })).toBeHidden(); |
|
|
|
await page.getByRole('button', { name: 'Confirm' }).click(); |
|
|
|
await expect(page.locator('div[role="alert"]')).toBeVisible(); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Add contact, copy details, delete, and import various ways', async ({ page, context }) => { |
|
|
|
await importUser(page, '00'); |
|
|
|
|
|
|
|
// Add new contact
|
|
|
|
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 page.locator('div[role="alert"] button:has-text("No")').click(); |
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); |
|
|
|
// wait for the alert to disappear
|
|
|
|
await expect(page.locator('div[role="alert"]')).toBeHidden(); |
|
|
|
|
|
|
|
// 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"]')).toBeVisible(); |
|
|
|
await page.locator('div[role="alert"] button:has-text("No")').click(); |
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); |
|
|
|
await expect(page.locator('div[role="alert"]')).toBeHidden(); |
|
|
|
|
|
|
|
await expect(page.getByTestId('contactListItem')).toHaveCount(2); |
|
|
|
|
|
|
|
//// Copy contact details, export them, remove them, and paste to add them
|
|
|
|
|
|
|
|
// Copy contact details
|
|
|
|
await page.getByTestId('contactCheckAllTop').click(); |
|
|
|
await page.getByTestId('copySelectedContactsButtonTop').click(); |
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
|
|
|
|
// I would prefer to copy from the clipboard, but the recommended approaches don't work.
|
|
|
|
// this seems to fail in non-chromium browsers
|
|
|
|
//await context.grantPermissions(['clipboard-read', 'clipboard-write']);
|
|
|
|
// this seems to fail in chromium (at least) where clipboard is undefined
|
|
|
|
//const contactData = await navigator.clipboard.readText();
|
|
|
|
|
|
|
|
// see contact details on the second contact
|
|
|
|
await page.getByTestId('contactListItem').nth(1).locator('a').click(); |
|
|
|
// remove contact
|
|
|
|
await page.locator('button > svg.fa-trash-can').click(); |
|
|
|
await page.locator('div[role="alert"] button:has-text("Yes")').click(); |
|
|
|
// for some reason, .isHidden() (without expect) doesn't work
|
|
|
|
await expect(page.locator('div[role="alert"] button:has-text("Yes")')).toBeHidden(); |
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
|
|
|
|
|
|
|
|
// go to the contacts page and paste the copied contact details
|
|
|
|
await page.goto('./contacts'); |
|
|
|
// check that there are fewer contacts
|
|
|
|
await expect(page.getByTestId('contactListItem')).toHaveCount(1); |
|
|
|
|
|
|
|
const contactData = 'Paste this: [{ "did": "did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39", "name": "User #111" }, { "did": "did:ethr:0x222BB77E6Ff3774d34c751f3c1260866357B677b", "name": "User #222", "publicKeyBase64": "asdf1234"}] ' |
|
|
|
await page.getByPlaceholder('URL or DID, Name, Public Key').fill(contactData); |
|
|
|
await page.locator('button > svg.fa-plus').click(); |
|
|
|
// we're on the contact-import page
|
|
|
|
await expect(page.locator('li', { hasText: 'New' })).toHaveCount(1); |
|
|
|
await expect(page.locator('span').filter({ hasText: 'the same as' })).toBeVisible(); |
|
|
|
await page.locator('button', { hasText: 'Import' }).click(); |
|
|
|
// check that there are more contacts
|
|
|
|
await expect(page.getByTestId('contactListItem')).toHaveCount(2); |
|
|
|
}); |
|
|
|