Skip to content

Commit 90d84ce

Browse files
committed
fix: update comment count display to show "99+" for counts exceeding 99
1 parent 56c5a89 commit 90d84ce

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,22 @@ test("11E. Should view comments with count indications on a budget proposal", as
247247

248248
const actualTotalComments =
249249
await budgetDiscussionDetailsPage.totalComments.textContent();
250-
const expectedTotalComments =
251-
proposalResponse.data.attributes.prop_comments_number.toString();
250+
let expectedTotalComments =
251+
proposalResponse.data.attributes.prop_comments_number;
252252
const isEqual = actualTotalComments === expectedTotalComments;
253253

254254
const currentPageUrl = budgetDiscussionDetailsPage.currentPage.url();
255255

256256
const proposalId = extractProposalIdFromUrl(currentPageUrl);
257+
if (expectedTotalComments > 99) {
258+
expectedTotalComments = "99+";
259+
}
257260

258261
await expect(
259262
budgetDiscussionDetailsPage.totalComments,
260263
!isEqual &&
261264
`Total comments do not match in ${environments.frontendUrl}/budget_discussion/${proposalId}`
262-
).toHaveText(expectedTotalComments);
265+
).toHaveText(expectedTotalComments.toString());
263266
});
264267

265268
test.describe("Restricted access to interact budget proposal", () => {

tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,12 @@ test.describe("Mocked proposal", () => {
293293
});
294294

295295
test("8F. Should display all comments with count indication.", async () => {
296+
let commentCount = mockProposal.data.attributes.prop_comments_number;
297+
if (commentCount > 99) {
298+
commentCount = "99+";
299+
}
296300
await expect(proposalDiscussionDetailsPage.commentCount).toHaveText(
297-
mockProposal.data.attributes.prop_comments_number.toString(),
301+
commentCount.toString(),
298302
{ timeout: 60_000 }
299303
);
300304
});

0 commit comments

Comments
 (0)