fix problem with "Affirm Delivery" on offer claim page, plus other look-and-feel tweaks

This commit is contained in:
2024-11-07 18:17:33 -07:00
parent 79a530aff5
commit bacf9d7de6
11 changed files with 116 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ test('Record an offer', async ({ page }) => {
const updatedDescription = `Updated ${description}`;
const randomNonZeroNumber = Math.floor(Math.random() * 998) + 1;
// Create new ID for default user
// Switch to user 0
await importUser(page);
// Select a project
@@ -77,7 +77,33 @@ test('Record an offer', async ({ page }) => {
// click on the number of new offers to go to the list page
await offerNumElem.click();
await expect(page.getByText('New Offers To Your Projects', { exact: true })).toBeVisible();
await page.getByTestId('showOffersToUserProjects').click();
// get the icon child of the showOffersToUserProjects
await page.getByTestId('showOffersToUserProjects').locator('div > svg.fa-chevron-right').click();
await expect(page.getByText(description)).toBeVisible();
});
test('Affirm delivery of an offer', async ({ page }) => {
// go to the home page and check that the offer is shown as new
await importUser(page);
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
const offerNumElem = page.getByTestId('newOffersToUserProjectsActivityNumber');
await expect(offerNumElem).toBeVisible();
// click on the number of new offers to go to the list page
await offerNumElem.click();
// get the link that comes after the showOffersToUserProjects and click it
await page.getByTestId('showOffersToUserProjects').locator('a').click();
// get the first item of the list and click on the icon with file-lines
const firstItem = page.getByTestId('listRecentOffersToUserProjects').locator('li').first();
await expect(firstItem).toBeVisible();
await firstItem.locator('svg.fa-file-lines').click();
await expect(page.getByText('Verifiable Claim Details', { exact: true })).toBeVisible();
// click on the 'Affirm Delivery' button
await page.getByRole('button', { name: 'Affirm Delivery' }).click();
// fill our offer info and submit
await page.getByPlaceholder('What was given').fill("Whatever the offer says");
await page.getByRole('spinbutton').fill("2");
await page.getByRole('button', { name: 'Sign & Send' }).click();
await expect(page.getByText('That gift was recorded.')).toBeVisible();
});

View File

@@ -16,7 +16,7 @@ test('New offers for another user', async ({ page }) => {
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: /Show Given Hours/i }).click();
await page.getByRole('button').filter({ hasText: /See Hours/i }).click();
// make an offer directly to user 1
// Generate a random string of 3 characters, skipping the "0." at the beginning
@@ -50,7 +50,7 @@ test('New offers for another user', async ({ page }) => {
await offerNumElem.click();
await expect(page.getByText('New Offers To You', { exact: true })).toBeVisible();
await page.getByTestId('showOffersToUser').click();
await page.getByTestId('showOffersToUser').locator('div > svg.fa-chevron-right').click();
// note that they show in reverse chronologicalorder
await expect(page.getByText(`help of ${randomString2} from #000`)).toBeVisible();
await expect(page.getByText(`help of ${randomString1} from #000`)).toBeVisible();
@@ -62,7 +62,8 @@ test('New offers for another user', async ({ page }) => {
// now find the "Click to keep all above as new offers" after that list item and click it
const liElem = page.locator('li').filter({ hasText: `help of ${randomString2} from #000` });
await liElem.hover();
const keepAboveAsNew = liElem.locator('div').filter({ hasText: /keep all above/ });
const keepAboveAsNew = await liElem.locator('div').filter({ hasText: /keep all above/ });
await keepAboveAsNew.click();
// now see that only one offer is shown as new
@@ -71,7 +72,7 @@ test('New offers for another user', async ({ page }) => {
await expect(offerNumElem).toHaveText('1');
await offerNumElem.click();
await expect(page.getByText('New Offer To You', { exact: true })).toBeVisible();
await page.getByTestId('showOffersToUser').click();
await page.getByTestId('showOffersToUser').locator('div > svg.fa-chevron-right').click();
// now see that no offers are shown as new
await page.goto('./');