Skip to content

Commit 7a4d396

Browse files
authored
Merge pull request #3891 from IntersectMBO/chore/disable-hardfork-proposal-test
chore: disable hardfork proposal test
2 parents 170e7e7 + e792251 commit 7a4d396

File tree

8 files changed

+47
-25
lines changed

8 files changed

+47
-25
lines changed

tests/govtool-frontend/playwright/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ FAUCET_ADDRESS=
2020
FAUCET_PAYMENT_PRIVATE=
2121
FAUCET_STAKE_PRIVATE=
2222

23+
IS_HARDFORK_PROPOSAL_ENABLED=false
24+
2325
CI=true
2426
TEST_WORKERS=6 // Number of workers to run in parallel

tests/govtool-frontend/playwright/lib/constants/environments.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const environments = {
3434
(process.env.SCHEDULED_WORKFLOW &&
3535
process.env.SCHEDULED_WORKFLOW == "true") ||
3636
false,
37+
isHardforkProposalEnabled:
38+
process.env.IS_HARDFORK_PROPOSAL_ENABLED === "true" || false,
3739
};
3840

3941
export default environments;

tests/govtool-frontend/playwright/lib/helpers/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import environments from "@constants/environments";
2+
import { ProposalType } from "@types";
23
export const parseVotingPowerAndPercentage = (
34
combinedString: string
45
): { votingPower: string; percentage: string } => {
@@ -27,3 +28,21 @@ export const getWalletConfigForFaucet = () => {
2728
address: environments.faucet.address || "",
2829
};
2930
};
31+
32+
33+
export const getProposalType = () => {
34+
return Object.values(ProposalType).filter(
35+
(type) =>
36+
!(
37+
environments.isHardforkProposalEnabled === false &&
38+
type === ProposalType.hardFork
39+
)
40+
);
41+
};
42+
43+
export const getProposalWalletCount = (): number => {
44+
if (environments.isScheduled) {
45+
return 1;
46+
}
47+
return environments.isHardforkProposalEnabled ? 6 : 5;
48+
};

tests/govtool-frontend/playwright/lib/pages/proposalSubmissionPage.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { faker } from "@faker-js/faker";
55
import { isBootStrapingPhase } from "@helpers/cardano";
66
import { ShelleyWallet } from "@helpers/crypto";
77
import { expectWithInfo } from "@helpers/exceptionHandler";
8+
import { getProposalType } from "@helpers/index";
89
import {
910
downloadMetadata,
1011
uploadScriptAndGenerateUrl,
@@ -615,8 +616,8 @@ export default class ProposalSubmissionPage {
615616

616617
async createProposal(
617618
receivingAddress: string,
618-
proposalType: ProposalType = Object.values(ProposalType)[
619-
Math.floor(Math.random() * Object.values(ProposalType).length)
619+
proposalType: ProposalType = getProposalType()[
620+
Math.floor(Math.random() * getProposalType().length)
620621
]
621622
): Promise<number> {
622623
await this.addLinkBtn.click();

tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.ga.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { ProposalType } from "@types";
1616
import walletManager from "lib/walletManager";
1717
import { valid as mockValid, invalid as mockInvalid } from "@mock/index";
1818
import { rewardAddressBech32 } from "@helpers/shellyWallet";
19-
import { getWalletConfigForFaucet } from "@helpers/index";
19+
import { getProposalType, getWalletConfigForFaucet } from "@helpers/index";
2020
import { faker } from "@faker-js/faker";
2121
import { proposalSubmissionAuthFile } from "@constants/auth";
2222
import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage";
@@ -28,7 +28,7 @@ test.beforeEach(async () => {
2828
await skipIfTemporyWalletIsNotAvailable("proposalSubmissionWallets.json");
2929
});
3030

31-
Object.values(ProposalType).forEach((proposalType, index) => {
31+
getProposalType().forEach((proposalType, index) => {
3232
test(`7H_${index + 1}. Should submit a ${proposalType.toLocaleLowerCase()} proposal as governance action`, async ({
3333
page,
3434
browser,

tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
skipIfMainnet,
2222
} from "@helpers/cardano";
2323
import { ShelleyWallet } from "@helpers/crypto";
24+
import { getProposalType } from "@helpers/index";
2425
import { createNewPageWithWallet } from "@helpers/page";
2526
import { rewardAddressBech32 } from "@helpers/shellyWallet";
2627
import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage";
@@ -42,12 +43,13 @@ test.describe("Proposal created logged state", () => {
4243
});
4344

4445
test.describe("Accept valid data", () => {
45-
Object.values(ProposalType).map((type: ProposalType, index) => {
46+
getProposalType().map((type: ProposalType, index) => {
4647
test(`7E_${index + 1}. Should accept valid data in ${type.toLowerCase()} proposal form`, async ({
4748
page,
4849
}) => {
4950
await skipIfNotInfoAndBootstrapping(type);
5051

52+
5153
test.slow(); // Brute-force testing with 50 random data
5254

5355
const proposalSubmissionPage = new ProposalSubmissionPage(page);
@@ -99,7 +101,7 @@ test.describe("Proposal created logged state", () => {
99101
});
100102

101103
test.describe("Reject invalid data", () => {
102-
Object.values(ProposalType).map((type: ProposalType, index) => {
104+
getProposalType().map((type: ProposalType, index) => {
103105
test(`7F_${index + 1}. Should reject invalid data in ${type.toLowerCase()} Proposal form`, async ({
104106
page,
105107
}) => {
@@ -128,7 +130,7 @@ test.describe("Proposal created logged state", () => {
128130
});
129131

130132
test.describe("Create a proposal with proper data", () => {
131-
Object.values(ProposalType).map((type: ProposalType, index) => {
133+
getProposalType().map((type: ProposalType, index) => {
132134
test(`7G_${index + 1}. Should create a proposal with proper ${type.toLowerCase()} data`, async ({
133135
page,
134136
wallet,
@@ -203,7 +205,7 @@ test.describe("Proposal created logged state", () => {
203205
});
204206

205207
test.describe("Review fillup form", () => {
206-
Object.values(ProposalType).map((type: ProposalType, index) => {
208+
getProposalType().map((type: ProposalType, index) => {
207209
test(`7I_${index + 1}. Should valid review submission in ${type.toLowerCase()} Proposal form`, async ({
208210
page,
209211
}) => {
@@ -278,7 +280,7 @@ test.describe("Proposal created logged state", () => {
278280
});
279281

280282
test.describe("Verify Proposal form", () => {
281-
Object.values(ProposalType).map((type: ProposalType, index) => {
283+
getProposalType().map((type: ProposalType, index) => {
282284
test(`7D_${index + 1}. Verify ${type.toLocaleLowerCase()} proposal form`, async ({
283285
page,
284286
}) => {
@@ -378,9 +380,7 @@ test.describe("Proposal Draft", () => {
378380
});
379381
const proposalSubmissionPage = new ProposalSubmissionPage(page);
380382
const proposalType =
381-
Object.values(ProposalType)[
382-
Math.floor(Math.random() * Object.values(ProposalType).length)
383-
];
383+
getProposalType()[Math.floor(Math.random() * getProposalType().length)];
384384
await proposalSubmissionPage.createDraft(proposalType);
385385
const getAllDrafts = await proposalSubmissionPage.getAllDrafts();
386386

@@ -395,9 +395,7 @@ test.describe("Proposal Draft", () => {
395395
});
396396

397397
const proposalType =
398-
Object.values(ProposalType)[
399-
Math.floor(Math.random() * Object.values(ProposalType).length)
400-
];
398+
getProposalType()[Math.floor(Math.random() * getProposalType().length)];
401399

402400
const proposalSubmissionPage = new ProposalSubmissionPage(page);
403401
const createProposalType = (await isBootStrapingPhase())
@@ -470,7 +468,7 @@ test.describe("Proposal Draft", () => {
470468
);
471469
});
472470

473-
Object.values(ProposalType).map((proposalType, index) => {
471+
getProposalType().map((proposalType, index) => {
474472
test(`7M_${index + 1}. Should edit a ${proposalType.toLowerCase()} proposal draft`, async ({
475473
browser,
476474
}) => {
@@ -567,9 +565,7 @@ test.describe("Proposal Draft", () => {
567565
test.slow();
568566

569567
const proposalType =
570-
Object.values(ProposalType)[
571-
Math.floor(Math.random() * Object.values(ProposalType).length)
572-
];
568+
getProposalType()[Math.floor(Math.random() * getProposalType().length)];
573569

574570
const proposalSubmissionPage = new ProposalSubmissionPage(page);
575571
const { proposalFormValue } =

tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { faker } from "@faker-js/faker";
77
import { test } from "@fixtures/proposal";
88
import { setAllureEpic } from "@helpers/allure";
99
import { isBootStrapingPhase } from "@helpers/cardano";
10+
import { getProposalType } from "@helpers/index";
1011
import { injectLogger } from "@helpers/page";
1112
import { extractProposalIdFromUrl } from "@helpers/string";
1213
import { functionWaitedAssert } from "@helpers/waitedLoop";
@@ -55,9 +56,7 @@ test.describe("Filter and sort proposals", () => {
5556

5657
// proposal type filter
5758
await proposalDiscussionPage.applyAndValidateFilters(
58-
isBootStraping
59-
? BOOTSTRAP_PROPOSAL_TYPE_FILTERS
60-
: Object.values(ProposalType),
59+
isBootStraping ? BOOTSTRAP_PROPOSAL_TYPE_FILTERS : getProposalType(),
6160
proposalDiscussionPage._validateTypeFiltersInProposalCard
6261
);
6362

@@ -171,7 +170,7 @@ test("8D. Should show the view-all categorized proposed governance actions.", as
171170
browser,
172171
}) => {
173172
await Promise.all(
174-
Object.values(ProposalType).map(async (proposalType: string) => {
173+
getProposalType().map(async (proposalType: string) => {
175174
const context = await browser.newContext();
176175
const page = await context.newPage();
177176
injectLogger(page);

tests/govtool-frontend/playwright/tests/proposal.setup.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import { test as setup } from "@fixtures/walletExtension";
77
import kuberService from "@services/kuberService";
88
import walletManager from "lib/walletManager";
99
import { functionWaitedAssert } from "@helpers/waitedLoop";
10-
import { getWalletConfigForFaucet } from "@helpers/index";
10+
import {
11+
getProposalWalletCount,
12+
getWalletConfigForFaucet,
13+
} from "@helpers/index";
1114
import { createKeyFromPrivateKeyHex } from "@helpers/crypto";
1215

13-
const PROPOSAL_WALLETS_COUNT = environments.isScheduled ? 1 : 6;
16+
const PROPOSAL_WALLETS_COUNT = getProposalWalletCount();
1417

1518
let govActionDeposit: number;
1619

0 commit comments

Comments
 (0)