forked from trent_larson/crowd-funder-for-time-pwa
fix tests that were broken by contact-edit page changes
This commit is contained in:
@@ -33,6 +33,8 @@ test('Record something given', async ({ page }) => {
|
||||
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
||||
await expect(page.getByText(finalTitle, { exact: true })).toBeVisible();
|
||||
const page1Promise = page.waitForEvent('popup');
|
||||
// expand the Details section to see the extended details
|
||||
await page.getByRole('heading', { name: 'Details', exact: true }).click();
|
||||
await page.getByRole('link', { name: 'View on the Public Server' }).click();
|
||||
const page1 = await page1Promise;
|
||||
});
|
||||
@@ -21,15 +21,15 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
||||
// Combine title prefix with the random string
|
||||
const finalTitle = standardTitle + finalRandomString;
|
||||
|
||||
// Contact name
|
||||
const contactName = 'Contact #000 renamed';
|
||||
const userName = 'User #000';
|
||||
|
||||
// Import user 01
|
||||
await importUser(page, '01');
|
||||
|
||||
// Add new contact
|
||||
await page.goto('./contacts');
|
||||
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, User #000');
|
||||
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, ' + userName);
|
||||
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
|
||||
@@ -37,15 +37,19 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
|
||||
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
|
||||
|
||||
// Verify added contact
|
||||
await expect(page.locator('li.border-b')).toContainText('User #000');
|
||||
await expect(page.locator('li.border-b')).toContainText(userName);
|
||||
|
||||
// Rename contact
|
||||
await page.locator('li.border-b div div > a[title="See more about this person"]').click();
|
||||
await page.locator('h2 > button > svg.fa-pen').click();
|
||||
await expect(page.locator('div.dialog-overlay > div.dialog').filter({ hasText: 'Edit Name' })).toBeVisible();
|
||||
await page.getByPlaceholder('Name', { exact: true }).fill(contactName);
|
||||
await page.locator('.dialog > .flex > button').first().click();
|
||||
// await page.locator('.dialog > .flex > button').first().click(); // close alert
|
||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${userName}") + span svg.fa-circle-info`).click();
|
||||
// now on the DID view page
|
||||
await page.locator('h2 svg.fa-pen').click();
|
||||
// now on the contact edit page
|
||||
await expect(page.getByTestId('contactName').locator('input')).toBeVisible();
|
||||
// check that the input field has userName
|
||||
await expect(page.getByTestId('contactName').locator('input')).toHaveValue(userName);
|
||||
await page.getByTestId('contactName').locator('input').fill(contactName);
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await expect(page.locator('h2', { hasText: contactName })).toBeVisible();
|
||||
|
||||
// Confirm that home shows contact in "Record Something…"
|
||||
await page.goto('./');
|
||||
|
||||
@@ -36,6 +36,8 @@ test('Record an offer', async ({ page }) => {
|
||||
await expect(page.getByText('Offered to a bigger plan')).toBeVisible();
|
||||
|
||||
const serverPagePromise = page.waitForEvent('popup');
|
||||
// expand the Details section to see the extended details
|
||||
await page.getByRole('heading', { name: 'Details', exact: true }).click();
|
||||
await page.getByRole('link', { name: 'View on the Public Server' }).click();
|
||||
const serverPage = await serverPagePromise;
|
||||
await expect(serverPage.getByText(description)).toBeVisible();
|
||||
|
||||
@@ -56,7 +56,7 @@ export async function deleteContact(page: Page, did: string): Promise<void> {
|
||||
await page.goto('./contacts');
|
||||
const contactName = createContactName(did);
|
||||
// go to the detail page for this contact
|
||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${contactName}") + a`).click();
|
||||
await page.locator(`li[data-testid="contactListItem"] h2:has-text("${contactName}") + span svg.fa-circle-info`).click();
|
||||
// delete the contact
|
||||
await page.locator('button > svg.fa-trash-can').click();
|
||||
await page.locator('div[role="alert"] button:has-text("Yes")').click();
|
||||
|
||||
Reference in New Issue
Block a user