From 5c58f75d82a9134789ecc71104d5f6d9f4e8e5ef Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 11 Jan 2025 16:41:26 -0700 Subject: [PATCH] fix test number check that increments --- README.md | 10 ++++++---- test-playwright/50-record-offer.spec.ts | 12 +++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c0164b3..daeda7d 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,11 @@ Look below for the "test-all" instructions. * Record what version is currently on production in docs. -* Run the correct build: +* Get on the server and run the correct build: + + * `cd crowd-funder-for-time-pwa && git pull` + + * Previous command: `rsync -azvu -e "ssh -i ~/.ssh/..." dist ubuntutest@test.timesafari.app:time-safari` * Staging @@ -70,9 +74,7 @@ TIME_SAFARI_APP_TITLE="TimeSafari_Test" VITE_APP_SERVER=https://test.timesafari. npm run build ``` -* Get on the server and back up the time-safari/dist folder. - -* `rsync -azvu -e "ssh -i ~/.ssh/..." dist ubuntutest@test.timesafari.app:time-safari` +* Back up the time-safari/dist folder. * Record the new hash in the changelog. Edit package.json to increment version & add "-beta", `npm install`, and commit. Also record what version is on production. diff --git a/test-playwright/50-record-offer.spec.ts b/test-playwright/50-record-offer.spec.ts index 0e2377e..bfb6004 100644 --- a/test-playwright/50-record-offer.spec.ts +++ b/test-playwright/50-record-offer.spec.ts @@ -77,7 +77,17 @@ test('Record an offer', async ({ page }) => { // go to the home page and check that the offer is shown as new await page.goto('./'); const offerNumElem = page.getByTestId('newOffersToUserProjectsActivityNumber'); - await expect(offerNumElem).toHaveText('50+'); + // extract the number and check that it's greater than 0 or "50+" + const offerNumText = await offerNumElem.textContent(); + if (offerNumText === null) { + throw new Error('Expected Activity Number greater than 0 but got null.'); + } else if (offerNumText === '50+') { + // we're OK + } else if (parseInt(offerNumText) > 0) { + // we're OK + } else { + throw new Error(`Expected Activity Number of greater than 0 but got ${offerNumText}.`); + } // click on the number of new offers to go to the list page await offerNumElem.click();