From e792251fd91538532542c1172c4563196541558c Mon Sep 17 00:00:00 2001 From: kneerose Date: Tue, 15 Jul 2025 15:53:59 +0545 Subject: [PATCH] chore: disable hardfork proposal test --- .../govtool-frontend/playwright/.env.example | 2 ++ .../playwright/lib/constants/environments.ts | 2 ++ .../playwright/lib/helpers/index.ts | 19 ++++++++++++++ .../lib/pages/proposalSubmissionPage.ts | 5 ++-- .../proposalSubmission.ga.spec.ts | 4 +-- .../proposalSubmission.loggedin.pd.spec.ts | 26 ++++++++----------- .../proposalDiscussion.spec.ts | 7 +++-- .../playwright/tests/proposal.setup.ts | 7 +++-- 8 files changed, 47 insertions(+), 25 deletions(-) diff --git a/tests/govtool-frontend/playwright/.env.example b/tests/govtool-frontend/playwright/.env.example index c68929567..b2d1e6c52 100644 --- a/tests/govtool-frontend/playwright/.env.example +++ b/tests/govtool-frontend/playwright/.env.example @@ -20,5 +20,7 @@ FAUCET_ADDRESS= FAUCET_PAYMENT_PRIVATE= FAUCET_STAKE_PRIVATE= +IS_HARDFORK_PROPOSAL_ENABLED=false + CI=true TEST_WORKERS=6 // Number of workers to run in parallel \ No newline at end of file diff --git a/tests/govtool-frontend/playwright/lib/constants/environments.ts b/tests/govtool-frontend/playwright/lib/constants/environments.ts index c382c358b..8c1563d30 100644 --- a/tests/govtool-frontend/playwright/lib/constants/environments.ts +++ b/tests/govtool-frontend/playwright/lib/constants/environments.ts @@ -34,6 +34,8 @@ const environments = { (process.env.SCHEDULED_WORKFLOW && process.env.SCHEDULED_WORKFLOW == "true") || false, + isHardforkProposalEnabled: + process.env.IS_HARDFORK_PROPOSAL_ENABLED === "true" || false, }; export default environments; diff --git a/tests/govtool-frontend/playwright/lib/helpers/index.ts b/tests/govtool-frontend/playwright/lib/helpers/index.ts index 86fc90cc3..56c16331a 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/index.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/index.ts @@ -1,4 +1,5 @@ import environments from "@constants/environments"; +import { ProposalType } from "@types"; export const parseVotingPowerAndPercentage = ( combinedString: string ): { votingPower: string; percentage: string } => { @@ -27,3 +28,21 @@ export const getWalletConfigForFaucet = () => { address: environments.faucet.address || "", }; }; + + +export const getProposalType = () => { + return Object.values(ProposalType).filter( + (type) => + !( + environments.isHardforkProposalEnabled === false && + type === ProposalType.hardFork + ) + ); +}; + +export const getProposalWalletCount = (): number => { + if (environments.isScheduled) { + return 1; + } + return environments.isHardforkProposalEnabled ? 6 : 5; +}; \ No newline at end of file diff --git a/tests/govtool-frontend/playwright/lib/pages/proposalSubmissionPage.ts b/tests/govtool-frontend/playwright/lib/pages/proposalSubmissionPage.ts index a7c327f93..94874ee50 100644 --- a/tests/govtool-frontend/playwright/lib/pages/proposalSubmissionPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/proposalSubmissionPage.ts @@ -5,6 +5,7 @@ import { faker } from "@faker-js/faker"; import { isBootStrapingPhase } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { expectWithInfo } from "@helpers/exceptionHandler"; +import { getProposalType } from "@helpers/index"; import { downloadMetadata, uploadScriptAndGenerateUrl, @@ -615,8 +616,8 @@ export default class ProposalSubmissionPage { async createProposal( receivingAddress: string, - proposalType: ProposalType = Object.values(ProposalType)[ - Math.floor(Math.random() * Object.values(ProposalType).length) + proposalType: ProposalType = getProposalType()[ + Math.floor(Math.random() * getProposalType().length) ] ): Promise { await this.addLinkBtn.click(); 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 7cd57efc1..e45681fde 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 @@ -16,7 +16,7 @@ import { ProposalType } from "@types"; import walletManager from "lib/walletManager"; import { valid as mockValid, invalid as mockInvalid } from "@mock/index"; import { rewardAddressBech32 } from "@helpers/shellyWallet"; -import { getWalletConfigForFaucet } from "@helpers/index"; +import { getProposalType, getWalletConfigForFaucet } from "@helpers/index"; import { faker } from "@faker-js/faker"; import { proposalSubmissionAuthFile } from "@constants/auth"; import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage"; @@ -28,7 +28,7 @@ test.beforeEach(async () => { await skipIfTemporyWalletIsNotAvailable("proposalSubmissionWallets.json"); }); -Object.values(ProposalType).forEach((proposalType, index) => { +getProposalType().forEach((proposalType, index) => { test(`7H_${index + 1}. Should submit a ${proposalType.toLocaleLowerCase()} proposal as governance action`, async ({ page, browser, diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts index 879d01beb..ad227a7de 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts @@ -21,6 +21,7 @@ import { skipIfMainnet, } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; +import { getProposalType } from "@helpers/index"; import { createNewPageWithWallet } from "@helpers/page"; import { rewardAddressBech32 } from "@helpers/shellyWallet"; import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage"; @@ -42,12 +43,13 @@ test.describe("Proposal created logged state", () => { }); test.describe("Accept valid data", () => { - Object.values(ProposalType).map((type: ProposalType, index) => { + getProposalType().map((type: ProposalType, index) => { test(`7E_${index + 1}. Should accept valid data in ${type.toLowerCase()} proposal form`, async ({ page, }) => { await skipIfNotInfoAndBootstrapping(type); + test.slow(); // Brute-force testing with 50 random data const proposalSubmissionPage = new ProposalSubmissionPage(page); @@ -99,7 +101,7 @@ test.describe("Proposal created logged state", () => { }); test.describe("Reject invalid data", () => { - Object.values(ProposalType).map((type: ProposalType, index) => { + getProposalType().map((type: ProposalType, index) => { test(`7F_${index + 1}. Should reject invalid data in ${type.toLowerCase()} Proposal form`, async ({ page, }) => { @@ -128,7 +130,7 @@ test.describe("Proposal created logged state", () => { }); test.describe("Create a proposal with proper data", () => { - Object.values(ProposalType).map((type: ProposalType, index) => { + getProposalType().map((type: ProposalType, index) => { test(`7G_${index + 1}. Should create a proposal with proper ${type.toLowerCase()} data`, async ({ page, wallet, @@ -203,7 +205,7 @@ test.describe("Proposal created logged state", () => { }); test.describe("Review fillup form", () => { - Object.values(ProposalType).map((type: ProposalType, index) => { + getProposalType().map((type: ProposalType, index) => { test(`7I_${index + 1}. Should valid review submission in ${type.toLowerCase()} Proposal form`, async ({ page, }) => { @@ -278,7 +280,7 @@ test.describe("Proposal created logged state", () => { }); test.describe("Verify Proposal form", () => { - Object.values(ProposalType).map((type: ProposalType, index) => { + getProposalType().map((type: ProposalType, index) => { test(`7D_${index + 1}. Verify ${type.toLocaleLowerCase()} proposal form`, async ({ page, }) => { @@ -378,9 +380,7 @@ test.describe("Proposal Draft", () => { }); const proposalSubmissionPage = new ProposalSubmissionPage(page); const proposalType = - Object.values(ProposalType)[ - Math.floor(Math.random() * Object.values(ProposalType).length) - ]; + getProposalType()[Math.floor(Math.random() * getProposalType().length)]; await proposalSubmissionPage.createDraft(proposalType); const getAllDrafts = await proposalSubmissionPage.getAllDrafts(); @@ -395,9 +395,7 @@ test.describe("Proposal Draft", () => { }); const proposalType = - Object.values(ProposalType)[ - Math.floor(Math.random() * Object.values(ProposalType).length) - ]; + getProposalType()[Math.floor(Math.random() * getProposalType().length)]; const proposalSubmissionPage = new ProposalSubmissionPage(page); const createProposalType = (await isBootStrapingPhase()) @@ -470,7 +468,7 @@ test.describe("Proposal Draft", () => { ); }); - Object.values(ProposalType).map((proposalType, index) => { + getProposalType().map((proposalType, index) => { test(`7M_${index + 1}. Should edit a ${proposalType.toLowerCase()} proposal draft`, async ({ browser, }) => { @@ -567,9 +565,7 @@ test.describe("Proposal Draft", () => { test.slow(); const proposalType = - Object.values(ProposalType)[ - Math.floor(Math.random() * Object.values(ProposalType).length) - ]; + getProposalType()[Math.floor(Math.random() * getProposalType().length)]; const proposalSubmissionPage = new ProposalSubmissionPage(page); const { proposalFormValue } = 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 011627afa..babf72fce 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 @@ -7,6 +7,7 @@ import { faker } from "@faker-js/faker"; import { test } from "@fixtures/proposal"; import { setAllureEpic } from "@helpers/allure"; import { isBootStrapingPhase } from "@helpers/cardano"; +import { getProposalType } from "@helpers/index"; import { injectLogger } from "@helpers/page"; import { extractProposalIdFromUrl } from "@helpers/string"; import { functionWaitedAssert } from "@helpers/waitedLoop"; @@ -55,9 +56,7 @@ test.describe("Filter and sort proposals", () => { // proposal type filter await proposalDiscussionPage.applyAndValidateFilters( - isBootStraping - ? BOOTSTRAP_PROPOSAL_TYPE_FILTERS - : Object.values(ProposalType), + isBootStraping ? BOOTSTRAP_PROPOSAL_TYPE_FILTERS : getProposalType(), proposalDiscussionPage._validateTypeFiltersInProposalCard ); @@ -171,7 +170,7 @@ test("8D. Should show the view-all categorized proposed governance actions.", as browser, }) => { await Promise.all( - Object.values(ProposalType).map(async (proposalType: string) => { + getProposalType().map(async (proposalType: string) => { const context = await browser.newContext(); const page = await context.newPage(); injectLogger(page); diff --git a/tests/govtool-frontend/playwright/tests/proposal.setup.ts b/tests/govtool-frontend/playwright/tests/proposal.setup.ts index 0c7a714fa..751c6992f 100644 --- a/tests/govtool-frontend/playwright/tests/proposal.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal.setup.ts @@ -7,10 +7,13 @@ import { test as setup } from "@fixtures/walletExtension"; import kuberService from "@services/kuberService"; import walletManager from "lib/walletManager"; import { functionWaitedAssert } from "@helpers/waitedLoop"; -import { getWalletConfigForFaucet } from "@helpers/index"; +import { + getProposalWalletCount, + getWalletConfigForFaucet, +} from "@helpers/index"; import { createKeyFromPrivateKeyHex } from "@helpers/crypto"; -const PROPOSAL_WALLETS_COUNT = environments.isScheduled ? 1 : 6; +const PROPOSAL_WALLETS_COUNT = getProposalWalletCount(); let govActionDeposit: number;