modify the settings to allow account-specific settings, eg. for "isRegistered"

This commit is contained in:
2024-09-15 16:30:46 -06:00
parent fe627ed6b2
commit 8111b0e5cf
44 changed files with 452 additions and 340 deletions

View File

@@ -37,6 +37,17 @@ test('Check no-ID messaging in account', async ({ page }) => {
await expect(page.locator('#sectionIdentityDetails code.truncate')).toBeEmpty();
});
test('Check ability to share contact', async ({ page }) => {
// Load Discover view
await page.goto('./discover');
// Check that initial 10 projects have been loaded
await page.locator('ul#listDiscoverResults li.border-b:nth-child(10)');
// Scroll down a bit to trigger loading additional projects
await page.locator('ul#listDiscoverResults li.border-b:nth-child(20)').scrollIntoViewIfNeeded();
});
test('Check ID generation', async ({ page }) => {
// Load Account view
await page.goto('./account');
@@ -83,7 +94,7 @@ test('Check setting name & sharing info', async ({ page }) => {
await expect(page.getByText('your contacts')).toBeVisible();
});
test('Confirm usage of test API (may fail if you are running your own Time Safari)', async ({ page }, testInfo) => {
test('Confirm test API setting (may fail if you are running your own Time Safari)', async ({ page }, testInfo) => {
// Load account view
await page.goto('./account');
await page.getByRole('heading', { name: 'Advanced' }).click();

View File

@@ -22,7 +22,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
const finalTitle = standardTitle + finalRandomString;
// Contact name
const contactName = 'Contact #111';
const contactName = 'Contact #000 renamed';
// Import user 01
await importUser(page, '01');
@@ -45,6 +45,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
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();
// await page.locator('.dialog > .flex > button').first().click(); // close alert
// Confirm that home shows contact in "Record Something…"
await page.goto('./');
@@ -59,6 +60,9 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
// Refresh home view and check gift
await page.goto('./');
// Firefox complains on load the initial feed here when we use the test server.
// It may be similar to the CORS problem below.
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click();
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();
@@ -88,6 +92,24 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await expect(page.locator('div[role="alert"]')).toBeVisible();
});
test('Without being registered, add contacts without registration', async ({ page, context }) => {
await page.goto('./account');
// wait until the DID shows on the page in the 'did' element
const didElem = await page.getByTestId('didWrapper').locator('code');
const newDid = await didElem.innerText();
expect(newDid.trim()).toEqual('');
// Add new contact without registering
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"] span:has-text("Contact Added")')).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
// wait for the alert to disappear, which also ensures that there is no "Register" button waiting
await expect(page.locator('div[role="alert"]')).toBeHidden();
});
test('Add contact, copy details, delete, and import various ways', async ({ page, context }) => {
await importUser(page, '00');
@@ -117,6 +139,7 @@ test('Add contact, copy details, delete, and import various ways', async ({ page
await page.getByTestId('contactCheckAllTop').click();
await page.getByTestId('copySelectedContactsButtonTop').click();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
// 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']);
@@ -125,12 +148,19 @@ test('Add contact, copy details, delete, and import various ways', async ({ page
// see contact details on the second contact
await page.getByTestId('contactListItem').nth(1).locator('a').click();
await page.getByRole('heading', { name: 'Identifier Details' }).isVisible();
// 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();
// Firefox has a problem when we run this against the test server. It doesn't load the feed.
// It says there's a CORS problem; maybe it's more strict than the other browsers.
// It works when we set the config to use a local server.
// Seems like we hit a similar problem above.
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
// go to the contacts page and paste the copied contact details
await page.goto('./contacts');

View File

@@ -95,4 +95,4 @@ export async function createRandomNumbersArray(count: number): Promise<number[]>
}
return numbersArray;
}
}