From 3406fa5d4b9de611cf4dc0492a262bbd53ef0a6e Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 20:11:12 +0545 Subject: [PATCH 1/5] fix: use first dRep-eligible governance action in dRep vote dependent tests --- .../lib/pages/governanceActionsPage.ts | 20 ++++++++++++++++++- .../proposalVisibility.dRep.spec.ts | 2 +- .../proposalFunctionality.dRep.spec.ts | 4 ++-- .../proposalSubmission.loggedin.spec.ts | 9 +++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index e12e92e0..357148bd 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -1,6 +1,10 @@ import removeAllSpaces from "@helpers/removeAllSpaces"; import { Locator, Page, expect } from "@playwright/test"; -import { GrovernanceActionType, IProposal } from "@types"; +import { + FullGovernanceDRepVoteActionsType, + GrovernanceActionType, + IProposal, +} from "@types"; import environments from "lib/constants/environments"; import GovernanceActionDetailsPage from "./governanceActionDetailsPage"; import { getEnumKeyByValue } from "@helpers/enum"; @@ -47,6 +51,20 @@ export default class GovernanceActionsPage { return new GovernanceActionDetailsPage(this.page); } + async viewFirstDRepVoteEnabledGovernanceAction(): Promise { + for (const governanceAction of Object.keys( + FullGovernanceDRepVoteActionsType + )) { + const result = await this.viewFirstProposalByGovernanceAction( + governanceAction as GrovernanceActionType + ); + if (result) { + return result; + } + } + return null; + } + async viewFirstProposalByGovernanceAction( governanceAction: GrovernanceActionType ): Promise { 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 c4d2afbe..e30394e6 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 @@ -61,7 +61,7 @@ test.describe("Logged in DRep", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); await govActionDetailsPage.contextBtn.click(); await govActionDetailsPage.contextInput.fill(faker.lorem.sentence(200)); 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 a801a334..35990b36 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", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); test("5A. Should show relevant details about governance action as DRep", async () => { @@ -185,7 +185,7 @@ test.describe("Perform voting", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); test("5E. Should re-vote with new data on a already voted governance action", async ({}, testInfo) => { 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 b96e5e2d..b61e6e3c 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 @@ -9,7 +9,10 @@ import { import { faker } from "@faker-js/faker"; import { test } from "@fixtures/proposal"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfTreasuryAndBootstrapping, skipIfNotHardFork } from "@helpers/cardano"; +import { + skipIfTreasuryAndBootstrapping, + skipIfNotHardFork, +} from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { createNewPageWithWallet } from "@helpers/page"; import { invalid, valid as mockValid } from "@mock/index"; @@ -261,7 +264,9 @@ test.describe("Proposal created logged state", () => { }) => { test.slow(); // Brute-force testing with 100 random data for (let i = 0; i < 50; i++) { - await proposalSubmissionPage.metadataUrlInput.fill(invalid.url(false)); + await proposalSubmissionPage.metadataUrlInput.fill( + invalid.url(false) + ); await expect(page.getByTestId("url-input-error-text")).toBeVisible(); } From 99f8f065231c9cc24fb7ae9780474e9a5931abca Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 12:48:38 +0545 Subject: [PATCH 2/5] fix: parallelize bootstrap dRep vote tests and improve visibility checks --- .../proposalFunctionality.dRep.spec.ts | 117 ++++++++---------- 1 file changed, 51 insertions(+), 66 deletions(-) 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 35990b36..08cf5c71 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 @@ -271,77 +271,62 @@ test.describe("Check voting power", () => { }); test.describe("Bootstrap phase", () => { - test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet }); test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ - page, - context, + browser, }) => { - await page.route("**/epoch/params", async (route) => { - // Fetch the original response from the server - const response = await route.fetch(); - const json = await response.json(); - - // update protocol major version - json["protocol_major"] = 9; - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify(json), - }); - }); - const voteBlacklistOptions = Object.keys(GrovernanceActionType).filter( (option) => option !== BootstrapGovernanceActionType.InfoAction ); - const govActionsPage = new GovernanceActionsPage(page); - await govActionsPage.goto(); - - // wait until the loading button is hidden - await expect( - page.getByRole("progressbar").getByRole("img") - ).not.toBeVisible({ timeout: 10_000 }); - - for (const voteBlacklistOption of voteBlacklistOptions) { - const governanceActionDetailsPage = - await govActionsPage.viewFirstProposalByGovernanceAction( - voteBlacklistOption as GrovernanceActionType - ); - - if (governanceActionDetailsPage !== null) { - // dRep vote - await expect(governanceActionDetailsPage.dRepYesVotes).toBeVisible(); - await expect( - governanceActionDetailsPage.dRepAbstainVotes - ).toBeVisible(); - await expect(governanceActionDetailsPage.dRepNoVotes).toBeVisible(); - - // sPos vote - await expect(governanceActionDetailsPage.sPosYesVotes).toBeVisible(); - await expect( - governanceActionDetailsPage.sPosAbstainVotes - ).toBeVisible(); - await expect(governanceActionDetailsPage.sPosNoVotes).toBeVisible(); - - // ccCommittee vote - await expect( - governanceActionDetailsPage.ccCommitteeYesVotes - ).toBeVisible(); - await expect( - governanceActionDetailsPage.ccCommitteeAbstainVotes - ).toBeVisible(); - await expect( - governanceActionDetailsPage.ccCommitteeNoVotes - ).toBeVisible(); - - await expect( - governanceActionDetailsPage.yesVoteRadio - ).not.toBeVisible(); - await expect(governanceActionDetailsPage.contextBtn).not.toBeVisible(); - await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible(); - - await governanceActionDetailsPage.backBtn.click(); - } - } + await Promise.all( + voteBlacklistOptions.map(async (voteBlacklistOption) => { + const dRepPage = await createNewPageWithWallet(browser, { + storageState: ".auth/dRep01.json", + wallet: dRep01Wallet, + }); + + await dRepPage.route("**/epoch/params", async (route) => { + // Fetch the original response from the server + const response = await route.fetch(); + const json = await response.json(); + + // update protocol major version + json["protocol_major"] = 9; + await route.fulfill({ + status: 200, + contentType: "application/json", + body: JSON.stringify(json), + }); + }); + + const governanceActionsPage = new GovernanceActionsPage(dRepPage); + await governanceActionsPage.goto(); + + // assert to wait until proposal cards are visible + await expect(dRepPage.getByTestId("voting-power-chips")).toBeVisible(); + // wait until the loading button is hidden + await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + + const governanceActionDetailsPage = + await governanceActionsPage.viewFirstProposalByGovernanceAction( + voteBlacklistOption as GrovernanceActionType + ); + + if (governanceActionDetailsPage) { + await expect( + dRepPage.getByTestId("governance-action-details-card-header") + ).toBeVisible(); + await expect( + governanceActionDetailsPage.yesVoteRadio + ).not.toBeVisible(); + await expect( + governanceActionDetailsPage.contextBtn + ).not.toBeVisible(); + await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible(); + } + }) + ); }); }); From cb148f59df634afa0917e7604a88b49914318625 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 12:54:26 +0545 Subject: [PATCH 3/5] chore: remove unnecessary async from areCCVoteTotalsDisplayed --- tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts index 6169bfcf..94781e4c 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts @@ -45,7 +45,7 @@ export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { ); }; -export const areCCVoteTotalsDisplayed = async ( +export const areCCVoteTotalsDisplayed = ( governanceActionType: GrovernanceActionType ) => { return ![ From 368e4486e128116055aafd93e1b5ad3b6e41aa07 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 13:47:34 +0545 Subject: [PATCH 4/5] fix: governance action type typo --- .../playwright/lib/helpers/featureFlag.ts | 28 +++++++++---------- .../lib/pages/governanceActionsPage.ts | 12 ++++---- .../govtool-frontend/playwright/lib/types.ts | 2 +- .../dRepRegistration.dRep.spec.ts | 6 ++-- .../proposalVisibility.dRep.spec.ts | 8 ++---- .../proposalVisibility.spec.ts | 8 +++--- .../proposalFunctionality.dRep.spec.ts | 10 +++---- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts index 94781e4c..0a6f1576 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts @@ -1,4 +1,4 @@ -import { GrovernanceActionType, IProposal } from "@types"; +import { GovernanceActionType, IProposal } from "@types"; import { isBootStrapingPhase } from "./cardano"; import { SECURITY_RELEVANT_PARAMS_MAP } from "@constants/index"; @@ -12,17 +12,17 @@ export const areDRepVoteTotalsDisplayed = async (proposal: IProposal) => { ); if (isInBootstrapPhase) { return !( - proposal.type === GrovernanceActionType.HardFork || - (proposal.type === GrovernanceActionType.ProtocolParameterChange && + proposal.type === GovernanceActionType.HardFork || + (proposal.type === GovernanceActionType.ProtocolParameterChange && !isSecurityGroup) ); } return ![ - GrovernanceActionType.NoConfidence, - GrovernanceActionType.NewCommittee, - GrovernanceActionType.UpdatetotheConstitution, - ].includes(proposal.type as GrovernanceActionType); + GovernanceActionType.NoConfidence, + GovernanceActionType.NewCommittee, + GovernanceActionType.UpdatetotheConstitution, + ].includes(proposal.type as GovernanceActionType); }; export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { @@ -34,22 +34,22 @@ export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { ] !== null ); if (isInBootstrapPhase) { - return proposal.type !== GrovernanceActionType.ProtocolParameterChange; + return proposal.type !== GovernanceActionType.ProtocolParameterChange; } return !( - proposal.type === GrovernanceActionType.UpdatetotheConstitution || - proposal.type === GrovernanceActionType.TreasuryWithdrawal || - (proposal.type === GrovernanceActionType.ProtocolParameterChange && + proposal.type === GovernanceActionType.UpdatetotheConstitution || + proposal.type === GovernanceActionType.TreasuryWithdrawal || + (proposal.type === GovernanceActionType.ProtocolParameterChange && !isSecurityGroup) ); }; export const areCCVoteTotalsDisplayed = ( - governanceActionType: GrovernanceActionType + governanceActionType: GovernanceActionType ) => { return ![ - GrovernanceActionType.NoConfidence, - GrovernanceActionType.NewCommittee, + GovernanceActionType.NoConfidence, + GovernanceActionType.NewCommittee, ].includes(governanceActionType); }; diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index 357148bd..1bbb6917 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -2,7 +2,7 @@ import removeAllSpaces from "@helpers/removeAllSpaces"; import { Locator, Page, expect } from "@playwright/test"; import { FullGovernanceDRepVoteActionsType, - GrovernanceActionType, + GovernanceActionType, IProposal, } from "@types"; import environments from "lib/constants/environments"; @@ -56,7 +56,7 @@ export default class GovernanceActionsPage { FullGovernanceDRepVoteActionsType )) { const result = await this.viewFirstProposalByGovernanceAction( - governanceAction as GrovernanceActionType + governanceAction as GovernanceActionType ); if (result) { return result; @@ -66,7 +66,7 @@ export default class GovernanceActionsPage { } async viewFirstProposalByGovernanceAction( - governanceAction: GrovernanceActionType + governanceAction: GovernanceActionType ): Promise { const proposalCard = this.page .getByTestId(`govaction-${governanceAction}-card`) @@ -139,7 +139,7 @@ export default class GovernanceActionsPage { async sortAndValidate( sortOption: string, validationFn: (p1: IProposal, p2: IProposal) => boolean, - filterKeys = Object.keys(GrovernanceActionType) + filterKeys = Object.keys(GovernanceActionType) ) { const responsesPromise = Promise.all( filterKeys.map((filterKey) => @@ -147,7 +147,7 @@ export default class GovernanceActionsPage { response .url() .includes( - `&type[]=${GrovernanceActionType[filterKey]}&sort=${sortOption}` + `&type[]=${GovernanceActionType[filterKey]}&sort=${sortOption}` ) ) ) @@ -183,7 +183,7 @@ export default class GovernanceActionsPage { for (let dIdx = 0; dIdx <= proposalsByType.length - 1; dIdx++) { const proposals = proposalsByType[0] as IProposal[]; const filterOptionKey = getEnumKeyByValue( - GrovernanceActionType, + GovernanceActionType, proposals[0].type ); diff --git a/tests/govtool-frontend/playwright/lib/types.ts b/tests/govtool-frontend/playwright/lib/types.ts index 2bde6027..b20caf09 100644 --- a/tests/govtool-frontend/playwright/lib/types.ts +++ b/tests/govtool-frontend/playwright/lib/types.ts @@ -74,7 +74,7 @@ export enum ProposalType { treasury = "Treasury", } -export enum GrovernanceActionType { +export enum GovernanceActionType { ProtocolParameterChange = "ParameterChange", InfoAction = "InfoAction", TreasuryWithdrawal = "TreasuryWithdrawals", 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 d4842d6b..9f593c00 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 @@ -13,7 +13,7 @@ import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect } from "@playwright/test"; import walletManager from "lib/walletManager"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; -import { GrovernanceActionType } from "@types"; +import { GovernanceActionType } from "@types"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); @@ -37,12 +37,12 @@ test.describe("Logged in DReps", () => { const governanceActionsPage = new GovernanceActionsPage(page); await governanceActionsPage.goto(); - + await expect(page.getByText(/info action/i).first()).toBeVisible(); const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ); await expect(governanceActionDetailsPage.voteBtn).toBeVisible(); 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 e30394e6..ecb7f1ba 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 @@ -16,7 +16,7 @@ import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; import { BootstrapGovernanceActionType, FullGovernanceDRepVoteActionsType, - GrovernanceActionType, + GovernanceActionType, IProposal, } from "@types"; import walletManager from "lib/walletManager"; @@ -59,7 +59,7 @@ test.describe("Logged in DRep", () => { govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); @@ -207,9 +207,7 @@ test.describe("Check vote count", () => { // check ccCommittee votes if ( - areCCVoteTotalsDisplayed( - proposalToCheck.type as GrovernanceActionType - ) + areCCVoteTotalsDisplayed(proposalToCheck.type as GovernanceActionType) ) { await expect(govActionDetailsPage.ccCommitteeYesVotes).toHaveText( `${proposalToCheck.ccYesVotes}` diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts index 7918dc96..8b08c93c 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts @@ -9,7 +9,7 @@ import { import GovernanceActionDetailsPage from "@pages/governanceActionDetailsPage"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect, test } from "@playwright/test"; -import { GrovernanceActionType, IProposal } from "@types"; +import { GovernanceActionType, IProposal } from "@types"; test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); @@ -39,9 +39,9 @@ test("4K. Should display correct vote counts on governance details page for disc page, browser, }) => { - const responsesPromise = Object.keys(GrovernanceActionType).map((filterKey) => + const responsesPromise = Object.keys(GovernanceActionType).map((filterKey) => page.waitForResponse((response) => - response.url().includes(`&type[]=${GrovernanceActionType[filterKey]}`) + response.url().includes(`&type[]=${GovernanceActionType[filterKey]}`) ) ); @@ -98,7 +98,7 @@ test("4K. Should display correct vote counts on governance details page for disc // check ccCommittee votes if ( - areCCVoteTotalsDisplayed(proposalToCheck.type as GrovernanceActionType) + areCCVoteTotalsDisplayed(proposalToCheck.type as GovernanceActionType) ) { await expect(govActionDetailsPage.ccCommitteeYesVotes).toHaveText( `${proposalToCheck.ccYesVotes}` 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 08cf5c71..0f39ea31 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 @@ -12,7 +12,7 @@ import GovernanceActionDetailsPage from "@pages/governanceActionDetailsPage"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { Page, expect } from "@playwright/test"; import kuberService from "@services/kuberService"; -import { BootstrapGovernanceActionType, GrovernanceActionType } from "@types"; +import { BootstrapGovernanceActionType, GovernanceActionType } from "@types"; import walletManager from "lib/walletManager"; const invalidInfinityProposals = require("../../lib/_mock/invalidInfinityProposals.json"); @@ -35,7 +35,7 @@ test.describe("Proposal checks", () => { currentPage = page; govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); @@ -183,7 +183,7 @@ test.describe("Perform voting", () => { govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); @@ -274,7 +274,7 @@ test.describe("Bootstrap phase", () => { test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ browser, }) => { - const voteBlacklistOptions = Object.keys(GrovernanceActionType).filter( + const voteBlacklistOptions = Object.keys(GovernanceActionType).filter( (option) => option !== BootstrapGovernanceActionType.InfoAction ); @@ -311,7 +311,7 @@ test.describe("Bootstrap phase", () => { const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( - voteBlacklistOption as GrovernanceActionType + voteBlacklistOption as GovernanceActionType ); if (governanceActionDetailsPage) { From 20665aec2a04ac04b992dd0139e3e311978729d1 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 14:18:12 +0545 Subject: [PATCH 5/5] chore: add assertion on governance list to wait until loading button is hidden --- .../proposalVisibility.dRep.spec.ts | 5 +++++ .../proposalFunctionality.dRep.spec.ts | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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 ecb7f1ba..c066337f 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 @@ -57,6 +57,11 @@ test.describe("Logged in DRep", () => { const govActionsPage = new GovernanceActionsPage(page); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(page.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.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 0f39ea31..989f9e66 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 @@ -32,6 +32,11 @@ test.describe("Proposal checks", () => { const govActionsPage = new GovernanceActionsPage(page); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(page.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + currentPage = page; govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( @@ -181,6 +186,11 @@ test.describe("Perform voting", () => { const govActionsPage = new GovernanceActionsPage(dRepPage); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( GovernanceActionType.InfoAction @@ -211,7 +221,7 @@ test.describe("Perform voting", () => { await expect( govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("No") - ).toBeVisible(); + ).toBeVisible({ timeout: 15_000 }); }); test("5F. Should show notification of casted vote after vote", async ({}, testInfo) => {