Skip to content

Commit 9165b16

Browse files
authored
Merge pull request #3922 from IntersectMBO/fix/comment-test-issue
fix: comment count issue
2 parents 78a63ab + 90d84ce commit 9165b16

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
@@ -292,8 +292,12 @@ test.describe("Mocked proposal", () => {
292292
});
293293

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

0 commit comments

Comments
 (0)