diff --git a/playwright.config-local.ts b/playwright.config-local.ts
index 511af5201..c3bd2a5cb 100644
--- a/playwright.config-local.ts
+++ b/playwright.config-local.ts
@@ -74,7 +74,7 @@ export default defineConfig({
/* Configure global timeout; default is 30000 milliseconds */
// the image upload will often not succeed at 5 seconds
- timeout: 20000,
+ // timeout: 10000,
/* Run your local dev server before starting the tests */
/**
diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue
index d5617a33f..ea1a389a8 100644
--- a/src/views/AccountViewView.vue
+++ b/src/views/AccountViewView.vue
@@ -129,7 +129,10 @@
ID
-
+
{{ activeDid }}
-
-
+
+
Creating...
-
-
+
+
Created!
-
-
+
+
diff --git a/src/views/StartView.vue b/src/views/StartView.vue
index 5190f5b58..373741a1b 100644
--- a/src/views/StartView.vue
+++ b/src/views/StartView.vue
@@ -58,6 +58,7 @@
Generate one with a new seed
diff --git a/test-playwright/00-noid-tests.spec.ts b/test-playwright/00-noid-tests.spec.ts
index 12746ff39..cbb08e7ce 100644
--- a/test-playwright/00-noid-tests.spec.ts
+++ b/test-playwright/00-noid-tests.spec.ts
@@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test';
+import { generateEthrUser, importUser } from './testUtils';
test('Confirm usage of test API (may fail if you are running your own Time Safari)', async ({ page }, testInfo) => {
// Load account view
@@ -78,4 +79,19 @@ test('Check ID generation', async ({ page }) => {
// Check that ID is now generated
await expect(page.locator('#sectionIdentityDetails code.truncate')).toContainText('did:ethr:');
-});
\ No newline at end of file
+});
+
+test('Check User 0 can register random person', async ({ page }) => {
+ await importUser(page, '00');
+ const newDid = await generateEthrUser(page);
+ expect(newDid).toContain('did:ethr:');
+
+ await page.goto('./');
+ await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
+ await page.getByPlaceholder('What was given').fill('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();
+});
diff --git a/test-playwright/10-check-usage-limits.spec.ts b/test-playwright/10-check-usage-limits.spec.ts
index 0a4a7e5ae..9bf9c448b 100644
--- a/test-playwright/10-check-usage-limits.spec.ts
+++ b/test-playwright/10-check-usage-limits.spec.ts
@@ -7,12 +7,22 @@ test('Check usage limits', async ({ page }) => {
await expect(page.locator('div.bg-slate-100.rounded-md').filter({ hasText: 'Usage Limits' })).toBeHidden();
// Import user 01
- await importUser(page, '01');
+ const did = await importUser(page, '01');
// Verify that "Usage Limits" section is visible
await expect(page.locator('#sectionUsageLimits')).toBeVisible();
+ await expect(page.locator('#sectionUsageLimits')).toContainText('You have done');
+ await expect(page.locator('#sectionUsageLimits')).toContainText('You have uploaded');
+
await expect(page.getByText('Your claims counter resets')).toBeVisible();
await expect(page.getByText('Your registration counter resets')).toBeVisible();
await expect(page.getByText('Your image counter resets')).toBeVisible();
await expect(page.getByRole('button', { name: 'Recheck Limits' })).toBeVisible();
+
+ // Set name
+ await page.getByRole('link', { name: 'Set Your Name' }).click();
+ const name = 'User ' + did.slice(11, 14);
+ await page.getByPlaceholder('Name').fill(name);
+ await page.getByRole('button', { name: 'Save Changes' }).click();
+
});
\ No newline at end of file
diff --git a/test-playwright/40-add-contact.spec.ts b/test-playwright/40-add-contact.spec.ts
index c344c7c6f..1b7d1435a 100644
--- a/test-playwright/40-add-contact.spec.ts
+++ b/test-playwright/40-add-contact.spec.ts
@@ -2,6 +2,7 @@ import { test, expect } from '@playwright/test';
import { importUser } from './testUtils';
test('Add contact, record gift, confirm gift', async ({ page }) => {
+
// Generate a random string of 16 characters
let randomString = Math.random().toString(36).substring(2, 18);
@@ -31,8 +32,10 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
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();
-
- await page.locator('div[role="alert"] button:has-text("Yes")').click();
+ await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
+ await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
+
+ await page.locator('div[role="alert"] button:has-text("Cancel")').click();
// Verify added contact
await expect(page.locator('li.border-b')).toContainText('User #000');
diff --git a/test-playwright/testUtils.ts b/test-playwright/testUtils.ts
index 7d8d52c79..82a1d8ca7 100644
--- a/test-playwright/testUtils.ts
+++ b/test-playwright/testUtils.ts
@@ -1,6 +1,9 @@
import { expect, Page } from '@playwright/test';
-export async function importUser(page: Page, id?: string): Promise {
+// Import the seed and switch to the user based on the ID.
+// '01' -> 111
+// otherwise -> 000
+export async function importUser(page: Page, id?: string): Promise {
let seedPhrase, userName, did;
// Set seed phrase and DID based on user ID
@@ -21,14 +24,45 @@ export async function importUser(page: Page, id?: string): Promise {
await page.getByText('You have a seed').click();
await page.getByPlaceholder('Seed Phrase').fill(seedPhrase);
await page.getByRole('button', { name: 'Import' }).click();
- await expect(page.locator('#sectionUsageLimits')).toContainText('You have done');
- await expect(page.locator('#sectionUsageLimits')).toContainText('You have uploaded');
-
- // Set name
- await page.getByRole('link', { name: 'Set Your Name' }).click();
- await page.getByPlaceholder('Name').fill(userName);
- await page.getByRole('button', { name: 'Save Changes' }).click();
// Check DID
await expect(page.getByRole('code')).toContainText(did);
+ // ... and ensure the app retrieves the registration status
+ await expect(page.getByText('Your claims counter resets')).toBeVisible();
+ return did;
+}
+
+// This is to switch to someone already in the identity table. It doesn't include registration.
+export async function switchToUser(page: Page, did: string): Promise {
+ await page.goto('./account');
+ await page.getByRole('heading', { name: 'Advanced' }).click();
+ await page.getByRole('link', { name: 'Switch Identifier' }).click();
+ await page.getByRole('code', { name: did }).click();
+}
+
+// Generate a new random user and register them.
+// Note that this makes 000 the active user. Use switchToUser to switch to this DID.
+export async function generateEthrUser(page: Page): Promise {
+ await page.goto('./start');
+ await page.getByTestId('newSeed').click();
+ await expect(page.locator('span:has-text("Created")')).toBeVisible();
+
+ await page.goto('./account');
+ // wait until the DID shows on the page in the 'did' element
+ const didElem = await page.getByTestId('didWrapper').locator('code:has-text("did:")');
+ const newDid = await didElem.innerText();
+
+ await importUser(page, '000'); // switch to user 000
+
+ await page.goto('./contacts');
+ const threeChars = newDid.slice(11, 14);
+ await page.getByPlaceholder('URL or DID, Name, Public Key').fill(`${newDid}, User ${threeChars}`);
+ await page.locator('button > svg.fa-plus').click();
+ await page.locator('li', { hasText: threeChars }).click();
+ // register them
+ await page.locator('div[role="alert"] button:has-text("Yes")').click();
+ // wait for it to disappear because the next steps may depend on alerts being gone
+ await expect(page.locator('div[role="alert"] button:has-text("Yes")')).toBeHidden();
+
+ return newDid;
}
\ No newline at end of file