Browse Source

New test

playwright-pwa-install-test
Jose Olarte III 4 months ago
parent
commit
1973ca1977
  1. 3
      test-playwright/20-create-project.spec.ts
  2. 3
      test-playwright/21-create-project-search.spec.ts
  3. 12
      test-playwright/30-record-gift.spec.ts
  4. 27
      test-playwright/40-add-contact.spec.ts

3
test-playwright/20-create-project.spec.ts

@ -31,9 +31,6 @@ test('Create new project', async ({ page }) => {
await page.getByPlaceholder('Name').fill('User Zero'); await page.getByPlaceholder('Name').fill('User Zero');
await page.getByRole('button', { name: 'Save Changes' }).click(); await page.getByRole('button', { name: 'Save Changes' }).click();
// Check DID
await expect(page.getByRole('code')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F');
// Pause for 5 seconds // Pause for 5 seconds
await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear

3
test-playwright/21-create-project-search.spec.ts

@ -31,9 +31,6 @@ test('Create new project, then search for it', async ({ page }) => {
await page.getByPlaceholder('Name').fill('User Zero'); await page.getByPlaceholder('Name').fill('User Zero');
await page.getByRole('button', { name: 'Save Changes' }).click(); await page.getByRole('button', { name: 'Save Changes' }).click();
// Check DID
await expect(page.getByRole('code')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F');
// Pause for 5 seconds // Pause for 5 seconds
await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear await page.waitForTimeout(5000); // I have to wait, otherwise the (+) button to add a new project doesn't appear

12
test-playwright/30-record-gift.spec.ts

@ -32,9 +32,6 @@ test('Record something given', async ({ page }) => {
await page.getByPlaceholder('Name').fill('User Zero'); await page.getByPlaceholder('Name').fill('User Zero');
await page.getByRole('button', { name: 'Save Changes' }).click(); await page.getByRole('button', { name: 'Save Changes' }).click();
// Check DID
await expect(page.getByRole('code')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F');
// Record something given // Record something given
await page.goto('./'); await page.goto('./');
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click(); await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
@ -43,4 +40,13 @@ test('Record something given', async ({ page }) => {
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString()); await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());
await page.getByRole('button', { name: 'Sign & Send' }).click(); await page.getByRole('button', { name: 'Sign & Send' }).click();
await expect(page.getByText('That gift was recorded.')).toBeVisible(); await expect(page.getByText('That gift was recorded.')).toBeVisible();
// Refresh home view and check gift
await page.goto('./');
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();
const page1Promise = page.waitForEvent('popup');
await page.getByRole('link', { name: 'View on the Public Server' }).click();
const page1 = await page1Promise;
}); });

27
test-playwright/40-add-contact.spec.ts

@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';
test('Create new ID from seed', async ({ page }) => {
// Create new ID using seed phrase "rigid shrug mobile…"
await page.goto('./start');
await page.getByText('You have a seed').click();
await page.getByPlaceholder('Seed Phrase').click();
await page.getByPlaceholder('Seed Phrase').fill('rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage');
await page.getByRole('button', { name: 'Import' }).click();
// Set name
await page.getByRole('link', { name: 'Set Your Name' }).click();
await page.getByPlaceholder('Name').click();
await page.getByPlaceholder('Name').fill('User Zero');
await page.getByRole('button', { name: 'Save Changes' }).click();
// Add new contact 01
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39');
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 expect(page.locator('li.border-b')).toContainText('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39');
});
Loading…
Cancel
Save