From a8bb1b46c2d2a7bedba55cf22e1d80db6235ad70 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 18 Aug 2024 14:13:42 -0600 Subject: [PATCH] fix error editing an offer, tweak tests to fix red in IntelliJ --- src/views/OfferDetailsView.vue | 2 +- test-playwright/20-create-project.spec.ts | 4 ++-- test-playwright/30-record-gift.spec.ts | 14 ++++---------- test-playwright/40-add-contact.spec.ts | 4 ++-- test-playwright/50-record-offer.spec.ts | 4 ++-- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/views/OfferDetailsView.vue b/src/views/OfferDetailsView.vue index fc26305bb..26e68a2ab 100644 --- a/src/views/OfferDetailsView.vue +++ b/src/views/OfferDetailsView.vue @@ -275,7 +275,7 @@ export default class OfferDetailsView extends Vue { // find any project ID let project; if ( - this.prevCredToEdit?.claim?.itemOffered?.isPartOf["@type"] === + this.prevCredToEdit?.claim?.itemOffered?.isPartOf?.["@type"] === "PlanAction" ) { project = this.prevCredToEdit?.claim?.itemOffered?.isPartOf; diff --git a/test-playwright/20-create-project.spec.ts b/test-playwright/20-create-project.spec.ts index d7742bc7a..4564a7864 100644 --- a/test-playwright/20-create-project.spec.ts +++ b/test-playwright/20-create-project.spec.ts @@ -12,8 +12,8 @@ test('Create new project, then search for it', async ({ page }) => { const finalRandomString = randomString.substring(0, 16); // Standard texts - const standardTitle = "Idea "; - const standardDescription = "Description of Idea "; + const standardTitle = 'Idea '; + const standardDescription = 'Description of Idea '; // Combine texts with the random string const finalTitle = standardTitle + finalRandomString; diff --git a/test-playwright/30-record-gift.spec.ts b/test-playwright/30-record-gift.spec.ts index 77dc3ff95..696230302 100644 --- a/test-playwright/30-record-gift.spec.ts +++ b/test-playwright/30-record-gift.spec.ts @@ -2,23 +2,17 @@ import { test, expect } from '@playwright/test'; import { importUser } from './testUtils'; test('Record something given', async ({ page }) => { - // Generate a random string of 16 characters - let randomString = Math.random().toString(36).substring(2, 18); - - // In case the string is shorter than 16 characters, generate more characters until it is 16 characters long - while (randomString.length < 16) { - randomString += Math.random().toString(36).substring(2, 18); - } - const finalRandomString = randomString.substring(0, 16); + // Generate a random string of 3 characters + const randomString = Math.random().toString(36).substring(2, 5); // Generate a random non-zero single-digit number const randomNonZeroNumber = Math.floor(Math.random() * 99) + 1; // Standard title prefix - const standardTitle = "Gift "; + const standardTitle = 'Gift '; // Combine title prefix with the random string - const finalTitle = standardTitle + finalRandomString; + const finalTitle = standardTitle + randomString; // Import user 00 await importUser(page, '00'); diff --git a/test-playwright/40-add-contact.spec.ts b/test-playwright/40-add-contact.spec.ts index 4bb765623..cc39c37ea 100644 --- a/test-playwright/40-add-contact.spec.ts +++ b/test-playwright/40-add-contact.spec.ts @@ -15,7 +15,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { const randomNonZeroNumber = Math.floor(Math.random() * 99) + 1; // Standard title prefix - const standardTitle = "Gift "; + const standardTitle = 'Gift '; // Combine title prefix with the random string const finalTitle = standardTitle + finalRandomString; @@ -51,7 +51,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => { // Record something given by new contact await page.getByRole('heading', { name: contactName }).click(); await page.getByPlaceholder('What was given').fill(finalTitle); - await page.getByRole('spinbutton', { id: 'inputGivenAmount' }).fill(randomNonZeroNumber.toString()); + await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString()); await page.getByRole('button', { name: 'Sign & Send' }).click(); await expect(page.getByText('That gift was recorded.')).toBeVisible(); diff --git a/test-playwright/50-record-offer.spec.ts b/test-playwright/50-record-offer.spec.ts index 671af2da3..14fb032ea 100644 --- a/test-playwright/50-record-offer.spec.ts +++ b/test-playwright/50-record-offer.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '@playwright/test'; import { importUser } from './testUtils'; test('Record an offer', async ({ page }) => { - // Generate a random string of 6 characters, skipping the "0." at the beginning - const randomString = Math.random().toString(36).substring(2, 8); + // Generate a random string of 3 characters, skipping the "0." at the beginning + const randomString = Math.random().toString(36).substring(2, 5); // Standard title prefix const finalTitle = `Offering of ${randomString}`; const randomNonZeroNumber = Math.floor(Math.random() * 998) + 1;