fix test number check that increments

This commit is contained in:
2025-01-11 16:41:26 -07:00
parent 3cdf5cb322
commit 9795428ad2
2 changed files with 17 additions and 5 deletions

View File

@@ -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();