forked from trent_larson/crowd-funder-for-time-pwa
Update: switched back users and adjusted test instead
This commit is contained in:
@@ -82,19 +82,20 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
// Combine title prefix with the random string
|
// Combine title prefix with the random string
|
||||||
const finalTitle = standardTitle + finalRandomString;
|
const finalTitle = standardTitle + finalRandomString;
|
||||||
|
|
||||||
const contactName = 'Contact #001 renamed';
|
const contactName = 'Contact #000 renamed';
|
||||||
const userName = 'User #001';
|
const userName = 'User #000';
|
||||||
|
|
||||||
// Import user 00
|
// Import user 01
|
||||||
await importUser(page, '00');
|
await importUser(page, '01');
|
||||||
|
|
||||||
// Add new contact
|
// Add new contact
|
||||||
await page.goto('./contacts');
|
await page.goto('./contacts');
|
||||||
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, ' + userName);
|
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, ' + userName);
|
||||||
await page.locator('button > svg.fa-plus').click();
|
await page.locator('button > svg.fa-plus').click();
|
||||||
await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible();
|
// Commenting the following lines because user 00 is already registered
|
||||||
await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
|
// await expect(page.locator('div[role="alert"] span:has-text("No")')).toBeVisible();
|
||||||
await expect(page.locator('div[role="alert"] span:has-text("Contact Added")')).toBeVisible();
|
// await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
|
||||||
|
await expect(page.locator('div[role="alert"] span:has-text("Success")')).toBeVisible();
|
||||||
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
|
||||||
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
|
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
await expect(page.locator('li.border-b')).toContainText(userName);
|
await expect(page.locator('li.border-b')).toContainText(userName);
|
||||||
|
|
||||||
// Rename contact
|
// Rename contact
|
||||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${userName}") + span svg.fa-circle-info`).click();
|
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${userName}") + div svg.fa-circle-info`).click();
|
||||||
// now on the DID view page
|
// now on the DID view page
|
||||||
await page.locator('h2 svg.fa-pen').click();
|
await page.locator('h2 svg.fa-pen').click();
|
||||||
// now on the contact edit page
|
// now on the contact edit page
|
||||||
@@ -116,10 +117,11 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
// Confirm that home shows contact in "Record Something…"
|
// Confirm that home shows contact in "Record Something…"
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
await expect(page.locator('#sectionRecordSomethingGiven ul li').filter({ hasText: contactName }).nth(0)).toBeVisible();
|
await page.getByRole('button', { name: 'Person' }).click();
|
||||||
|
await expect(page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName })).toBeVisible();
|
||||||
|
|
||||||
// Record something given by new contact
|
// Record something given by new contact
|
||||||
await page.getByRole('heading', { name: contactName }).click();
|
await page.locator('#sectionGiftedGiver').getByRole('listitem').filter({ hasText: contactName }).click();
|
||||||
await page.getByPlaceholder('What was given').fill(finalTitle);
|
await page.getByPlaceholder('What was given').fill(finalTitle);
|
||||||
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();
|
||||||
@@ -130,7 +132,8 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
|
|
||||||
// Firefox complains on load the initial feed here when we use the test server.
|
// Firefox complains on load the initial feed here when we use the test server.
|
||||||
// It may be similar to the CORS problem below.
|
// It may be similar to the CORS problem below.
|
||||||
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click();
|
const item = await page.locator('li:first-child').filter({ hasText: finalTitle });
|
||||||
|
await item.locator('[data-testid="circle-info-link"]').click();
|
||||||
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
||||||
await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();
|
await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();
|
||||||
|
|
||||||
@@ -149,12 +152,12 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
|||||||
await page.getByText('You have a seed').click();
|
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('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();
|
await page.getByRole('button', { name: 'Import' }).click();
|
||||||
await expect(page.getByRole('code')).toContainText('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39');
|
await expect(page.locator('[data-testid="didWrapper"]').getByRole('code')).toContainText('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F');
|
||||||
|
|
||||||
// Go to home view and look for gift
|
// Go to home view and look for gift
|
||||||
await page.goto('./');
|
await page.goto('./');
|
||||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
// await page.getByTestId('closeOnboardingAndFinish').click();
|
||||||
const giftLink = page.locator('li').filter({ hasText: finalTitle }).locator('a');
|
const giftLink = page.locator('li:first-child').filter({ hasText: finalTitle }).locator('[data-testid="circle-info-link"]');
|
||||||
await expect(giftLink).toBeVisible();
|
await expect(giftLink).toBeVisible();
|
||||||
await giftLink.click();
|
await giftLink.click();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user