diff --git a/tests/govtool-frontend/playwright/lib/services/kuberService.ts b/tests/govtool-frontend/playwright/lib/services/kuberService.ts index d4bbd06c5..5192debc4 100644 --- a/tests/govtool-frontend/playwright/lib/services/kuberService.ts +++ b/tests/govtool-frontend/playwright/lib/services/kuberService.ts @@ -211,7 +211,10 @@ const kuberService = { }, multipleDRepRegistration: (metadataAndWallets: WalletAndAnchorType[]) => { - const kuber = new Kuber(faucetWallet.address, faucetWallet.payment.private); + const kuber = new Kuber( + proposalFaucetWallet.address, + proposalFaucetWallet.payment.private + ); const req = { certificates: metadataAndWallets.map((metadataAndWallet) => Kuber.generateCert( diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts index e73882eac..e76bb8738 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts @@ -49,7 +49,7 @@ test.describe("Budget proposal logged in state", () => { }); test("11I. Should comments on any proposal", async ({}) => { - const comment = faker.lorem.paragraph(2); + const comment = faker.lorem.paragraph(1); await budgetDiscussionDetailsPage.addComment(comment); await expect( budgetDiscussionDetailsPage.currentPage @@ -59,7 +59,7 @@ test.describe("Budget proposal logged in state", () => { }); test("11J. Should reply to any comments", async ({}) => { - const randComment = faker.lorem.paragraph(2); + const randComment = faker.lorem.paragraph(1); const randReply = faker.lorem.words(5); await budgetDiscussionDetailsPage.addComment(randComment); diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts index 9e7fc2ce2..22a041e45 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts @@ -187,7 +187,7 @@ test("11E. Should view comments with count indications on a budget proposal", as page, }) => { let responsePromise = page.waitForResponse((response) => - response.url().includes(`/api/comments`) + response.url().includes(`/api/bds/`) ); const budgetDiscussionPage = new BudgetDiscussionPage(page); @@ -197,13 +197,23 @@ test("11E. Should view comments with count indications on a budget proposal", as await budgetDiscussionPage.viewFirstProposal(); const response = await responsePromise; - const comments: CommentResponse[] = (await response.json()).data; + const proposalResponse = await response.json(); - await responsePromise; + const actualTotalComments = + await budgetDiscussionDetailsPage.totalComments.textContent(); + const expectedTotalComments = + proposalResponse.data.attributes.prop_comments_number.toString(); + const isEqual = actualTotalComments === expectedTotalComments; - await expect(budgetDiscussionDetailsPage.totalComments).toHaveText( - comments.length.toString() - ); + const currentPageUrl = budgetDiscussionDetailsPage.currentPage.url(); + + const proposalId = extractProposalIdFromUrl(currentPageUrl); + + await expect( + budgetDiscussionDetailsPage.totalComments, + !isEqual && + `Total comments do not match in ${environments.frontendUrl}/budget_discussion/${proposalId}` + ).toHaveText(expectedTotalComments); }); test.describe("Restricted access to interact budget proposal", () => {