From c3cf382dbfe5e37416674da7d65305e614f224be Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Thu, 18 Jul 2024 19:56:40 +0800 Subject: [PATCH] Tesdt: validate copy contact info to clipboard --- tests/validate-contact-info-clipboard.spec.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/validate-contact-info-clipboard.spec.ts diff --git a/tests/validate-contact-info-clipboard.spec.ts b/tests/validate-contact-info-clipboard.spec.ts new file mode 100644 index 000000000..87d93d385 --- /dev/null +++ b/tests/validate-contact-info-clipboard.spec.ts @@ -0,0 +1,25 @@ +import { test, expect } from '@playwright/test'; + +test('Validate copy contact info to clipboard', async ({ page }) => { + // Create new ID using seed phrase "island fever beef…" + await page.goto('https://timesafari.app/start'); + await page.getByText('No, I have a seed').click(); + await page.getByPlaceholder('Seed Phrase').click(); + 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').click(); + await page.getByPlaceholder('Name').fill('Island Fever Beef'); + await page.getByRole('button', { name: 'Save Changes' }).click(); + + // Check DID + await expect(page.getByRole('code')).toContainText('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39'); + + // Copy and check contact info + await page.getByRole('link', { name: 'Share Your Info' }).click(); + await page.locator('#Content div').filter({ hasText: 'Click that QR to copy your' }).locator('div').first().click(); + let clipboardContactInfo = await page.evaluate("navigator.clipboard.readText()"); + expect(clipboardContactInfo).toContain("https://endorser.ch/contact?jwt="); +}); \ No newline at end of file