From 812c8a418e9a31ea3d4dfb296ce5bd3f19d2c7c0 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Mon, 29 Jul 2024 19:09:35 +0800 Subject: [PATCH] Playwright: confirm contact appears on home feed --- test-playwright/40-add-contact.spec.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test-playwright/40-add-contact.spec.ts b/test-playwright/40-add-contact.spec.ts index 50960bb2e..44bf3993b 100644 --- a/test-playwright/40-add-contact.spec.ts +++ b/test-playwright/40-add-contact.spec.ts @@ -1,25 +1,37 @@ import { test, expect } from '@playwright/test'; test('Add contact', async ({ page }) => { - // Create new ID using seed phrase "rigid shrug mobile…" + // Create new ID using seed phrase "island fever beef…" await page.goto('./start'); await page.getByText('You have a seed').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.getByPlaceholder('Seed Phrase').fill('island fever beef wine urban aim vacant quit afford total poem flame service calm better adult neither color gaze forum month sister imitate excite'); await page.getByRole('button', { name: 'Import' }).click(); // Set name await page.getByRole('link', { name: 'Set Your Name' }).click(); - await page.getByPlaceholder('Name').fill('User Zero'); + await page.getByPlaceholder('Name').fill('User One'); await page.getByRole('button', { name: 'Save Changes' }).click(); - // Add new contact 01 + // Add new contact 00 await page.goto('./contacts'); - await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39'); + await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); 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'); + // Verify added contact + await expect(page.locator('li.border-b')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'); + + // Rename contact + await page.locator('li.border-b h2 > button[title="Edit"]').click(); + await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible(); + await page.getByPlaceholder('Name', { exact: true }).fill('Contact 00'); + await page.locator('.dialog > .flex > button').first().click(); + + // Confirm that home feed shows contact + await page.goto('./'); + await expect(page.locator('li').filter({ hasText: 'Contact 00 gave to' }).nth(0)).toBeVisible(); + await expect(page.locator('li').filter({ hasText: 'Contact 00 received' }).nth(0)).toBeVisible(); }); \ No newline at end of file