From e65eb07dfe3f2a8c45853c640a975e2c29e9581d Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 4 Mar 2025 19:32:05 +0545 Subject: [PATCH 1/6] fix: check proposal card visibility before validate filter --- .../lib/pages/proposalDiscussionPage.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts b/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts index 4806e0249..07da72fda 100644 --- a/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/proposalDiscussionPage.ts @@ -131,15 +131,17 @@ export default class ProposalDiscussionPage { const proposalCards = await this.getAllProposals(); for (const proposalCard of proposalCards) { - const type = await proposalCard - .getByTestId("governance-action-type") - .textContent(); - const hasFilter = await validateFunction(proposalCard, filters); - if (!hasFilter) { - const errorMessage = `A governance action type ${type} does not contain on ${filters}`; - throw errorMessage; + if (await proposalCard.isVisible()) { + const type = await proposalCard + .getByTestId("governance-action-type") + .textContent(); + const hasFilter = await validateFunction(proposalCard, filters); + if (!hasFilter) { + const errorMessage = `A governance action type ${type} does not contain on ${filters}`; + throw errorMessage; + } + expect(hasFilter).toBe(true); } - expect(hasFilter).toBe(true); } }); } From f817d4435f40fd38a62956a91244120678b40bb1 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 4 Mar 2025 19:32:30 +0545 Subject: [PATCH 2/6] fix: increase timeout of dRep form validation test --- tests/govtool-frontend/playwright/lib/forms/dRepForm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts index e11d23551..da80eed4d 100644 --- a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts +++ b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts @@ -174,7 +174,7 @@ export default class DRepForm { .getByTestId(formErrors.paymentAddress) .isVisible(); - expect(await this.objectivesInput.textContent(), { + expect(await this.objectivesInput.textContent({ timeout: 60_000 }), { message: objectivesInputText !== dRepInfo.objectives && `${dRepInfo.objectives} is not equal to ${await this.objectivesInput.textContent()}`, @@ -255,7 +255,7 @@ export default class DRepForm { message: !isPaymentAddressErrorVisible && `${dRepInfo.paymentAddress} is a valid paymentAddress`, - }).toBeVisible(); + }).toBeVisible({ timeout: 60_000 }); expect(await this.objectivesInput.textContent(), { message: From 5882513811f29d5553c3239835a161f55c2c86cc Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 4 Mar 2025 19:40:09 +0545 Subject: [PATCH 3/6] fix: increase timeout for various tests to improve stability --- .../playwright/lib/pages/dRepDirectoryPage.ts | 2 +- .../2-delegation/delegation.loggedin.spec.ts | 4 ++-- .../tests/2-delegation/delegation.spec.ts | 2 +- ...delegationFunctionality.delegation.spec.ts | 22 +++++++++---------- .../dRepRegistration.loggedin.spec.ts | 2 +- .../3-drep-registration/editDRep.dRep.spec.ts | 2 +- .../proposalVisibility.dRep.spec.ts | 4 ++-- .../proposalFunctionality.dRep.spec.ts | 12 +++++----- .../miscellaneous.dRep.spec.ts | 2 +- .../proposalSubmission.ga.spec.ts | 2 +- .../proposalSubmission.loggedin.spec.ts | 2 +- .../proposalDiscussion.loggedin.spec.ts | 2 +- .../proposalDiscussion.spec.ts | 2 +- .../tests/9-outcomes/outcomes.spec.ts | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts index 572865992..1473c0317 100644 --- a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts @@ -184,7 +184,7 @@ export default class DRepDirectoryPage { } async getAllListedDReps() { - await expect(this.searchInput).toBeVisible({ timeout: 10_000 }); + await expect(this.searchInput).toBeVisible({ timeout: 60_000 }); await waitedLoop(async () => { return ( diff --git a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.loggedin.spec.ts index bc5d00c5d..d7a77489b 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.loggedin.spec.ts @@ -92,7 +92,7 @@ test.describe("DRep dependent tests", () => { await page.getByTestId(`${dRepId}-delegate-button`).click(); await expect(dRepDirectoryPage.delegationErrorModal).toBeVisible({ - timeout: 10_000, + timeout: 60_000, }); await expect(dRepDirectoryPage.delegationErrorModal).toHaveText( /UTxO Balance Insufficient/ @@ -102,7 +102,7 @@ test.describe("DRep dependent tests", () => { test("2I. Should check validity of DRep Id", async () => { await dRepDirectoryPage.searchInput.fill(dRepId); await expect(dRepDirectoryPage.getDRepCard(dRepId)).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); const wallet = await ShelleyWallet.generate(); diff --git a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts index e894e1450..9f83b7178 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts @@ -215,7 +215,7 @@ test.describe("DRep dependent tests", () => { await dRepDirectoryPage.searchInput.fill(dRepId); await page.getByTestId(`${dRepId}-copy-id-button`).click(); await expect(page.getByText("Copied to clipboard")).toBeVisible({ - timeout: 10_000, + timeout: 60_000, }); const copiedTextDRepDirectory = await page.evaluate(() => navigator.clipboard.readText() diff --git a/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts b/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts index 5f8584dee..8faee3974 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts @@ -59,7 +59,7 @@ test.describe("Delegate to others", () => { .getByTestId(`${dRepId}-delegated-card`) .getByTestId(`${dRepId}-copy-id-button`) ).toHaveCount(1, { - timeout: 20_000, + timeout: 60_000, }); // Verify dRepId in dashboard @@ -103,7 +103,7 @@ test.describe("Change delegation", () => { page .getByTestId(`${dRepIdFirst}-delegated-card`) .getByTestId(`${dRepIdFirst}-copy-id-button`) - ).toHaveText(`(CIP-105) ${dRepIdFirst}`, { timeout: 20_000 }); + ).toHaveText(`(CIP-105) ${dRepIdFirst}`, { timeout: 60_000 }); // verify delegation await dRepDirectoryPage.delegateToDRep(dRepIdSecond); @@ -114,7 +114,7 @@ test.describe("Change delegation", () => { page .getByTestId(`${dRepIdSecond}-delegated-card`) .getByTestId(`${dRepIdSecond}-copy-id-button`) - ).toHaveText(`(CIP-105) ${dRepIdSecond}`, { timeout: 20_000 }); + ).toHaveText(`(CIP-105) ${dRepIdSecond}`, { timeout: 60_000 }); }); }); @@ -145,13 +145,13 @@ test.describe("Register DRep state", () => { await dRepPage.getByTestId("continue-button").click(); await expect( dRepPage.getByTestId("registration-transaction-submitted-modal") - ).toBeVisible({ timeout: 15_000 }); + ).toBeVisible({ timeout: 60_000 }); await dRepPage.getByTestId("confirm-modal-button").click(); await waitForTxConfirmation(dRepPage); // Checks in dashboard await expect(dRepPage.getByText("You are a Direct Voter")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); await expect( dRepPage.getByTestId("register-as-sole-voter-button") @@ -168,11 +168,11 @@ test.describe("Register DRep state", () => { await dRepPage.getByTestId("continue-button").click(); await expect( dRepPage.getByTestId("registration-transaction-submitted-modal") - ).toBeVisible({ timeout: 15_000 }); + ).toBeVisible({ timeout: 60_000 }); await dRepPage.getByTestId("confirm-modal-button").click(); await waitForTxConfirmation(dRepPage); await expect(dRepPage.getByText("You are a Direct Voter")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); const dRepDirectoryPage = new DRepDirectoryPage(dRepPage); @@ -183,7 +183,7 @@ test.describe("Register DRep state", () => { await expect( dRepPage.getByText("You Have Retired as a Direct") - ).toBeVisible({ timeout: 20_000 }); + ).toBeVisible({ timeout: 60_000 }); }); }); @@ -212,7 +212,7 @@ test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => { await expect(dRepPage.getByTestId(`${dRepId}-copy-id-button`)).toHaveCount( 1, { - timeout: 20_000, + timeout: 60_000, } ); }); @@ -233,14 +233,14 @@ test.describe("Multiple delegations", () => { await page.getByTestId(`${dRep01Wallet.dRepId}-delegate-button`).click(); await expect(page.getByTestId("alert-warning")).toHaveText(/in progress/i, { - timeout: 15_000, + timeout: 60_000, }); await dRepDirectoryPage.searchInput.fill(dRep02Wallet.dRepId); await page.getByTestId(`${dRep02Wallet.dRepId}-delegate-button`).click(); await expect(page.getByTestId("transaction-inprogress-modal")).toBeVisible({ - timeout: 15_000, + timeout: 60_000, }); }); }); diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts index b49ed3a25..63592c0a1 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.loggedin.spec.ts @@ -196,7 +196,7 @@ test("3F. Should create proper DRep registration request, when registered with d await dRepRegistrationPage.registerWithoutTxConfirmation({ name: "Test" }); await expect( page.getByTestId("registration-transaction-error-modal") - ).toBeVisible({ timeout: 10_000 }); + ).toBeVisible({ timeout: 60_000 }); }); test("3O. Should reject invalid dRep registration metadata", async ({ diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts index 803da619f..16a622102 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/editDRep.dRep.spec.ts @@ -73,7 +73,7 @@ test.describe("Validation of edit dRep Form", () => { const editDRepPage = new EditDRepPage(page); await editDRepPage.goto(); - await expect(editDRepPage.nameInput).toBeVisible({ timeout: 20_000 }); // assert to wait for the page to load + await expect(editDRepPage.nameInput).toBeVisible({ timeout: 60_000 }); // assert to wait for the page to load for (let i = 0; i < 100; i++) { await editDRepPage.inValidateForm({ diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts index 409ff036d..1c8a25cf3 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts @@ -45,7 +45,7 @@ test.describe("Logged in DRep", () => { await expect(page.getByTestId("voting-power-chips-value")).toHaveText( `₳ ${lovelaceToAda(votingPower)}`, - { timeout: 20_000 } + { timeout: 60_000 } ); }); @@ -57,7 +57,7 @@ test.describe("Logged in DRep", () => { // assert to wait until the loading button is hidden await expect(page.getByTestId("to-vote-tab")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); govActionDetailsPage = (await isBootStrapingPhase()) diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts index d3af5b383..4fcf0f70b 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts @@ -37,7 +37,7 @@ test.describe("Proposal checks", () => { // assert to wait until the loading button is hidden await expect(page.getByTestId("to-vote-tab")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); currentPage = page; @@ -155,7 +155,7 @@ test.describe("Perform voting", () => { // assert to wait until the loading button is hidden await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); govActionDetailsPage = (await isBootStrapingPhase()) @@ -216,7 +216,7 @@ test.describe("Perform voting", () => { test.setTimeout(testInfo.timeout + environments.txTimeOut); await govActionDetailsPage.vote(); await expect(govActionDetailsPage.voteSuccessModal).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); }); @@ -261,7 +261,7 @@ test.describe("Check voting power", () => { await dRepPage.getByTestId("continue-retirement-button").click(); await expect( dRepPage.getByTestId("retirement-transaction-submitted-modal") - ).toBeVisible({ timeout: 15_000 }); + ).toBeVisible({ timeout: 60_000 }); dRepPage.getByTestId("confirm-modal-button").click(); await waitForTxConfirmation(dRepPage); @@ -304,11 +304,11 @@ test.describe("Bootstrap phase", () => { // assert to wait until proposal cards are visible await expect(dRepPage.getByTestId("voting-power-chips")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); // wait until the loading button is hidden await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); const governanceActionDetailsPage = diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts index d0d41df40..027f39f0c 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts @@ -20,7 +20,7 @@ test("6H. Should restrict dRep registration for dRep", async ({ page }) => { await page.goto(`${environments.frontendUrl}/register_drep`); await expect(page.getByText("You already are a DRep")).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); await expect(page.getByTestId("name-input")).not.toBeVisible(); }); diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.ga.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.ga.spec.ts index b04aad6ea..fbfa52a6a 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.ga.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.ga.spec.ts @@ -59,7 +59,7 @@ Object.values(ProposalType).forEach((proposalType, index) => { await expect(userPage.getByTestId("ga-submitted-modal-title")).toHaveText( /governance action submitted!/i, { - timeout: 20_000, + timeout: 60_000, } ); diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts index a018136ef..29aad363e 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts @@ -411,7 +411,7 @@ test.describe("Proposal Draft", () => { await expect(proposalSubmissionPage.governanceActionType).toHaveText( createProposalType, - { timeout: 20_000 } + { timeout: 60_000 } ); await expect(proposalSubmissionPage.titleInput).toHaveValue( proposalFormValue.prop_name diff --git a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.spec.ts index dde347d4e..dddf552b1 100644 --- a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.spec.ts @@ -125,7 +125,7 @@ test.describe("Proposal created with poll enabled (user auth)", () => { // vote must be changed await expect( page.getByTestId(`poll-${vote.toLowerCase()}-count`) - ).toHaveText(`${vote}: (0%)`, { timeout: 15_000 }); + ).toHaveText(`${vote}: (0%)`, { timeout: 60_000 }); // opposite of random choice vote const oppositeVote = pollVotes[pollVotes.length - 1 - choice]; await expect( diff --git a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts index 9b0303019..e476b857e 100644 --- a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts +++ b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts @@ -151,7 +151,7 @@ test("8D. Should show the view-all categorized proposed governance actions.", as for (const proposalCard of proposalCards) { await expect( proposalCard.getByTestId("governance-action-type") - ).toHaveText(proposalType, { timeout: 20_000 }); + ).toHaveText(proposalType, { timeout: 60_000 }); } }) ); diff --git a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts index 6a8108728..76f709fd4 100644 --- a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts +++ b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts @@ -169,7 +169,7 @@ test.describe("Outcome details dependent test", () => { .getByTestId("copy-button") .click(); await expect(page.getByText("Copied to clipboard")).toBeVisible({ - timeout: 10_000, + timeout: 60_000, }); const copiedTextDRepDirectory = await page.evaluate(() => navigator.clipboard.readText() From 75149246afde6f5761fab7f8833da57878b1da3b Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 4 Mar 2025 19:59:07 +0545 Subject: [PATCH 4/6] fix: remove test skip and fix self vote test --- .../playwright/lib/pages/dRepDirectoryPage.ts | 4 ++++ .../delegationFunctionality.delegation.spec.ts | 16 +++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts index 1473c0317..4f62038a8 100644 --- a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts @@ -45,6 +45,10 @@ export default class DRepDirectoryPage { constructor(private readonly page: Page) {} + get currentPage(): Page { + return this.page; + } + async goto() { await this.page.goto( `${environments.frontendUrl}/connected/drep_directory` diff --git a/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts b/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts index 8faee3974..aa824c536 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegationFunctionality.delegation.spec.ts @@ -188,7 +188,6 @@ test.describe("Register DRep state", () => { }); test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => { - test.skip(); test.setTimeout(testInfo.timeout + environments.txTimeOut); const wallet = await walletManager.popWallet("registeredDRep"); @@ -207,14 +206,13 @@ test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => { await dRepDirectoryPage.delegateToDRep(dRepId); await expect( - dRepPage.getByTestId(`${dRepId}-delegate-button')`) - ).not.toBeVisible(); - await expect(dRepPage.getByTestId(`${dRepId}-copy-id-button`)).toHaveCount( - 1, - { - timeout: 60_000, - } - ); + dRepDirectoryPage.currentPage.getByTestId(`${dRepId}-delegate-button`) + ).not.toBeVisible({ timeout: 60_000 }); + await expect( + dRepDirectoryPage.currentPage.getByTestId(`${dRepId}-copy-id-button`) + ).toHaveCount(1, { + timeout: 60_000, + }); }); test.describe("Multiple delegations", () => { From 00c83f41240da4a59157fe2ebf5c089778159c40 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 5 Mar 2025 14:02:31 +0545 Subject: [PATCH 5/6] fix: increase timeout for outcome response and metrics requests in tests --- .../tests/9-outcomes/outcomes.spec.ts | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts index 76f709fd4..b2fa991d4 100644 --- a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts +++ b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts @@ -317,11 +317,22 @@ test("9G. Should display correct vote counts on outcome details page", async ({ Object.keys(outcomeType).map(async (filterKey) => { const page = await browser.newPage(); injectLogger(page); - const outcomeListResponsePromise = page.waitForResponse((response) => - response - .url() - .includes(`governance-actions?search=&filters=${filterKey}`) + + const outcomeListResponsePromise = page.waitForResponse( + (response) => + response + .url() + .includes(`governance-actions?search=&filters=${filterKey}`), + { timeout: 60_000 } + ); + + const metricsResponsePromise = page.waitForResponse( + (response) => + response.url().includes(`/network/metrics`) && + !response.url().includes(`/misc/network/metrics`), + { timeout: 60_000 } ); + const outcomePage = new OutComesPage(page); await outcomePage.goto({ filter: filterKey }); @@ -332,27 +343,28 @@ test("9G. Should display correct vote counts on outcome details page", async ({ proposals.length, proposals.length == 0 && "No proposals found!" ).toBeGreaterThan(0); + const { index: governanceActionIndex, tx_hash: governanceTransactionHash, } = proposals[0]; + const outcomeResponsePromise = page.waitForResponse( + (response) => + response + .url() + .includes( + `governance-actions/${governanceTransactionHash}?index=${governanceActionIndex}` + ), + { timeout: 60_000 } + ); + const govActionDetailsPage = await outcomePage.viewFirstOutcomes(); - const outcomeResponse = await page.waitForResponse((response) => - response - .url() - .includes( - `governance-actions/${governanceTransactionHash}?index=${governanceActionIndex}` - ) - ); + const outcomeResponse = await outcomeResponsePromise; const proposalToCheck = (await outcomeResponse.json())[0]; - const metricsResponse = await page.waitForResponse( - (response) => - response.url().includes(`/network/metrics`) && - !response.url().includes(`/misc/network/metrics`) - ); + const metricsResponse = await metricsResponsePromise; const dRepTotalAbstainVote = await govActionDetailsPage.getDRepTotalAbstainVoted( @@ -363,7 +375,8 @@ test("9G. Should display correct vote counts on outcome details page", async ({ // check dRep votes if (await areDRepVoteTotalsDisplayed(proposalToCheck)) { await expect(govActionDetailsPage.dRepYesVotes).toHaveText( - `₳ ${correctVoteAdaFormat(parseInt(proposalToCheck.yes_votes))}` + `₳ ${correctVoteAdaFormat(parseInt(proposalToCheck.yes_votes))}`, + { timeout: 60_000 } ); await expect(govActionDetailsPage.dRepAbstainVotes).toHaveText( `₳ ${correctVoteAdaFormat(dRepTotalAbstainVote)}` From a7e043b6b911e95b0e9d68a93e50cd207ed5b0cb Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 5 Mar 2025 14:03:08 +0545 Subject: [PATCH 6/6] fix: update outcomeMetadata structure and adjust outcome details test --- tests/govtool-frontend/playwright/lib/types.ts | 6 +++--- .../playwright/tests/9-outcomes/outcomes.spec.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/types.ts b/tests/govtool-frontend/playwright/lib/types.ts index ef277f297..eec36a280 100644 --- a/tests/govtool-frontend/playwright/lib/types.ts +++ b/tests/govtool-frontend/playwright/lib/types.ts @@ -291,9 +291,9 @@ export interface outcomeProposal { } export interface outcomeMetadata { - authors: any[]; - hashAlgorithm: string; - body: outcomeMetadataBody; + metadataStatus: string; + metadataValid: boolean; + data: outcomeMetadataBody; } interface outcomeMetadataBody { diff --git a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts index b2fa991d4..fd9472826 100644 --- a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts +++ b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts @@ -78,8 +78,8 @@ test.describe("Outcome details dependent test", () => { return; } const data: outcomeMetadata = await response.json(); - if (!governanceActionTitle && data.body.title != null) { - governanceActionTitle = data.body.title; + if (!governanceActionTitle && data.data.title != null) { + governanceActionTitle = data.data.title; } await route.fulfill({ status: 200,