|
|
|
|
@@ -69,8 +69,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
|
import { UNNAMED_ENTITY_NAME } from '../src/constants/entities';
|
|
|
|
|
import { deleteContact, generateAndRegisterEthrUser, importUser } from './testUtils';
|
|
|
|
|
import { createContactName, generateNewEthrUser, importUser, importUserFromAccount } from './testUtils';
|
|
|
|
|
import { NOTIFY_CONTACT_INVALID_DID } from '../src/constants/notifications';
|
|
|
|
|
|
|
|
|
|
test('Check activity feed - check that server is running', async ({ page }) => {
|
|
|
|
|
@@ -185,35 +184,20 @@ test('Check invalid DID shows error and redirects', async ({ page }) => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('Check User 0 can register a random person', async ({ page }) => {
|
|
|
|
|
await importUser(page, '00');
|
|
|
|
|
const newDid = await generateAndRegisterEthrUser(page);
|
|
|
|
|
expect(newDid).toContain('did:ethr:');
|
|
|
|
|
const newDid = await generateNewEthrUser(page); // generate a new user
|
|
|
|
|
|
|
|
|
|
await page.goto('./');
|
|
|
|
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
|
|
|
|
await page.getByRole('button', { name: 'Person' }).click();
|
|
|
|
|
await page.getByRole('listitem').filter({ hasText: UNNAMED_ENTITY_NAME }).locator('svg').click();
|
|
|
|
|
await page.getByPlaceholder('What was given').fill('Gave me access!');
|
|
|
|
|
await page.getByRole('button', { name: 'Sign & Send' }).click();
|
|
|
|
|
await expect(page.getByText('That gift was recorded.')).toBeVisible();
|
|
|
|
|
// now ensure that alert goes away
|
|
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
|
|
|
|
|
await expect(page.getByText('That gift was recorded.')).toBeHidden();
|
|
|
|
|
await importUserFromAccount(page, "00"); // switch to User Zero
|
|
|
|
|
|
|
|
|
|
// now delete the contact to test that pages still do reasonable things
|
|
|
|
|
await deleteContact(page, newDid);
|
|
|
|
|
// go the activity page for this new person
|
|
|
|
|
await page.goto('./did/' + encodeURIComponent(newDid));
|
|
|
|
|
// maybe replace by: const popupPromise = page.waitForEvent('popup');
|
|
|
|
|
let error;
|
|
|
|
|
try {
|
|
|
|
|
await page.waitForSelector('div[role="alert"]', { timeout: 2000 });
|
|
|
|
|
error = new Error('Error alert should not show.');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
// success
|
|
|
|
|
} finally {
|
|
|
|
|
if (error) {
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// As User Zero, add the new user as a contact
|
|
|
|
|
await page.goto('./contacts');
|
|
|
|
|
const contactName = createContactName(newDid);
|
|
|
|
|
await page.getByPlaceholder('URL or DID, Name, Public Key').fill(`${newDid}, ${contactName}`);
|
|
|
|
|
await expect(page.locator('button > svg.fa-plus')).toBeVisible();
|
|
|
|
|
await page.locator('button > svg.fa-plus').click();
|
|
|
|
|
await expect(page.locator('div[role="alert"] h4:has-text("Success")')).toBeVisible(); // wait for info alert to be visible…
|
|
|
|
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // …and dismiss it
|
|
|
|
|
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
|
|
|
|
|
await page.locator('div[role="alert"] button:text-is("Yes")').click(); // Register new contact
|
|
|
|
|
await page.locator('div[role="alert"] button:text-is("No, Not Now")').click(); // Dismiss export data prompt
|
|
|
|
|
await expect(page.locator("li", { hasText: contactName })).toBeVisible();
|
|
|
|
|
});
|
|
|
|
|
|