From 2d900b315a6522fc7577fe87e05f893257b7662c Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 7 Nov 2024 18:17:33 -0700 Subject: [PATCH] fix problem with "Affirm Delivery" on offer claim page, plus other look-and-feel tweaks --- README.md | 6 ++-- src/views/ClaimView.vue | 3 +- src/views/ContactsView.vue | 15 ++++++++-- src/views/GiftedDetailsView.vue | 2 +- src/views/InviteOneView.vue | 18 ++++++++++++ src/views/NewActivityView.vue | 17 +++++------ src/views/RecentOffersToUserProjectsView.vue | 21 +++++++++++++- src/views/RecentOffersToUserView.vue | 16 ++++++++++- src/views/TestView.vue | 4 +-- test-playwright/50-record-offer.spec.ts | 30 ++++++++++++++++++-- test-playwright/60-new-activity.spec.ts | 9 +++--- 11 files changed, 115 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 2e48f082e..a1742c33a 100644 --- a/README.md +++ b/README.md @@ -116,13 +116,11 @@ NODE_ENV=test-local npm run dev ``` -To run a single test with the screenshots, use the following: +To run a single test like above with the screenshots, use the following: ``` -npx playwright test test-playwright/40-add-contact.spec.ts --trace on +npx playwright test -c playwright.config-local.ts --trace on test-playwright/40-add-contact.spec.ts ``` -... with the `-c playwright.config-local.ts` to get the same results as above. - ### Register new user on test server diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 0d26ca1ac..0e48473d9 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -161,6 +161,7 @@ +
@@ -192,7 +193,6 @@
- Nobody has confirmed this. @@ -867,6 +867,7 @@ export default class ClaimView extends Vue { this.veriClaim as GenericCredWrapper, ), }; + console.log("giver & dialog", giver, this.$refs.customGiveDialog); (this.$refs.customGiveDialog as GiftedDialog).open( giver, undefined, diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index b72909f1b..408fa4d53 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -88,7 +88,7 @@ @click="toggleShowContactAmounts()" > {{ - showGiveNumbers ? "Hide Given Hours, etc" : "Show Given Hours, etc" + showGiveNumbers ? "Hide Hours, Offer, etc" : "See Hours, Offer, etc" }}
@@ -418,7 +418,18 @@ export default class ContactsView extends Vue { // handle an invite JWT sent via URL const importedInviteJwt = (this.$route as RouteLocationNormalizedLoaded) .query["inviteJwt"] as string; - if (importedInviteJwt) { + if (importedInviteJwt === "") { + // this happens when a platform (usually iOS) doesn't include anything after the "=" in a shared link. + this.$notify( + { + group: "alert", + type: "warning", + title: "Blank Invite", + text: "The invite was not included. This can happen when your device cuts off the link, so you might try pasting the full link into a browser.", + }, + 7000, + ); + } else if (importedInviteJwt) { // make sure user is created if (!this.activeDid) { this.activeDid = await generateSaveAndActivateIdentity(); diff --git a/src/views/GiftedDetailsView.vue b/src/views/GiftedDetailsView.vue index 1a65ebcd1..51ccb5b80 100644 --- a/src/views/GiftedDetailsView.vue +++ b/src/views/GiftedDetailsView.vue @@ -74,7 +74,7 @@ -
+ +
+

Nobody has given you an offer.

+

+ You can start the cycle on the + + Contacts page + + with an "Offer" directly to someone. Hopefully you'll find a common + interest! +

+
-
    +
    • Image Sharing

      Populates the "shared-photo" view as if they used "share_target". - + Go to Shared Page diff --git a/test-playwright/50-record-offer.spec.ts b/test-playwright/50-record-offer.spec.ts index e9c21a5a9..0ec98f38c 100644 --- a/test-playwright/50-record-offer.spec.ts +++ b/test-playwright/50-record-offer.spec.ts @@ -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(); }); diff --git a/test-playwright/60-new-activity.spec.ts b/test-playwright/60-new-activity.spec.ts index f1d2b2ee1..d24605f2d 100644 --- a/test-playwright/60-new-activity.spec.ts +++ b/test-playwright/60-new-activity.spec.ts @@ -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('./');