From 52f6b46dbaa71acad6953254842473a01220a6a5 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Fri, 1 Aug 2025 12:03:36 +0545 Subject: [PATCH 1/7] chore: add test ids for updated vote rationale components --- govtool/frontend/src/components/molecules/VoteActionForm.tsx | 5 +++-- .../components/organisms/VoteContext/VoteContextChoice.tsx | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/govtool/frontend/src/components/molecules/VoteActionForm.tsx b/govtool/frontend/src/components/molecules/VoteActionForm.tsx index 25c1807d2..6a49ac90b 100644 --- a/govtool/frontend/src/components/molecules/VoteActionForm.tsx +++ b/govtool/frontend/src/components/molecules/VoteActionForm.tsx @@ -275,7 +275,7 @@ export const VoteActionForm = ({ border: !showWholeVoteContext ? "1px solid #E1E1E1" : "none", borderRadius: "4px", backgroundColor: !showWholeVoteContext ? fadedPurple.c50 : "transparent", - padding: 2, + padding: 2 }} > {finalVoteContextText} @@ -316,7 +317,7 @@ export const VoteActionForm = ({ }} disableRipple variant="text" - data-testid="external-modal-button" + data-testid="show-more-button" > {t("createGovernanceAction.govToolPinsDataToIPFS")} @@ -77,6 +78,7 @@ export const VoteContextChoice = ({ variant="outlined" onClick={handleStoreItMyself} sx={{ width: isMobile ? "100%" : "287px", whiteSpace: "nowrap", height: "48px", fontWeight: "500" }} + data-testid="download-and-store-yourself-option-button" > {t("createGovernanceAction.downloadAndStoreYourself")} From 163ec86c7c38698f385a43575e73468241a3ab28 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Fri, 1 Aug 2025 12:05:14 +0545 Subject: [PATCH 2/7] fix: update include metadata anchor in vote transaction test --- .../playwright/lib/helpers/waitedLoop.ts | 5 +++-- .../lib/pages/governanceActionDetailsPage.ts | 22 +++++++++++-------- .../proposalVisibility.dRep.spec.ts | 20 ++++++++++++----- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/waitedLoop.ts b/tests/govtool-frontend/playwright/lib/helpers/waitedLoop.ts index cbe537a37..45e04ad33 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/waitedLoop.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/waitedLoop.ts @@ -9,7 +9,7 @@ export async function waitedLoop( const startTime = Date.now(); while (Date.now() - startTime < timeout) { if (await conditionFn()) return true; - Logger.info("Retring the function"); + Logger.info("Retrying the function"); await new Promise((resolve) => setTimeout(resolve, interval)); } return false; @@ -36,9 +36,10 @@ export async function functionWaitedAssert( } catch (error) { if (Date.now() - startTime >= timeout) { const errorMessage = options.message || error.message; + console.log(errorMessage); expect(false, { message: errorMessage }).toBe(true); } - Logger.info(`Retring the function ${name}`); + Logger.info(`Retrying the function ${name}`); await new Promise((resolve) => setTimeout(resolve, interval)); } } diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts index d6a8713a4..800b0f29c 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts @@ -31,6 +31,9 @@ export default class GovernanceActionDetailsPage { readonly continueModalBtn = this.page.getByTestId("continue-modal-button"); readonly confirmModalBtn = this.page.getByTestId("confirm-modal-button"); + readonly downloadAndStoreYourselfOptionBtn = this.page.getByTestId("download-and-store-yourself-option-button") + readonly govtoolPinsDatatoIpfsBtn = this.page.getByTestId("govtool-pins-data-to-ipfs-option-button") + readonly voteSuccessModal = this.page.getByTestId("alert-success"); readonly externalLinkModal = this.page.getByTestId("external-link-modal"); @@ -81,10 +84,16 @@ export default class GovernanceActionDetailsPage { await this.yesVoteRadio.click(); } + await this.voteBtn.click() + if (context) { - await this.contextBtn.click(); + // await this.contextBtn.click(); await this.contextInput.fill(context); - await this.confirmModalBtn.click(); + + this.confirmModalBtn.click() + + await this.downloadAndStoreYourselfOptionBtn.click() + await this.page.getByRole("checkbox").click(); await this.confirmModalBtn.click(); @@ -100,13 +109,8 @@ export default class GovernanceActionDetailsPage { await this.page.getByTestId("go-to-vote-modal-button").click(); } - const isVoteButtonEnabled = await this.voteBtn.isEnabled(); - - await expect(this.voteBtn, { - message: !isVoteButtonEnabled && "Vote button is not enabled", - }).toBeEnabled({ timeout: 60_000 }); - - await this.voteBtn.click(); + // const isVoteButtonEnabled = await this.voteBtn.isEnabled(); + // await this.voteBtn.click() } async getDRepNotVoted( 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 7e6623005..469e32a2d 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 @@ -123,15 +123,25 @@ test.describe("Temporary DReps", async () => { await govActionsPage.goto(); const govActionDetailsPage = await govActionsPage.viewFirstProposal(); - await govActionDetailsPage.vote(faker.lorem.sentence(200)); - await dRepPage.waitForTimeout(5_000); + const fakerContext = faker.lorem.sentence(200) + await govActionDetailsPage.vote(fakerContext); + + await dRepPage.reload();1 + await dRepPage.waitForTimeout(5_000);1 await govActionsPage.votedTab.click(); - await govActionsPage.viewFirstVotedProposal(); + + const votedGovActionDetailsPage = await govActionsPage.viewFirstVotedProposal(); + + await votedGovActionDetailsPage.currentPage.getByTestId("show-more-button").click() + + await votedGovActionDetailsPage.currentPage.waitForTimeout(2000) + + const voteRationaleContext = await votedGovActionDetailsPage.currentPage.getByTestId("vote-rationale-context") + + await expect(voteRationaleContext).toContainText(fakerContext); - // Vote context is not displayed in UI to validate - expect(false, "No vote context displayed").toBe(true); }); }); From ba53a98543bc6c4b336310dd57340511f6325c8f Mon Sep 17 00:00:00 2001 From: joseph rana Date: Mon, 11 Aug 2025 13:38:41 +0545 Subject: [PATCH 3/7] feat: add test for ipfs vote context --- .../lib/pages/governanceActionDetailsPage.ts | 39 +++++++++-------- .../proposalVisibility.dRep.spec.ts | 43 +++++++++++-------- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts index 800b0f29c..17d51f302 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts @@ -79,7 +79,7 @@ export default class GovernanceActionDetailsPage { } @withTxConfirmation - async vote(context?: string, isAlreadyVoted: boolean = false) { + async vote(context?: string, isAlreadyVoted: boolean = false , useIPFSforStorage : boolean = false ){ if (!isAlreadyVoted) { await this.yesVoteRadio.click(); } @@ -87,30 +87,33 @@ export default class GovernanceActionDetailsPage { await this.voteBtn.click() if (context) { - // await this.contextBtn.click(); await this.contextInput.fill(context); this.confirmModalBtn.click() - await this.downloadAndStoreYourselfOptionBtn.click() - - await this.page.getByRole("checkbox").click(); - await this.confirmModalBtn.click(); - - this.metadataDownloadBtn.click(); - const voteMetadata = await this.downloadVoteMetadata(); - const url = await metadataBucketService.uploadMetadata( - voteMetadata.name, - voteMetadata.data - ); - - await this.metadataUrlInput.fill(url); + if (useIPFSforStorage) { + await this.govtoolPinsDatatoIpfsBtn.click() + } else { + + await this.downloadAndStoreYourselfOptionBtn.click() + await this.page.getByRole("checkbox").click(); + await this.confirmModalBtn.click(); + + this.metadataDownloadBtn.click(); + const voteMetadata = await this.downloadVoteMetadata(); + const url = await metadataBucketService.uploadMetadata( + voteMetadata.name, + voteMetadata.data + ); + await this.metadataUrlInput.fill(url); + } await this.confirmModalBtn.click(); await this.page.getByTestId("go-to-vote-modal-button").click(); - } - // const isVoteButtonEnabled = await this.voteBtn.isEnabled(); - // await this.voteBtn.click() + } + else { + await this.confirmModalBtn.click() + } } async getDRepNotVoted( 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 469e32a2d..aea5f9c61 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 @@ -106,9 +106,7 @@ test.describe("Temporary DReps", async () => { test.beforeEach(async ({ page, browser }) => { const wallet = await walletManager.popWallet("registeredDRep"); - const tempDRepAuth = await createTempDRepAuth(page, wallet); - dRepPage = await createNewPageWithWallet(browser, { storageState: tempDRepAuth, wallet, @@ -116,32 +114,39 @@ test.describe("Temporary DReps", async () => { }); }); - test("4J. Should include metadata anchor in the vote transaction", async ({}, testInfo) => { + const verifyVoteWithMetadata = async (testInfo: any, useGovToolIPFS: boolean = false) => { test.setTimeout(testInfo.timeout + environments.txTimeOut); - + const govActionsPage = new GovernanceActionsPage(dRepPage); await govActionsPage.goto(); - + const govActionDetailsPage = await govActionsPage.viewFirstProposal(); - - const fakerContext = faker.lorem.sentence(200) - await govActionDetailsPage.vote(fakerContext); - - await dRepPage.reload();1 - await dRepPage.waitForTimeout(5_000);1 - + const fakerContext = faker.lorem.sentence(200); + + if (useGovToolIPFS) { + await govActionDetailsPage.vote(fakerContext, false, true); + } else { + await govActionDetailsPage.vote(fakerContext); + } + + await dRepPage.reload(); + await dRepPage.waitForTimeout(5_000); await govActionsPage.votedTab.click(); - const votedGovActionDetailsPage = await govActionsPage.viewFirstVotedProposal(); - - await votedGovActionDetailsPage.currentPage.getByTestId("show-more-button").click() - - await votedGovActionDetailsPage.currentPage.waitForTimeout(2000) - - const voteRationaleContext = await votedGovActionDetailsPage.currentPage.getByTestId("vote-rationale-context") + const votedGovActionDetailsPage = await govActionsPage.viewFirstVotedProposal(); + await votedGovActionDetailsPage.currentPage.getByTestId("show-more-button").click(); + await votedGovActionDetailsPage.currentPage.waitForTimeout(2000); + const voteRationaleContext = await votedGovActionDetailsPage.currentPage.getByTestId("vote-rationale-context"); await expect(voteRationaleContext).toContainText(fakerContext); + }; + + test("4J. Should include metadata anchor in the vote transaction (Download and store yourself)", async ({}, testInfo) => { + await verifyVoteWithMetadata(testInfo, false); + }); + test("4k. Should include metadata anchor in the vote transaction (GovTool pins data to IPFS)", async ({}, testInfo) => { + await verifyVoteWithMetadata(testInfo, true); }); }); From 177106d33f266a3eadb6ac993b896e9311a65688 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Mon, 11 Aug 2025 13:38:57 +0545 Subject: [PATCH 4/7] chore: increase wallet generation count --- tests/govtool-frontend/playwright/tests/dRep.setup.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/tests/dRep.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.setup.ts index 584120038..c6b022822 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.setup.ts @@ -12,9 +12,10 @@ import kuberService from "@services/kuberService"; import walletManager from "lib/walletManager"; import { functionWaitedAssert } from "@helpers/waitedLoop"; import { StaticWallet } from "@types"; +import { Logger } from "@helpers/logger"; const REGISTER_DREP_WALLETS_COUNT = 6; -const DREP_WALLETS_COUNT = 10; +const DREP_WALLETS_COUNT = 11; let dRepDeposit: number; @@ -73,6 +74,10 @@ setup("Register DRep of static wallets", async () => { }); setup("Setup temporary DRep wallets", async () => { + + Logger.info("KUBER API KEY") + Logger.info(process.env.KUBER_API_KEY) + const totalRequiredBalanceForDRepSetup = (DREP_WALLETS_COUNT + REGISTER_DREP_WALLETS_COUNT) * (dRepDeposit / 1000000 + 22); From e2d8e4b2f7c5d189cfa3011a26c74a21a14f6751 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Tue, 12 Aug 2025 11:35:26 +0545 Subject: [PATCH 5/7] chore: remove logs --- tests/govtool-frontend/playwright/tests/dRep.setup.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/govtool-frontend/playwright/tests/dRep.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.setup.ts index c6b022822..47d4f1647 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.setup.ts @@ -75,9 +75,6 @@ setup("Register DRep of static wallets", async () => { setup("Setup temporary DRep wallets", async () => { - Logger.info("KUBER API KEY") - Logger.info(process.env.KUBER_API_KEY) - const totalRequiredBalanceForDRepSetup = (DREP_WALLETS_COUNT + REGISTER_DREP_WALLETS_COUNT) * (dRepDeposit / 1000000 + 22); From 8b5e2848fcc4c23d0642d5734a34a4cf27b26c40 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Tue, 12 Aug 2025 13:08:29 +0545 Subject: [PATCH 6/7] fix: add proper proposal load page await --- .../lib/pages/governanceActionsPage.ts | 23 +++++++++++++++---- .../dRepRegistration.dRep.spec.ts | 14 ++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index d096b2965..8d269076f 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -55,9 +55,9 @@ export default class GovernanceActionsPage { async viewFirstProposalByGovernanceAction( governanceAction: GovernanceActionType ): Promise { - const proposalCard = this.page - .getByTestId(`govaction-${governanceAction}-card`) - .first(); + const proposalCard = this.page + .locator('[data-testid^="govaction-"][data-testid$="-card"]') + .first(); const isVisible = await proposalCard.isVisible(); @@ -76,6 +76,21 @@ export default class GovernanceActionsPage { } } + async getFirstProposal( + governanceAction: GovernanceActionType + ) { + await functionWaitedAssert( + async () => { + const proposalCard = this.page + .locator('[data-testid^="govaction-"][data-testid$="-card"]') + .first(); + + await expect(proposalCard + .locator('[data-testid^="govaction-"][data-testid$="-view-detail"]') + .first()).toBeVisible() + }, { name: "Retrying to get the first proposal" }); + } + async viewVotedProposal( proposal: IProposal ): Promise { @@ -122,7 +137,7 @@ export default class GovernanceActionsPage { expect( hasFilter, hasFilter == false && - `A proposal card does not contain any of the ${filters}` + `A proposal card does not contain any of the ${filters}` ).toBe(true); } } diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts index 1e1bdcbfa..63287bce7 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts @@ -42,18 +42,12 @@ test.describe("Logged in DReps", () => { timeout: 60_000, }); - await expect( - page.getByTestId("dRep-id-display-card-dashboard") - ).toContainText(dRep01Wallet.dRepId, { timeout: 60_000 }); - + const governanceActionsPage = new GovernanceActionsPage(page); - + await governanceActionsPage.goto(); - - await expect(page.getByText(/info action/i).first()).toBeVisible({ - timeout: 60_000, - }); - + + await governanceActionsPage.getFirstProposal(GovernanceActionType.InfoAction); const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( GovernanceActionType.InfoAction From c770507713de58a64102b0de71d8353efac40ec3 Mon Sep 17 00:00:00 2001 From: joseph rana Date: Tue, 12 Aug 2025 15:04:11 +0545 Subject: [PATCH 7/7] fix: update outdated vote context related tests --- .../lib/pages/governanceActionDetailsPage.ts | 2 +- .../lib/pages/governanceActionsPage.ts | 1 - .../dRepRegistration.dRep.spec.ts | 2 +- .../proposalFunctionality.dRep.spec.ts | 47 ++++++++----------- 4 files changed, 22 insertions(+), 30 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts index 17d51f302..2dea0a34f 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionDetailsPage.ts @@ -21,7 +21,6 @@ export default class GovernanceActionDetailsPage { readonly externalModalBtn = this.page.getByTestId("external-modal-button"); readonly governanceActionId = this.page.getByText("Governance Action ID:"); - readonly contextBtn = this.page.getByTestId("provide-context-button"); readonly metadataDownloadBtn = this.page.getByTestId( "metadata-download-button" ); @@ -172,5 +171,6 @@ export default class GovernanceActionDetailsPage { async reVote() { await this.noVoteRadio.click(); await this.changeVoteBtn.click(); + await this.confirmModalBtn.click(); } } diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index 8d269076f..132b22479 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -77,7 +77,6 @@ export default class GovernanceActionsPage { } async getFirstProposal( - governanceAction: GovernanceActionType ) { await functionWaitedAssert( async () => { diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts index 63287bce7..3d37d3733 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts @@ -47,7 +47,7 @@ test.describe("Logged in DReps", () => { await governanceActionsPage.goto(); - await governanceActionsPage.getFirstProposal(GovernanceActionType.InfoAction); + await governanceActionsPage.getFirstProposal(); const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( GovernanceActionType.InfoAction 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 eb805f417..e41b0def9 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 @@ -72,7 +72,6 @@ test.describe("Proposal checks", () => { currentPage.getByTestId(`${cip129GovActionId}-id`) ).toBeVisible(); - await expect(govActionDetailsPage.contextBtn).toBeVisible(); await expect(govActionDetailsPage.showVotesBtn).toBeVisible(); await expect(govActionDetailsPage.voteBtn).toBeVisible(); @@ -87,12 +86,12 @@ test.describe("Proposal checks", () => { await expect(govActionDetailsPage.noVoteRadio).toBeVisible(); await expect(govActionDetailsPage.abstainRadio).toBeVisible(); - await govActionDetailsPage.contextBtn.click(); + await govActionDetailsPage.yesVoteRadio.click(); + await govActionDetailsPage.voteBtn.click(); await expect(govActionDetailsPage.contextInput).toBeVisible(); await govActionDetailsPage.cancelModalBtn.click(); - await govActionDetailsPage.yesVoteRadio.click(); await expect(govActionDetailsPage.voteBtn).toBeEnabled(); }); @@ -100,7 +99,9 @@ test.describe("Proposal checks", () => { const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; test("5D_1. Should accept valid data in provide context", async () => { - await govActionDetailsPage.contextBtn.click(); + + await govActionDetailsPage.yesVoteRadio.click() + await govActionDetailsPage.voteBtn.click() await expect(govActionDetailsPage.contextInput).toBeVisible(); @@ -119,7 +120,8 @@ test.describe("Proposal checks", () => { }); test("5D_2. Should reject invalid data in provide context", async () => { - await govActionDetailsPage.contextBtn.click(); + await govActionDetailsPage.yesVoteRadio.click() + await govActionDetailsPage.voteBtn.click() await expect(govActionDetailsPage.contextInput).toBeVisible(); @@ -245,32 +247,23 @@ test.describe("Perform voting", () => { ).toBeVisible(); govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal(); - await govActionDetailsPage.vote(faker.lorem.sentence(200), true); + + const fakerContext = faker.lorem.sentence(200) + await govActionDetailsPage.vote(fakerContext, true); await govActionDetailsPage.currentPage.reload(); await governanceActionsPage.votedTab.click(); - const isYesVoteVisible = await govActionDetailsPage.currentPage - .getByTestId("my-vote") - .getByText("Yes") - .isVisible(); - - const textContent = await govActionDetailsPage.currentPage - .getByTestId("my-vote") - .textContent(); - - await govActionDetailsPage.currentPage.evaluate(() => - window.scrollTo(0, 500) - ); - await expect( - govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("Yes"), - { - message: - !isYesVoteVisible && - `"Yes" vote not visible, current vote status: ${textContent.match(/My Vote:(Yes|No)/)[1]}`, - } - ).toBeVisible({ timeout: 60_000 }); + govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal(); + + await govActionDetailsPage.currentPage.getByTestId("yes-radio").isVisible(); + + await govActionDetailsPage.currentPage.getByTestId("show-more-button").click(); + await govActionDetailsPage.currentPage.waitForTimeout(2000); + + const voteRationaleContext = await govActionDetailsPage.currentPage.getByTestId("vote-rationale-context"); + await expect(voteRationaleContext).toContainText(fakerContext); }); test("5I. Should view the vote details,when viewing governance action already voted by the DRep", async ({}, testInfo) => { @@ -282,7 +275,7 @@ test.describe("Perform voting", () => { govActionDetailsPage.currentPage ); - await governanceActionsPage.currentPage.waitForTimeout(5_000); + await governanceActionsPage.getFirstProposal(); await governanceActionsPage.votedTab.click(); await expect(