Browse Source

Fix: updated more locators

pull/142/head
Jose Olarte III 4 days ago
parent
commit
25e0d26ca5
  1. 28
      test-playwright/40-add-contact.spec.ts
  2. 4
      test-playwright/60-new-activity.spec.ts

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

@ -175,17 +175,11 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
});
test('Without being registered, add contacts without registration', async ({ page, context }) => {
await page.goto('./account');
// wait until the DID shows on the page in the 'did' element
const didElem = await page.getByTestId('didWrapper').locator('code');
const newDid = await didElem.innerText();
expect(newDid.trim()).toEqual('');
// Add new contact without registering
await page.goto('./contacts');
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, User #111');
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"] span:has-text("Contact Added")')).toBeVisible();
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
// wait for the alert to disappear, which also ensures that there is no "Register" button waiting
await expect(page.locator('div[role="alert"]')).toBeHidden();
@ -202,7 +196,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
await expect(page.locator('div[role="alert"]')).toBeVisible();
await expect(page.locator('div[role="alert"] span:has-text("No")')).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("Contact Added")')).toBeVisible();
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
// wait for the alert to disappear
await expect(page.locator('div[role="alert"]')).toBeHidden();
@ -212,7 +206,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"] span:has-text("No")')).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("Contact Added")')).toBeVisible();
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 expect(page.locator('div[role="alert"]')).toBeHidden();
@ -223,13 +217,12 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
// Copy contact details
await page.getByTestId('contactCheckAllTop').click();
await page.getByTestId('copySelectedContactsButtonTop').click();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
// I would prefer to copy from the clipboard, but the recommended approaches don't work.
// See a different clipboard solution below.
// see contact details on the second contact
await page.getByTestId('contactListItem').nth(1).locator('a').click();
await page.getByTestId('contactListItem').nth(1).locator('h2 > a').click();
await page.getByRole('heading', { name: 'Identifier Details' }).isVisible();
// remove contact
await page.locator('button > svg.fa-trash-can').click();
@ -242,7 +235,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
// It works when we set the config to use a local server.
// Seems like we hit a similar problem above.
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.getByRole('alert').filter({ hasText: 'Success Contact has been' })).toBeHidden();
// go to the contacts page and paste the copied contact details
await page.goto('./contacts');
@ -264,7 +257,7 @@ test('Add contact, copy details, delete, and import from paste & from file', asy
await page.getByRole('heading', { name: 'Advanced' }).click();
const fileSelect = await page.locator('input[type="file"]')
fileSelect.setInputFiles('./test-playwright/exported-data.json');
await page.locator('button', { hasText: 'Import Only Contacts' }).click();
await page.locator('button', { hasText: 'Import Contacts' }).click();
// we're on the contact-import page
await expect(page.locator('li', { hasText: '- New' })).toHaveCount(3);
await expect(page.locator('li', { hasText: '- Existing' })).toHaveCount(1);
@ -284,7 +277,7 @@ test('Copy contact to clipboard, then import ', async ({ page, context }, testIn
await page.getByRole('heading', { name: 'Advanced' }).click();
const fileSelect = await page.locator('input[type="file"]')
fileSelect.setInputFiles('./test-playwright/exported-data.json');
await page.locator('button', { hasText: 'Import Only Contacts' }).click();
await page.locator('button', { hasText: 'Import Contacts' }).click();
// we're on the contact-import page
await expect(page.getByRole('heading', { name: "Contact Import" })).toBeVisible();
await page.locator('button', { hasText: 'Import' }).click();
@ -326,11 +319,10 @@ test('Copy contact to clipboard, then import ', async ({ page, context }, testIn
const webServer = testInfo.config.webServer;
const clientServerUrl = webServer?.url;
const PATH_PART = clientServerUrl + "/contact-import/";
expect(clipboardText).toContain(PATH_PART);
const PATH_PART = clientServerUrl + "/deep-link/contact-import/";
await expect(clipboardText).toContain(PATH_PART);
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.locator('div[role="alert"]')).toBeHidden({ timeout: 7000 });
await page.goto(clipboardText);
// we're on the contact-import page

4
test-playwright/60-new-activity.spec.ts

@ -12,13 +12,13 @@ test('New offers for another user', async ({ page }) => {
await page.getByPlaceholder('URL or DID, Name, Public Key').fill(user01Did + ', A Friend');
await expect(page.locator('button > svg.fa-plus')).toBeVisible();
await page.locator('button > svg.fa-plus').click();
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 expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
// show buttons to make offers directly to people
await page.getByRole('button').filter({ hasText: /See Hours/i }).click();
await page.getByRole('button').filter({ hasText: /See Actions/i }).click();
// make an offer directly to user 1
// Generate a random string of 3 characters, skipping the "0." at the beginning

Loading…
Cancel
Save