diff --git a/test-playwright/testUtils.js b/test-playwright/testUtils.js new file mode 100644 index 0000000..44706ed --- /dev/null +++ b/test-playwright/testUtils.js @@ -0,0 +1,32 @@ +import { expect } from '@playwright/test'; + +export async function importUser(page, id) { + let seedPhrase, userName, did; + + // Set seed phrase and DID based on user ID + switch(id) { + case '01': + seedPhrase = 'island fever beef wine urban aim vacant quit afford total poem flame service calm better adult neither color gaze forum month sister imitate excite'; + userName = 'User One'; + did = 'did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39'; + break; + default: // to user 00 + seedPhrase = 'rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage'; + userName = 'User Zero'; + did = 'did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F'; + } + + // Import ID + await page.goto('./start'); + await page.getByText('You have a seed').click(); + await page.getByPlaceholder('Seed Phrase').fill(seedPhrase); + await page.getByRole('button', { name: 'Import' }).click(); + + // 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); +} \ No newline at end of file