From c6774c1bfee679c7a15f777954f6a20121fdfa97 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 22 Apr 2025 16:39:49 +0545 Subject: [PATCH 01/11] feat: restructure dRep and budget proposal wallet authentication setup --- .../playwright/lib/constants/auth.ts | 27 +++ .../playwright/lib/constants/staticWallets.ts | 3 +- .../playwright/tests/auth.setup.ts | 203 +----------------- .../playwright/tests/dRep.auth.setup.ts | 30 +++ .../playwright/tests/dRep.teardown.ts | 6 +- .../tests/proposal-budget.auth.setup.ts | 69 ++++++ .../tests/proposal-budget.dRep.setup.ts | 59 +++++ .../tests/proposal-discussion.auth.setup.ts | 113 ++++++++++ 8 files changed, 315 insertions(+), 195 deletions(-) create mode 100644 tests/govtool-frontend/playwright/lib/constants/auth.ts create mode 100644 tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts create mode 100644 tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts create mode 100644 tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts create mode 100644 tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts diff --git a/tests/govtool-frontend/playwright/lib/constants/auth.ts b/tests/govtool-frontend/playwright/lib/constants/auth.ts new file mode 100644 index 000000000..e2d85b948 --- /dev/null +++ b/tests/govtool-frontend/playwright/lib/constants/auth.ts @@ -0,0 +1,27 @@ +export const adaHolder01AuthFile = ".auth/adaHolder01.json"; +export const adaHolder02AuthFile = ".auth/adaHolder02.json"; +export const adaHolder03AuthFile = ".auth/adaHolder03.json"; +export const adaHolder04AuthFile = ".auth/adaHolder04.json"; +export const adaHolder05AuthFile = ".auth/adaHolder05.json"; +export const adaHolder06AuthFile = ".auth/adaHolder06.json"; + +export const user01AuthFile = ".auth/user01.json"; + +export const dRep01AuthFile = ".auth/dRep01.json"; +export const dRep02AuthFile = ".auth/dRep02.json"; +export const dRep03AuthFile = ".auth/dRep03.json"; + +export const proposal01AuthFile = ".auth/proposal01.json"; +export const proposal02AuthFile = ".auth/proposal02.json"; +export const proposal03AuthFile = ".auth/proposal03.json"; +export const proposal04AuthFile = ".auth/proposal04.json"; +export const proposal05AuthFile = ".auth/proposal05.json"; +export const proposal06AuthFile = ".auth/proposal06.json"; +export const proposal07AuthFile = ".auth/proposal07.json"; +export const proposal08AuthFile = ".auth/proposal08.json"; +export const proposal09AuthFile = ".auth/proposal09.json"; + +export const budgetProposal01AuthFile = ".auth/budgetProposal01.json"; +export const budgetProposal02AuthFile = ".auth/budgetProposal02.json"; +export const budgetProposal03AuthFile = ".auth/budgetProposal03.json"; +export const budgetProposal04AuthFile = ".auth/budgetProposal04.json"; diff --git a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts index 17f486606..892c85a7f 100644 --- a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts +++ b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts @@ -44,7 +44,8 @@ export const adaHolderWallets = [ export const userWallets = [user01Wallet]; -export const dRepWallets = [dRep01Wallet, dRep02Wallet, dRep03Wallet]; +export const dRepWallets = [dRep01Wallet, dRep02Wallet]; +export const budgetProposalDRepWallets = [dRep03Wallet]; export const proposalWallets = [ proposal01Wallet, diff --git a/tests/govtool-frontend/playwright/tests/auth.setup.ts b/tests/govtool-frontend/playwright/tests/auth.setup.ts index 2732ff065..6571f0726 100644 --- a/tests/govtool-frontend/playwright/tests/auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/auth.setup.ts @@ -1,5 +1,14 @@ // Saves storage state to a file in the .auth directory +import { + adaHolder01AuthFile, + adaHolder02AuthFile, + adaHolder03AuthFile, + adaHolder04AuthFile, + adaHolder05AuthFile, + adaHolder06AuthFile, + user01AuthFile, +} from "@constants/auth"; import { adaHolder01Wallet, adaHolder02Wallet, @@ -7,94 +16,19 @@ import { adaHolder04Wallet, adaHolder05Wallet, adaHolder06Wallet, - budgetProposal01Wallet, - budgetProposal02Wallet, - budgetProposal03Wallet, - budgetProposal04Wallet, - dRep01Wallet, - dRep02Wallet, - dRep03Wallet, - proposal01Wallet, - proposal02Wallet, - proposal03Wallet, - proposal04Wallet, - proposal05Wallet, - proposal06Wallet, - proposal07Wallet, - proposal08Wallet, - proposal09Wallet, user01Wallet, } from "@constants/staticWallets"; import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; -import { - createAuth, - createAuthWithMultipleStake, - createAuthWithUserName, -} from "@helpers/auth"; +import { createAuth, createAuthWithMultipleStake } from "@helpers/auth"; import { skipIfNotHardFork } from "@helpers/cardano"; -const dRep01AuthFile = ".auth/dRep01.json"; -const dRep02AuthFile = ".auth/dRep02.json"; -const dRep03AuthFile = ".auth/dRep03.json"; - -const adaHolder01AuthFile = ".auth/adaHolder01.json"; -const adaHolder02AuthFile = ".auth/adaHolder02.json"; -const adaHolder03AuthFile = ".auth/adaHolder03.json"; -const adaHolder04AuthFile = ".auth/adaHolder04.json"; -const adaHolder05AuthFile = ".auth/adaHolder05.json"; -const adaHolder06AuthFile = ".auth/adaHolder06.json"; - -const user01AuthFile = ".auth/user01.json"; - -const proposal01AuthFile = ".auth/proposal01.json"; -const proposal02AuthFile = ".auth/proposal02.json"; -const proposal03AuthFile = ".auth/proposal03.json"; -const proposal04AuthFile = ".auth/proposal04.json"; -const proposal05AuthFile = ".auth/proposal05.json"; -const proposal06AuthFile = ".auth/proposal06.json"; -const proposal07AuthFile = ".auth/proposal07.json"; -const proposal08AuthFile = ".auth/proposal08.json"; -const proposal09AuthFile = ".auth/proposal09.json"; - -const budgetProposal01AuthFile = ".auth/budgetProposal01.json"; -const budgetProposal02AuthFile = ".auth/budgetProposal02.json"; -const budgetProposal03AuthFile = ".auth/budgetProposal03.json"; -const budgetProposal04AuthFile = ".auth/budgetProposal04.json"; - setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); await skipIfNotHardFork(); }); -setup("Create DRep 01 auth", async ({ page, context }) => { - await createAuth({ - page, - context, - wallet: dRep01Wallet, - auth: dRep01AuthFile, - }); -}); - -setup("Create DRep 02 auth", async ({ page, context }) => { - await createAuth({ - page, - context, - wallet: dRep02Wallet, - auth: dRep02AuthFile, - }); -}); - -setup("Create DRep 03 auth with username", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: dRep03Wallet, - auth: dRep03AuthFile, - }); -}); - setup("Create User 01 auth", async ({ page, context }) => { await createAuth({ page, @@ -157,120 +91,3 @@ setup("Create AdaHolder 06 auth", async ({ page, context }) => { auth: adaHolder06AuthFile, }); }); - -setup("Create Proposal 01 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal01Wallet, - auth: proposal01AuthFile, - }); -}); - -setup("Create Proposal 02 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal02Wallet, - auth: proposal02AuthFile, - }); -}); - -setup("Create Proposal 03 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal03Wallet, - auth: proposal03AuthFile, - }); -}); - -setup("Create Proposal 04 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal04Wallet, - auth: proposal04AuthFile, - }); -}); - -setup("Create Proposal 05 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal05Wallet, - auth: proposal05AuthFile, - }); -}); - -setup("Create Proposal 06 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal06Wallet, - auth: proposal06AuthFile, - }); -}); - -setup("Create Proposal 07 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal07Wallet, - auth: proposal07AuthFile, - }); -}); - -setup("Create Proposal 08 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal08Wallet, - auth: proposal08AuthFile, - }); -}); - -setup("Create Proposal 09 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal09Wallet, - auth: proposal09AuthFile, - }); -}); - -setup("Create Budget Proposal 01 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: budgetProposal01Wallet, - auth: budgetProposal01AuthFile, - }); -}); - -setup("Create Budget Proposal 02 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: budgetProposal02Wallet, - auth: budgetProposal02AuthFile, - }); -}); - -setup("Create Budget Proposal 03 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: budgetProposal03Wallet, - auth: budgetProposal03AuthFile, - }); -}); - -setup("Create Budget Proposal 04 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: budgetProposal04Wallet, - auth: budgetProposal04AuthFile, - }); -}); diff --git a/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts new file mode 100644 index 000000000..d38b27da5 --- /dev/null +++ b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts @@ -0,0 +1,30 @@ +import { dRep01AuthFile, dRep02AuthFile } from "@constants/auth"; +import { dRep01Wallet, dRep02Wallet } from "@constants/staticWallets"; +import { test as setup } from "@fixtures/walletExtension"; +import { setAllureEpic, setAllureStory } from "@helpers/allure"; +import { createAuth } from "@helpers/auth"; +import { skipIfNotHardFork } from "@helpers/cardano"; + +setup.beforeEach(async () => { + await setAllureEpic("Setup"); + await setAllureStory("Authentication"); + await skipIfNotHardFork(); +}); + +setup("Create DRep 01 auth", async ({ page, context }) => { + await createAuth({ + page, + context, + wallet: dRep01Wallet, + auth: dRep01AuthFile, + }); +}); + +setup("Create DRep 02 auth", async ({ page, context }) => { + await createAuth({ + page, + context, + wallet: dRep02Wallet, + auth: dRep02AuthFile, + }); +}); diff --git a/tests/govtool-frontend/playwright/tests/dRep.teardown.ts b/tests/govtool-frontend/playwright/tests/dRep.teardown.ts index 5a7272185..0e246b846 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.teardown.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.teardown.ts @@ -1,5 +1,8 @@ import environments from "@constants/environments"; -import { dRepWallets } from "@constants/staticWallets"; +import { + budgetProposalDRepWallets, + dRepWallets, +} from "@constants/staticWallets"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; import { skipIfMainnet } from "@helpers/cardano"; import { pollTransaction } from "@helpers/transaction"; @@ -26,6 +29,7 @@ cleanup("DRep de-registration", async () => { ...dRepWallets, ...registerDRep, ...registeredDRep, + ...budgetProposalDRepWallets, ]; try { const { txId, lockInfo } = await kuberService.multipleDRepDeRegistration( diff --git a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts new file mode 100644 index 000000000..c567b1b8f --- /dev/null +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts @@ -0,0 +1,69 @@ +import { + budgetProposal01AuthFile, + budgetProposal02AuthFile, + budgetProposal03AuthFile, + budgetProposal04AuthFile, + dRep03AuthFile, +} from "@constants/auth"; +import { + budgetProposal01Wallet, + budgetProposal02Wallet, + budgetProposal03Wallet, + budgetProposal04Wallet, + dRep03Wallet, +} from "@constants/staticWallets"; +import { test as setup } from "@fixtures/walletExtension"; +import { setAllureEpic, setAllureStory } from "@helpers/allure"; +import { createAuthWithUserName } from "@helpers/auth"; +import { skipIfNotHardFork } from "@helpers/cardano"; + +setup.beforeEach(async () => { + await setAllureEpic("Setup"); + await setAllureStory("Authentication"); + await skipIfNotHardFork(); +}); + +setup("Create Budget Proposal 01 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: budgetProposal01Wallet, + auth: budgetProposal01AuthFile, + }); +}); + +setup("Create Budget Proposal 02 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: budgetProposal02Wallet, + auth: budgetProposal02AuthFile, + }); +}); + +setup("Create Budget Proposal 03 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: budgetProposal03Wallet, + auth: budgetProposal03AuthFile, + }); +}); + +setup("Create Budget Proposal 04 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: budgetProposal04Wallet, + auth: budgetProposal04AuthFile, + }); +}); + +setup("Create DRep 03 auth with username", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: dRep03Wallet, + auth: dRep03AuthFile, + }); +}); diff --git a/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts new file mode 100644 index 000000000..ed7dbbc06 --- /dev/null +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts @@ -0,0 +1,59 @@ +import environments from "@constants/environments"; +import { + budgetProposalDRepWallets, + dRepWallets, +} from "@constants/staticWallets"; +import { setAllureEpic, setAllureStory } from "@helpers/allure"; +import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { uploadMetadataAndGetJsonHash } from "@helpers/metadata"; +import { pollTransaction } from "@helpers/transaction"; +import { expect } from "@playwright/test"; +import { test as setup } from "@fixtures/walletExtension"; + +import kuberService from "@services/kuberService"; + +setup.beforeEach(async () => { + await setAllureEpic("Setup"); + await setAllureStory("Register DRep"); + await skipIfNotHardFork(); + await skipIfMainnet(); +}); + +setup("Register DRep of proposal budget static wallets", async () => { + setup.setTimeout(environments.txTimeOut); + + try { + // Submit metadata to obtain a URL and generate hash value. + const metadataPromises = budgetProposalDRepWallets.map( + async (dRepWallet) => { + const metadataResponse = await uploadMetadataAndGetJsonHash(); + const givenName = metadataResponse.givenName; + const index = dRepWallets.indexOf(dRepWallet); + dRepWallets[index] = { + ...dRepWallet, + givenName, + }; + return { + ...metadataResponse, + wallet: dRepWallet, + }; + } + ); + + const metadataAndDRepWallets = await Promise.all(metadataPromises); + const res = await kuberService.multipleDRepRegistration( + metadataAndDRepWallets + ); + + await pollTransaction(res.txId, res.lockInfo); + } catch (err) { + if ( + err.status === 400 && + err.message.includes("ConwayDRepAlreadyRegistered") + ) { + expect(true, "DRep already registered").toBeTruthy(); + } else { + throw err; + } + } +}); diff --git a/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts new file mode 100644 index 000000000..83e8a3915 --- /dev/null +++ b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts @@ -0,0 +1,113 @@ +import { setAllureEpic, setAllureStory } from "@helpers/allure"; +import { skipIfNotHardFork } from "@helpers/cardano"; +import { test as setup } from "@fixtures/walletExtension"; +import { createAuthWithUserName } from "@helpers/auth"; +import { + proposal01Wallet, + proposal02Wallet, + proposal03Wallet, + proposal04Wallet, + proposal05Wallet, + proposal06Wallet, + proposal07Wallet, + proposal08Wallet, + proposal09Wallet, +} from "@constants/staticWallets"; +import { + proposal01AuthFile, + proposal02AuthFile, + proposal03AuthFile, + proposal04AuthFile, + proposal05AuthFile, + proposal06AuthFile, + proposal07AuthFile, + proposal08AuthFile, + proposal09AuthFile, +} from "@constants/auth"; + +setup.beforeEach(async () => { + await setAllureEpic("Setup"); + await setAllureStory("Authentication"); + await skipIfNotHardFork(); +}); + +setup("Create Proposal 01 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal01Wallet, + auth: proposal01AuthFile, + }); +}); + +setup("Create Proposal 02 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal02Wallet, + auth: proposal02AuthFile, + }); +}); + +setup("Create Proposal 03 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal03Wallet, + auth: proposal03AuthFile, + }); +}); + +setup("Create Proposal 04 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal04Wallet, + auth: proposal04AuthFile, + }); +}); + +setup("Create Proposal 05 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal05Wallet, + auth: proposal05AuthFile, + }); +}); + +setup("Create Proposal 06 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal06Wallet, + auth: proposal06AuthFile, + }); +}); + +setup("Create Proposal 07 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal07Wallet, + auth: proposal07AuthFile, + }); +}); + +setup("Create Proposal 08 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal08Wallet, + auth: proposal08AuthFile, + }); +}); + +setup("Create Proposal 09 auth", async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet: proposal09Wallet, + auth: proposal09AuthFile, + }); +}); From d5dcf719e3a7c46a3f38efacc9517d235b781550 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 22 Apr 2025 16:41:02 +0545 Subject: [PATCH 02/11] refactor: update the project to structure the seperete auth setup --- .../playwright/lib/fixtures/budgetProposal.ts | 3 +- .../playwright/playwright.config.ts | 53 +++++++++++++++++-- ...spec.ts => proposalBudget.dRep.pb.spec.ts} | 3 +- ....ts => proposalBudget.loggedin.pb.spec.ts} | 0 .../11-proposal-budget/proposalBudget.spec.ts | 2 +- ...posalBudgetSubmission.loggedin.pb.spec.ts} | 0 ...=> proposalSubmission.loggedin.pd.spec.ts} | 3 +- ...=> proposalDiscussion.loggedin.pd.spec.ts} | 0 8 files changed, 57 insertions(+), 7 deletions(-) rename tests/govtool-frontend/playwright/tests/11-proposal-budget/{proposalBudget.dRep.spec.ts => proposalBudget.dRep.pb.spec.ts} (98%) rename tests/govtool-frontend/playwright/tests/11-proposal-budget/{proposalBudget.loggedin.spec.ts => proposalBudget.loggedin.pb.spec.ts} (100%) rename tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/{proposalBudgetSubmission.loggedin.spec.ts => proposalBudgetSubmission.loggedin.pb.spec.ts} (100%) rename tests/govtool-frontend/playwright/tests/7-proposal-submission/{proposalSubmission.loggedin.spec.ts => proposalSubmission.loggedin.pd.spec.ts} (99%) rename tests/govtool-frontend/playwright/tests/8-proposal-discussion/{proposalDiscussion.loggedin.spec.ts => proposalDiscussion.loggedin.pd.spec.ts} (100%) diff --git a/tests/govtool-frontend/playwright/lib/fixtures/budgetProposal.ts b/tests/govtool-frontend/playwright/lib/fixtures/budgetProposal.ts index f620d523a..e5c727559 100644 --- a/tests/govtool-frontend/playwright/lib/fixtures/budgetProposal.ts +++ b/tests/govtool-frontend/playwright/lib/fixtures/budgetProposal.ts @@ -1,3 +1,4 @@ +import { budgetProposal01AuthFile } from "@constants/auth"; import { budgetProposal01Wallet } from "@constants/staticWallets"; import { test as base } from "@fixtures/walletExtension"; import { createNewPageWithWallet } from "@helpers/page"; @@ -12,7 +13,7 @@ export const test = base.extend({ proposalId: async ({ browser }, use) => { // setup const budgetProposalPage = await createNewPageWithWallet(browser, { - storageState: ".auth/budgetProposal01.json", + storageState: budgetProposal01AuthFile, wallet: budgetProposal01Wallet, }); diff --git a/tests/govtool-frontend/playwright/playwright.config.ts b/tests/govtool-frontend/playwright/playwright.config.ts index 4a254fcd7..a948d77eb 100644 --- a/tests/govtool-frontend/playwright/playwright.config.ts +++ b/tests/govtool-frontend/playwright/playwright.config.ts @@ -55,7 +55,24 @@ export default defineConfig({ { name: "dRep setup", testMatch: "**/dRep.setup.ts", - dependencies: environments.ci ? ["faucet setup"] : [], + dependencies: environments.ci ? ["faucet setup", "wallet bootstrap"] : [], + }, + { + name: "proposal budget dRep setup", + testMatch: "**/proposal-budget.dRep.setup.ts", + }, + { + name: "dRep auth setup", + testMatch: "**/dRep.auth.setup.ts", + dependencies: environments.ci ? ["dRep setup"] : [], + }, + { + name: "proposal discussion auth setup", + testMatch: "**/proposal-discussion.auth.setup.ts", + }, + { + name: "proposal budget auth setup", + testMatch: "**/proposal-budget.auth.setup.ts", }, { name: "proposal setup", @@ -73,6 +90,23 @@ export default defineConfig({ testMatch: "**/*.tx.spec.ts", dependencies: environments.ci ? ["auth setup", "wallet bootstrap"] : [], }, + { + name: "proposal discussion", + use: { ...devices["Desktop Chrome"] }, + testMatch: "**/*.pd.spec.ts", + dependencies: environments.ci + ? ["proposal discussion auth setup"] + : [], + }, + { + name: "proposal budget", + use: { ...devices["Desktop Chrome"] }, + testMatch: "**/*.pb.spec.ts", + dependencies: environments.ci + ? ["proposal budget auth setup"] + : [], + testIgnore: ["**/*.dRep.pb.spec.ts"], + }, { name: "proposal submission", use: { ...devices["Desktop Chrome"] }, @@ -85,14 +119,23 @@ export default defineConfig({ name: "loggedin (desktop)", use: { ...devices["Desktop Chrome"] }, testMatch: "**/*.loggedin.spec.ts", - dependencies: environments.ci ? ["auth setup"] : [], + dependencies: environments.ci ? ["auth setup", "wallet bootstrap"] : [], + }, + { + name: "proposal budget dRep", + use: { ...devices["Desktop Chrome"] }, + testMatch: "**/*.dRep.pb.spec.ts", + dependencies: environments.ci + ? ["proposal budget auth setup","proposal budget dRep setup"] + : [], + teardown: environments.ci && "cleanup dRep", }, { name: "dRep", use: { ...devices["Desktop Chrome"] }, testMatch: "**/*.dRep.spec.ts", dependencies: environments.ci - ? ["auth setup", "dRep setup", "wallet bootstrap"] + ? ["dRep setup", "dRep auth setup", "wallet bootstrap"] : [], teardown: environments.ci && "cleanup dRep", }, @@ -114,6 +157,8 @@ export default defineConfig({ "**/*.dRep.spec.ts", "**/*.tx.spec.ts", "**/*.ga.spec.ts", + "**/*.pd.spec.ts", + "**/*.pb.spec.ts", ], }, { @@ -125,6 +170,8 @@ export default defineConfig({ "**/*.delegation.spec.ts", "**/*.tx.spec.ts", "**/*.ga.spec.ts", + "**/*.pd.spec.ts", + "**/*.pb.spec.ts", "**/walletConnect.spec.ts", ], }, diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts similarity index 98% rename from tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.spec.ts rename to tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts index 4d1888265..ab4e76254 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts @@ -5,6 +5,7 @@ import BudgetDiscussionDetailsPage from "@pages/budgetDiscussionDetailsPage"; import { expect } from "@playwright/test"; import { dRep03Wallet } from "@constants/staticWallets"; import BudgetDiscussionPage from "@pages/budgetDiscussionPage"; +import { dRep03AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("11. Proposal Budget"); @@ -12,7 +13,7 @@ test.beforeEach(async () => { test.describe("Budget proposal dRep behaviour", () => { test.use({ - storageState: ".auth/dRep03.json", + storageState: dRep03AuthFile, wallet: dRep03Wallet, }); diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts similarity index 100% rename from tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.spec.ts rename to tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts index 22a041e45..733ed6fd7 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.spec.ts @@ -8,7 +8,7 @@ import { functionWaitedAssert } from "@helpers/waitedLoop"; import BudgetDiscussionDetailsPage from "@pages/budgetDiscussionDetailsPage"; import BudgetDiscussionPage from "@pages/budgetDiscussionPage"; import { expect } from "@playwright/test"; -import { BudgetDiscussionEnum, CommentResponse } from "@types"; +import { BudgetDiscussionEnum } from "@types"; const mockBudgetProposal = require("../../lib/_mock/budgetProposal.json"); const mockPoll = require("../../lib/_mock/budgetProposalPoll.json"); diff --git a/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts similarity index 100% rename from tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.spec.ts rename to tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts 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.pd.spec.ts similarity index 99% rename from tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts rename to tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.pd.spec.ts index 2c53bb141..ac9426c02 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.pd.spec.ts @@ -1,3 +1,4 @@ +import { proposal05AuthFile, proposal06AuthFile } from "@constants/auth"; import environments from "@constants/environments"; import { proposal01Wallet, @@ -534,7 +535,7 @@ test.describe("Proposal Draft", () => { test("7N. Should submit a draft proposal", async ({ browser }) => { const page = await createNewPageWithWallet(browser, { - storageState: ".auth/proposal06.json", + storageState: proposal06AuthFile, wallet: proposal06Wallet, }); 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.pd.spec.ts similarity index 100% rename from tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.spec.ts rename to tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts From da257282c73b999549d9b37200e19af2478981da Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 24 Apr 2025 12:25:21 +0545 Subject: [PATCH 03/11] refactor: update authentication file references in Playwright tests --- .../playwright/lib/fixtures/proposal.ts | 3 ++- .../playwright/lib/helpers/auth.ts | 14 +++++++++---- .../walletConnect.loggedin.spec.ts | 3 ++- .../proposalBudget.loggedin.pb.spec.ts | 3 ++- ...oposalBudgetSubmission.loggedin.pb.spec.ts | 14 +++++++++---- .../2-delegation/delegation.loggedin.spec.ts | 3 ++- ...delegationFunctionality.delegation.spec.ts | 20 +++++++++++++------ .../dRepRegistration.dRep.spec.ts | 3 ++- .../dRepRegistration.loggedin.spec.ts | 3 ++- .../3-drep-registration/editDRep.dRep.spec.ts | 3 ++- .../proposalVisibility.dRep.spec.ts | 7 ++++--- .../proposalVisibility.loggedin.spec.ts | 3 ++- .../proposalFunctionality.dRep.spec.ts | 3 ++- .../proposalFunctionality.loggedin.spec.ts | 3 ++- .../miscellaneous.dRep.spec.ts | 3 ++- .../miscellaneous.loggedin.spec.ts | 3 ++- .../proposalSubmission.loggedin.pd.spec.ts | 13 ++++++++---- .../proposalDiscussion.loggedin.pd.spec.ts | 13 ++++++++---- 18 files changed, 80 insertions(+), 37 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/fixtures/proposal.ts b/tests/govtool-frontend/playwright/lib/fixtures/proposal.ts index b52d043b6..5ae1e4b0d 100644 --- a/tests/govtool-frontend/playwright/lib/fixtures/proposal.ts +++ b/tests/govtool-frontend/playwright/lib/fixtures/proposal.ts @@ -1,3 +1,4 @@ +import { proposal01AuthFile } from "@constants/auth"; import { proposal01Wallet } from "@constants/staticWallets"; import { test as base } from "@fixtures/walletExtension"; import { createNewPageWithWallet } from "@helpers/page"; @@ -15,7 +16,7 @@ export const test = base.extend({ proposalId: async ({ browser, pollEnabled }, use) => { // setup const proposalPage = await createNewPageWithWallet(browser, { - storageState: ".auth/proposal01.json", + storageState: proposal01AuthFile, wallet: proposal01Wallet, }); diff --git a/tests/govtool-frontend/playwright/lib/helpers/auth.ts b/tests/govtool-frontend/playwright/lib/helpers/auth.ts index 12820ea34..980cfa4f6 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/auth.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/auth.ts @@ -14,6 +14,12 @@ import { proposal08Wallet, proposal09Wallet, } from "@constants/staticWallets"; +import { + proposal05AuthFile, + proposal07AuthFile, + proposal08AuthFile, + proposal09AuthFile, +} from "@constants/auth"; interface CreateUserProps { page: Page; @@ -91,22 +97,22 @@ export const getDraftProposalWalletAndState = (proposalType: string) => { switch (proposalType) { case ProposalType.info: return { - storageState: ".auth/proposal05.json", + storageState: proposal05AuthFile, wallet: proposal05Wallet, }; case ProposalType.treasury: return { - storageState: ".auth/proposal07.json", + storageState: proposal07AuthFile, wallet: proposal07Wallet, }; case ProposalType.updatesToTheConstitution: return { - storageState: ".auth/proposal08.json", + storageState: proposal08AuthFile, wallet: proposal08Wallet, }; case ProposalType.motionOfNoConfedence: return { - storageState: ".auth/proposal09.json", + storageState: proposal09AuthFile, wallet: proposal09Wallet, }; } diff --git a/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.loggedin.spec.ts index f073d6cb2..017a2ac2b 100644 --- a/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.loggedin.spec.ts @@ -1,9 +1,10 @@ +import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import LoginPage from "@pages/loginPage"; -test.use({ storageState: ".auth/user01.json", wallet: user01Wallet }); +test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("1. Wallet connect"); }); diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts index bf0912073..12c1ba5be 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.loggedin.pb.spec.ts @@ -1,3 +1,4 @@ +import { budgetProposal01AuthFile } from "@constants/auth"; import { budgetProposal01Wallet } from "@constants/staticWallets"; import { faker } from "@faker-js/faker"; import { test } from "@fixtures/walletExtension"; @@ -12,7 +13,7 @@ test.beforeEach(async () => { test.describe("Budget proposal logged in state", () => { test.use({ - storageState: ".auth/budgetProposal01.json", + storageState: budgetProposal01AuthFile, wallet: budgetProposal01Wallet, }); diff --git a/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts b/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts index af9aa95cb..a2c320b8f 100644 --- a/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts +++ b/tests/govtool-frontend/playwright/tests/12-proposal-budget-submission/proposalBudgetSubmission.loggedin.pb.spec.ts @@ -1,3 +1,9 @@ +import { + budgetProposal01AuthFile, + budgetProposal02AuthFile, + budgetProposal03AuthFile, + budgetProposal04AuthFile, +} from "@constants/auth"; import { budgetProposal01Wallet, budgetProposal02Wallet, @@ -26,7 +32,7 @@ test.beforeEach(async () => { test.describe("Budget proposal 01 wallet", () => { test.use({ - storageState: ".auth/budgetProposal01.json", + storageState: budgetProposal01AuthFile, wallet: budgetProposal01Wallet, }); @@ -413,7 +419,7 @@ test.describe("Budget proposal 01 wallet", () => { test("12C. Should save and view draft proposal", async ({ browser }) => { const page = await createNewPageWithWallet(browser, { - storageState: ".auth/budgetProposal02.json", + storageState: budgetProposal02AuthFile, wallet: budgetProposal02Wallet, }); @@ -461,7 +467,7 @@ test("12C. Should save and view draft proposal", async ({ browser }) => { test("12H. Should submit a valid budget proposal", async ({ browser }) => { const page = await createNewPageWithWallet(browser, { - storageState: ".auth/budgetProposal03.json", + storageState: budgetProposal03AuthFile, wallet: budgetProposal03Wallet, }); const budgetSubmissionPage = new BudgetDiscussionSubmissionPage(page); @@ -482,7 +488,7 @@ test("12I. Should submit a valid draft budget proposal", async ({ }) => { test.slow(); const page = await createNewPageWithWallet(browser, { - storageState: ".auth/budgetProposal04.json", + storageState: budgetProposal04AuthFile, wallet: budgetProposal04Wallet, }); 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 d7a77489b..3149c68d0 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 @@ -1,3 +1,4 @@ +import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; @@ -9,7 +10,7 @@ import extractDRepFromWallet from "@helpers/shellyWallet"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; import { expect } from "@playwright/test"; -test.use({ storageState: ".auth/user01.json", wallet: user01Wallet }); +test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("2. Delegation"); 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 2c1057dc0..5d3e71826 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 @@ -1,3 +1,11 @@ +import { + adaHolder01AuthFile, + adaHolder02AuthFile, + adaHolder03AuthFile, + adaHolder04AuthFile, + adaHolder05AuthFile, + adaHolder06AuthFile, +} from "@constants/auth"; import environments from "@constants/environments"; import { adaHolder01Wallet, @@ -33,7 +41,7 @@ test.beforeEach(async () => { test.describe("Delegate to others", () => { test.use({ - storageState: ".auth/adaHolder01.json", + storageState: adaHolder01AuthFile, wallet: adaHolder01Wallet, }); @@ -83,7 +91,7 @@ test.describe("Delegate to others", () => { test.describe("Change delegation", () => { test.use({ - storageState: ".auth/adaHolder02.json", + storageState: adaHolder02AuthFile, wallet: adaHolder02Wallet, }); @@ -220,7 +228,7 @@ test("2G. Should delegate to myself", async ({ page, browser }, testInfo) => { test.describe("Multiple delegations", () => { test.use({ - storageState: ".auth/adaHolder05.json", + storageState: adaHolder05AuthFile, wallet: adaHolder05Wallet, }); @@ -248,7 +256,7 @@ test.describe("Multiple delegations", () => { test.describe("Abstain delegation", () => { test.use({ - storageState: ".auth/adaHolder03.json", + storageState: adaHolder03AuthFile, wallet: adaHolder03Wallet, }); @@ -278,7 +286,7 @@ test.describe("Abstain delegation", () => { test.describe("No confidence delegation", () => { test.use({ - storageState: ".auth/adaHolder04.json", + storageState: adaHolder04AuthFile, wallet: adaHolder04Wallet, }); @@ -309,7 +317,7 @@ test.describe("No confidence delegation", () => { test.describe("Delegated ADA visibility", () => { test.use({ - storageState: ".auth/adaHolder06.json", + storageState: adaHolder06AuthFile, wallet: adaHolder06Wallet, }); 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 a548758cc..aebb4e83d 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 @@ -14,6 +14,7 @@ import { expect } from "@playwright/test"; import walletManager from "lib/walletManager"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; import { GovernanceActionType } from "@types"; +import { dRep01AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); @@ -23,7 +24,7 @@ test.beforeEach(async () => { test.describe("Logged in DReps", () => { test.use({ - storageState: ".auth/dRep01.json", + storageState: dRep01AuthFile, wallet: dRep01Wallet, enableDRepSigning: true, enableStakeSigning: false, 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 2a19d17c0..a71bc2f16 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 @@ -8,9 +8,10 @@ import { skipIfNotHardFork } from "@helpers/cardano"; import DRepRegistrationPage from "@pages/dRepRegistrationPage"; import { expect } from "@playwright/test"; import environments from "@constants/environments"; +import { user01AuthFile } from "@constants/auth"; test.use({ - storageState: ".auth/user01.json", + storageState: user01AuthFile, wallet: user01Wallet, }); 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 873755f55..11f186292 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 @@ -8,6 +8,7 @@ import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; import EditDRepPage from "@pages/editDRepPage"; import { expect } from "@playwright/test"; import environments from "@constants/environments"; +import { dRep02AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); @@ -15,7 +16,7 @@ test.beforeEach(async () => { await skipIfMainnet(); }); -test.use({ wallet: dRep02Wallet, storageState: ".auth/dRep02.json" }); +test.use({ wallet: dRep02Wallet, storageState: dRep02AuthFile }); test.describe("Validation of edit dRep Form", () => { test("3M_1. Should accept valid data in edit dRep form", async ({ page }) => { 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 d2845e961..e2855c60e 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 @@ -23,6 +23,7 @@ import { areDRepVoteTotalsDisplayed, areSPOVoteTotalsDisplayed, } from "@helpers/featureFlag"; +import { dRep01AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); @@ -31,7 +32,7 @@ test.beforeEach(async () => { }); test.describe("Logged in DRep", () => { - test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet }); + test.use({ storageState: dRep01AuthFile, wallet: dRep01Wallet }); test("4E. Should display DRep's voting power in governance actions page", async ({ page, @@ -135,7 +136,7 @@ test.describe("Temporary DReps", async () => { }); test.describe("Check vote count", () => { - test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet }); + test.use({ storageState: dRep01AuthFile, wallet: dRep01Wallet }); test("4G. Should display correct vote counts on governance details page for DRep", async ({ page, @@ -172,7 +173,7 @@ test.describe("Check vote count", () => { await Promise.all( uniqueProposalTypes.map(async (proposalToCheck) => { const dRepPage = await createNewPageWithWallet(browser, { - storageState: ".auth/dRep01.json", + storageState: dRep01AuthFile, wallet: dRep01Wallet, }); diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts index a907f7f1e..0f400617a 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts @@ -1,3 +1,4 @@ +import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; @@ -6,7 +7,7 @@ import { isMobile, openDrawer } from "@helpers/mobile"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect } from "@playwright/test"; -test.use({ storageState: ".auth/user01.json", wallet: user01Wallet }); +test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); 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 6b2042f93..4a0b9c5d8 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 @@ -1,3 +1,4 @@ +import { dRep01AuthFile } from "@constants/auth"; import environments from "@constants/environments"; import { dRep01Wallet } from "@constants/staticWallets"; import { createTempDRepAuth } from "@datafactory/createAuth"; @@ -27,7 +28,7 @@ test.beforeEach(async () => { }); test.describe("Proposal checks", () => { - test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet }); + test.use({ storageState: dRep01AuthFile, wallet: dRep01Wallet }); let govActionDetailsPage: GovernanceActionDetailsPage; let currentPage: Page; diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts index 91c71b26c..dd0bb116c 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts @@ -1,10 +1,11 @@ +import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { skipIfNotHardFork } from "@helpers/cardano"; import { expect } from "@playwright/test"; -test.use({ storageState: ".auth/user01.json", wallet: user01Wallet }); +test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("5. Proposal functionality"); 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 027f39f0c..adacbf67c 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 @@ -1,3 +1,4 @@ +import { dRep01AuthFile } from "@constants/auth"; import environments from "@constants/environments"; import { dRep01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; @@ -12,7 +13,7 @@ test.beforeEach(async () => { }); test.use({ - storageState: ".auth/dRep01.json", + storageState: dRep01AuthFile, wallet: dRep01Wallet, }); diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts index fff528bad..3ea36f53b 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts @@ -1,3 +1,4 @@ +import { user01AuthFile } from "@constants/auth"; import { ABSTAIN_VOTE_DOC_URL, DELEGATION_DOC_URL, @@ -27,7 +28,7 @@ test.beforeEach(async () => { test.describe("Logged in user", () => { test.use({ - storageState: ".auth/user01.json", + storageState: user01AuthFile, wallet: user01Wallet, }); 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 ac9426c02..1618eede4 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 @@ -1,4 +1,9 @@ -import { proposal05AuthFile, proposal06AuthFile } from "@constants/auth"; +import { + proposal01AuthFile, + proposal03AuthFile, + proposal04AuthFile, + proposal06AuthFile, +} from "@constants/auth"; import environments from "@constants/environments"; import { proposal01Wallet, @@ -29,7 +34,7 @@ test.beforeEach(async () => { }); test.describe("Proposal created logged state", () => { - test.use({ storageState: ".auth/proposal01.json", wallet: proposal01Wallet }); + test.use({ storageState: proposal01AuthFile, wallet: proposal01Wallet }); test("7B. Should access proposal creation page", async ({ page }) => { await page.goto("/"); await page.getByTestId("proposal-discussion-link").click(); @@ -369,7 +374,7 @@ test.describe("Proposal created logged state", () => { test.describe("Proposal Draft", () => { test("7C. Should list unfinished Draft ", async ({ browser }) => { const page = await createNewPageWithWallet(browser, { - storageState: ".auth/proposal03.json", + storageState: proposal03AuthFile, wallet: proposal03Wallet, }); const proposalSubmissionPage = new ProposalSubmissionPage(page); @@ -385,7 +390,7 @@ test.describe("Proposal Draft", () => { test("7L. Should save proposal as a draft", async ({ browser }) => { const page = await createNewPageWithWallet(browser, { - storageState: ".auth/proposal04.json", + storageState: proposal04AuthFile, wallet: proposal04Wallet, }); diff --git a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts index 5caee4fd3..9066ba1d5 100644 --- a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts +++ b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts @@ -11,6 +11,11 @@ import { Page, expect } from "@playwright/test"; import { setAllureEpic } from "@helpers/allure"; import { skipIfNotHardFork } from "@helpers/cardano"; import ProposalSubmissionPage from "@pages/proposalSubmissionPage"; +import { + proposal01AuthFile, + proposal02AuthFile, + user01AuthFile, +} from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("8. Proposal Discussion Forum"); @@ -19,7 +24,7 @@ test.beforeEach(async () => { test.describe("Proposal created logged in state", () => { test.use({ - storageState: ".auth/proposal02.json", + storageState: proposal02AuthFile, wallet: proposal02Wallet, }); @@ -76,7 +81,7 @@ test.describe("Proposal created logged in state", () => { test.describe("Proposal created with poll enabled (user auth)", () => { test.use({ - storageState: ".auth/proposal02.json", + storageState: proposal02AuthFile, wallet: proposal02Wallet, pollEnabled: true, }); @@ -136,7 +141,7 @@ test.describe("Proposal created with poll enabled (user auth)", () => { test.describe("Proposal created with poll enabled (proposal auth)", () => { test.use({ - storageState: ".auth/user01.json", + storageState: user01AuthFile, wallet: user01Wallet, pollEnabled: true, }); @@ -147,7 +152,7 @@ test.describe("Proposal created with poll enabled (proposal auth)", () => { test.beforeEach(async ({ browser, proposalId }) => { test.slow(); proposalPage = await createNewPageWithWallet(browser, { - storageState: ".auth/proposal01.json", + storageState: proposal01AuthFile, wallet: proposal01Wallet, }); ownerProposalDiscussionDetailsPage = new ProposalDiscussionDetailsPage( From c5104a89b6015f016c3812b93ea2b53a570e5f7b Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 24 Apr 2025 14:48:42 +0545 Subject: [PATCH 04/11] chore: add budget proposal DRep wallets to all static wallets list --- tests/govtool-frontend/playwright/lib/constants/staticWallets.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts index 892c85a7f..b99da8816 100644 --- a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts +++ b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts @@ -66,4 +66,5 @@ export const allStaticWallets = [ ...proposalWallets, faucetWallet, proposalFaucetWallet, + ...budgetProposalDRepWallets ]; From 635daae0f617398f0b37bf68200bfb9479034d1e Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 24 Apr 2025 14:50:38 +0545 Subject: [PATCH 05/11] chore: add teardown step for proposal budget dRep setup in Playwright config --- tests/govtool-frontend/playwright/playwright.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/govtool-frontend/playwright/playwright.config.ts b/tests/govtool-frontend/playwright/playwright.config.ts index a948d77eb..40d6d7593 100644 --- a/tests/govtool-frontend/playwright/playwright.config.ts +++ b/tests/govtool-frontend/playwright/playwright.config.ts @@ -60,6 +60,7 @@ export default defineConfig({ { name: "proposal budget dRep setup", testMatch: "**/proposal-budget.dRep.setup.ts", + teardown: environments.ci && "cleanup faucet", }, { name: "dRep auth setup", From d4bd51c97fc1dacbd26094efa255f6b5014fc616 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 25 Apr 2025 10:57:03 +0545 Subject: [PATCH 06/11] refactor: streamline authentication setup for users and proposals --- .../playwright/tests/auth.setup.ts | 70 +++++------- .../playwright/tests/dRep.auth.setup.ts | 28 +++-- .../tests/proposal-budget.auth.setup.ts | 48 ++++----- .../tests/proposal-discussion.auth.setup.ts | 102 ++++-------------- 4 files changed, 86 insertions(+), 162 deletions(-) diff --git a/tests/govtool-frontend/playwright/tests/auth.setup.ts b/tests/govtool-frontend/playwright/tests/auth.setup.ts index 6571f0726..9564a3adb 100644 --- a/tests/govtool-frontend/playwright/tests/auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/auth.setup.ts @@ -29,59 +29,45 @@ setup.beforeEach(async () => { await skipIfNotHardFork(); }); -setup("Create User 01 auth", async ({ page, context }) => { - await createAuth({ - page, - context, - wallet: user01Wallet, - auth: user01AuthFile, - }); -}); - -setup("Create AdaHolder 01 auth", async ({ page, context }) => { - await createAuth({ - page, - context, +const authConfigs = [ + { name: "User 01", wallet: user01Wallet, auth: user01AuthFile }, + { + name: "AdaHolder 01", wallet: adaHolder01Wallet, auth: adaHolder01AuthFile, - }); -}); - -setup("Create AdaHolder 02 auth", async ({ page, context }) => { - await createAuth({ - page, - context, + }, + { + name: "AdaHolder 02", wallet: adaHolder02Wallet, auth: adaHolder02AuthFile, - }); -}); - -setup("Create AdaHolder 03 auth", async ({ page, context }) => { - await createAuth({ - page, - context, + }, + { + name: "AdaHolder 03", wallet: adaHolder03Wallet, auth: adaHolder03AuthFile, - }); -}); - -setup("Create AdaHolder 04 auth", async ({ page, context }) => { - await createAuth({ - page, - context, + }, + { + name: "AdaHolder 04", wallet: adaHolder04Wallet, auth: adaHolder04AuthFile, - }); -}); - -setup("Create AdaHolder 05 auth", async ({ page, context }) => { - await createAuth({ - page, - context, + }, + { + name: "AdaHolder 05", wallet: adaHolder05Wallet, auth: adaHolder05AuthFile, + }, +]; + +for (const config of authConfigs) { + setup(`Create ${config.name} auth`, async ({ page, context }) => { + await createAuth({ + page, + context, + wallet: config.wallet, + auth: config.auth, + }); }); -}); +} setup("Create AdaHolder 06 auth", async ({ page, context }) => { await createAuthWithMultipleStake({ diff --git a/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts index d38b27da5..e731527e9 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts @@ -11,20 +11,18 @@ setup.beforeEach(async () => { await skipIfNotHardFork(); }); -setup("Create DRep 01 auth", async ({ page, context }) => { - await createAuth({ - page, - context, - wallet: dRep01Wallet, - auth: dRep01AuthFile, - }); -}); +const drepAuthConfigs = [ + { name: "DRep 01", wallet: dRep01Wallet, auth: dRep01AuthFile }, + { name: "DRep 02", wallet: dRep02Wallet, auth: dRep02AuthFile }, +]; -setup("Create DRep 02 auth", async ({ page, context }) => { - await createAuth({ - page, - context, - wallet: dRep02Wallet, - auth: dRep02AuthFile, +for (const config of drepAuthConfigs) { + setup(`Create ${config.name} auth`, async ({ page, context }) => { + await createAuth({ + page, + context, + wallet: config.wallet, + auth: config.auth, + }); }); -}); +} diff --git a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts index c567b1b8f..d908960bd 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts @@ -23,39 +23,37 @@ setup.beforeEach(async () => { await skipIfNotHardFork(); }); -setup("Create Budget Proposal 01 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, +const walletAuthPairs = [ + { wallet: budgetProposal01Wallet, auth: budgetProposal01AuthFile, - }); -}); - -setup("Create Budget Proposal 02 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, + name: "Budget Proposal 01", + }, + { wallet: budgetProposal02Wallet, auth: budgetProposal02AuthFile, - }); -}); - -setup("Create Budget Proposal 03 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, + name: "Budget Proposal 02", + }, + { wallet: budgetProposal03Wallet, auth: budgetProposal03AuthFile, - }); -}); - -setup("Create Budget Proposal 04 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, + name: "Budget Proposal 03", + }, + { wallet: budgetProposal04Wallet, auth: budgetProposal04AuthFile, + name: "Budget Proposal 04", + }, +]; + +walletAuthPairs.forEach(({ wallet, auth, name }) => { + setup(`Create ${name} auth`, async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet, + auth, + }); }); }); diff --git a/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts index 83e8a3915..dee4bbf94 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts @@ -31,83 +31,25 @@ setup.beforeEach(async () => { await skipIfNotHardFork(); }); -setup("Create Proposal 01 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal01Wallet, - auth: proposal01AuthFile, - }); -}); - -setup("Create Proposal 02 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal02Wallet, - auth: proposal02AuthFile, - }); -}); - -setup("Create Proposal 03 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal03Wallet, - auth: proposal03AuthFile, - }); -}); - -setup("Create Proposal 04 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal04Wallet, - auth: proposal04AuthFile, - }); -}); - -setup("Create Proposal 05 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal05Wallet, - auth: proposal05AuthFile, - }); -}); - -setup("Create Proposal 06 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal06Wallet, - auth: proposal06AuthFile, - }); -}); - -setup("Create Proposal 07 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal07Wallet, - auth: proposal07AuthFile, - }); -}); - -setup("Create Proposal 08 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal08Wallet, - auth: proposal08AuthFile, - }); -}); - -setup("Create Proposal 09 auth", async ({ page, context }) => { - await createAuthWithUserName({ - page, - context, - wallet: proposal09Wallet, - auth: proposal09AuthFile, - }); -}); +const proposalSetups = [ + { name: "Proposal 01", wallet: proposal01Wallet, auth: proposal01AuthFile }, + { name: "Proposal 02", wallet: proposal02Wallet, auth: proposal02AuthFile }, + { name: "Proposal 03", wallet: proposal03Wallet, auth: proposal03AuthFile }, + { name: "Proposal 04", wallet: proposal04Wallet, auth: proposal04AuthFile }, + { name: "Proposal 05", wallet: proposal05Wallet, auth: proposal05AuthFile }, + { name: "Proposal 06", wallet: proposal06Wallet, auth: proposal06AuthFile }, + { name: "Proposal 07", wallet: proposal07Wallet, auth: proposal07AuthFile }, + { name: "Proposal 08", wallet: proposal08Wallet, auth: proposal08AuthFile }, + { name: "Proposal 09", wallet: proposal09Wallet, auth: proposal09AuthFile }, +]; + +for (const { name, wallet, auth } of proposalSetups) { + setup(`Create ${name} auth`, async ({ page, context }) => { + await createAuthWithUserName({ + page, + context, + wallet, + auth, + }); + }); +} From 5eaa5ed0366c0eea787b6977d5d2a86059c3f55b Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 25 Apr 2025 12:37:34 +0545 Subject: [PATCH 07/11] feat: add dev env on backend/frontend test workflow dispatch --- .github/workflows/test_backend.yml | 5 ++--- .github/workflows/test_integration_playwright.yml | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index 2e01c721b..aa651f28c 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -17,7 +17,7 @@ on: - "staging.govtool.byron.network/api" - "govtool.cardanoapi.io/api" - "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr" - - "dev-sanchonet.govtool.byron.network/api" + - "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr" - "be.gov.tools" network: required: true @@ -39,7 +39,7 @@ concurrency: jobs: backend-tests: runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} outputs: start_time: ${{ steps.set-pending-status.outputs.timestamp }} status: ${{ steps.run-tests.outcome }} @@ -58,7 +58,6 @@ jobs: https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \ -d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" - - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index 49a05166a..ea6406cfe 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -18,6 +18,7 @@ on: - "govtool.cardanoapi.io" - "preview.gov.tools" - "gov.tools" + - "p80-z78acf3c2-zded6a792-gtw.z937eb260.rustrocks.fr" network: required: true type: choice From 253442498935655ee024199b0e5356201e2cac3e Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 25 Apr 2025 13:11:20 +0545 Subject: [PATCH 08/11] chore: spilt auth setup to AdaHolder and User --- .../playwright/playwright.config.ts | 14 ++++++++----- ...{auth.setup.ts => adaholder.auth.setup.ts} | 5 ----- .../playwright/tests/user.auth.setup.ts | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) rename tests/govtool-frontend/playwright/tests/{auth.setup.ts => adaholder.auth.setup.ts} (91%) create mode 100644 tests/govtool-frontend/playwright/tests/user.auth.setup.ts diff --git a/tests/govtool-frontend/playwright/playwright.config.ts b/tests/govtool-frontend/playwright/playwright.config.ts index 40d6d7593..457c8d0a4 100644 --- a/tests/govtool-frontend/playwright/playwright.config.ts +++ b/tests/govtool-frontend/playwright/playwright.config.ts @@ -44,8 +44,12 @@ export default defineConfig({ /* Configure projects for major browsers */ projects: [ { - name: "auth setup", - testMatch: "**/auth.setup.ts", + name: "adaholder auth setup", + testMatch: "**/adaholder.auth.setup.ts", + }, + { + name: "user auth setup", + testMatch: "**/user.auth.setup.ts", }, { name: "faucet setup", @@ -89,7 +93,7 @@ export default defineConfig({ name: "transaction", use: { ...devices["Desktop Chrome"] }, testMatch: "**/*.tx.spec.ts", - dependencies: environments.ci ? ["auth setup", "wallet bootstrap"] : [], + dependencies: environments.ci ? ["adaholder auth setup", "wallet bootstrap"] : [], }, { name: "proposal discussion", @@ -120,7 +124,7 @@ export default defineConfig({ name: "loggedin (desktop)", use: { ...devices["Desktop Chrome"] }, testMatch: "**/*.loggedin.spec.ts", - dependencies: environments.ci ? ["auth setup", "wallet bootstrap"] : [], + dependencies: environments.ci ? ["user auth setup"] : [], }, { name: "proposal budget dRep", @@ -145,7 +149,7 @@ export default defineConfig({ use: { ...devices["Desktop Chrome"] }, testMatch: "**/*.delegation.spec.ts", dependencies: environments.ci - ? ["auth setup", "dRep setup", "wallet bootstrap"] + ? ["adaholder auth setup", "dRep setup", "wallet bootstrap"] : [], teardown: environments.ci && "cleanup delegation", }, diff --git a/tests/govtool-frontend/playwright/tests/auth.setup.ts b/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts similarity index 91% rename from tests/govtool-frontend/playwright/tests/auth.setup.ts rename to tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts index 9564a3adb..05200738d 100644 --- a/tests/govtool-frontend/playwright/tests/auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts @@ -1,5 +1,3 @@ -// Saves storage state to a file in the .auth directory - import { adaHolder01AuthFile, adaHolder02AuthFile, @@ -7,7 +5,6 @@ import { adaHolder04AuthFile, adaHolder05AuthFile, adaHolder06AuthFile, - user01AuthFile, } from "@constants/auth"; import { adaHolder01Wallet, @@ -16,7 +13,6 @@ import { adaHolder04Wallet, adaHolder05Wallet, adaHolder06Wallet, - user01Wallet, } from "@constants/staticWallets"; import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; @@ -30,7 +26,6 @@ setup.beforeEach(async () => { }); const authConfigs = [ - { name: "User 01", wallet: user01Wallet, auth: user01AuthFile }, { name: "AdaHolder 01", wallet: adaHolder01Wallet, diff --git a/tests/govtool-frontend/playwright/tests/user.auth.setup.ts b/tests/govtool-frontend/playwright/tests/user.auth.setup.ts new file mode 100644 index 000000000..18462da0f --- /dev/null +++ b/tests/govtool-frontend/playwright/tests/user.auth.setup.ts @@ -0,0 +1,21 @@ +import { user01AuthFile } from "@constants/auth"; +import { user01Wallet } from "@constants/staticWallets"; +import { test as setup } from "@fixtures/walletExtension"; +import { setAllureEpic, setAllureStory } from "@helpers/allure"; +import { createAuth } from "@helpers/auth"; +import { skipIfNotHardFork } from "@helpers/cardano"; + +setup.beforeEach(async () => { + await setAllureEpic("Setup"); + await setAllureStory("Authentication"); + await skipIfNotHardFork(); +}); + +setup("Create User 01 auth", async ({ page, context }) => { + await createAuth({ + page, + context, + wallet: user01Wallet, + auth: user01AuthFile, + }); +}); From 1dded8376ac656ccf9c533f46cf9a88b7c950607 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 25 Apr 2025 13:45:45 +0545 Subject: [PATCH 09/11] chore: add registration related test to dRepRegistration directory instead of misc --- .../dRepRegistration.dRep.spec.ts | 9 +++++++ .../dRepRegistration.loggedin.spec.ts | 9 +++++++ .../miscellaneous.dRep.spec.ts | 27 ------------------- .../miscellaneous.loggedin.spec.ts | 9 ------- 4 files changed, 18 insertions(+), 36 deletions(-) delete mode 100644 tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts 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 aebb4e83d..1172ac5fc 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 @@ -100,6 +100,15 @@ test.describe("Logged in DReps", () => { }); await page.getByTestId("confirm-modal-button").click(); }); + + test("3S. 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: 60_000, + }); + await expect(page.getByTestId("name-input")).not.toBeVisible(); + }); }); test.describe("Temporary DReps", () => { 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 a71bc2f16..bdd5508eb 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 @@ -9,6 +9,7 @@ import DRepRegistrationPage from "@pages/dRepRegistrationPage"; import { expect } from "@playwright/test"; import environments from "@constants/environments"; import { user01AuthFile } from "@constants/auth"; +import EditDRepPage from "@pages/editDRepPage"; test.use({ storageState: user01AuthFile, @@ -224,3 +225,11 @@ test("3O. Should reject invalid dRep registration metadata", async ({ /your external data does not/i ); }); + +test("3R. Should restrict edit dRep for non dRep", async ({ page }) => { + const editDrepPage = new EditDRepPage(page); + await editDrepPage.goto(); + + await page.waitForTimeout(2_000); + await expect(editDrepPage.nameInput).not.toBeVisible(); +}); 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 deleted file mode 100644 index adacbf67c..000000000 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.dRep.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { dRep01AuthFile } from "@constants/auth"; -import environments from "@constants/environments"; -import { dRep01Wallet } from "@constants/staticWallets"; -import { test } from "@fixtures/walletExtension"; -import { setAllureEpic } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; -import { expect } from "@playwright/test"; - -test.beforeEach(async () => { - await setAllureEpic("6. Miscellaneous"); - await skipIfNotHardFork(); - await skipIfMainnet(); -}); - -test.use({ - storageState: dRep01AuthFile, - wallet: dRep01Wallet, -}); - -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: 60_000, - }); - await expect(page.getByTestId("name-input")).not.toBeVisible(); -}); diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts index 3ea36f53b..0afa1fc02 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts @@ -17,7 +17,6 @@ import { ShelleyWallet } from "@helpers/crypto"; import { createNewPageWithWallet } from "@helpers/page"; import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; -import EditDRepPage from "@pages/editDRepPage"; import ProposalDiscussionPage from "@pages/proposalDiscussionPage"; import { Page, expect } from "@playwright/test"; @@ -95,14 +94,6 @@ test.describe("Logged in user", () => { ); }); - test("6G. Should restrict edit dRep for non dRep", async ({ page }) => { - const editDrepPage = new EditDRepPage(page); - await editDrepPage.goto(); - - await page.waitForTimeout(2_000); - await expect(editDrepPage.nameInput).not.toBeVisible(); - }); - test("6I. Should prompt for a username after clicking on proposal discussion link if username is not set", async ({ page, }) => { From 574d38771472dae42061147f2698c54885099e90 Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 28 Apr 2025 11:20:52 +0545 Subject: [PATCH 10/11] refactor: remove skipIfNotHardFork and its calls from various test setups --- .../playwright/lib/constants/staticWallets.ts | 2 +- .../govtool-frontend/playwright/lib/helpers/cardano.ts | 10 ---------- .../tests/2-delegation/delegation.drep.spec.ts | 3 +-- .../tests/2-delegation/delegation.loggedin.spec.ts | 2 -- .../playwright/tests/2-delegation/delegation.spec.ts | 2 -- .../delegationFunctionality.delegation.spec.ts | 3 +-- .../3-drep-registration/dRepRegistration.dRep.spec.ts | 3 +-- .../dRepRegistration.loggedin.spec.ts | 2 -- .../tests/3-drep-registration/dRepRegistration.spec.ts | 2 -- .../tests/3-drep-registration/editDRep.dRep.spec.ts | 3 +-- .../proposalVisibility.dRep.spec.ts | 2 -- .../proposalVisibility.loggedin.spec.ts | 2 -- .../4-proposal-visibility/proposalVisibility.spec.ts | 2 -- .../proposalFunctionality.dRep.spec.ts | 7 +------ .../proposalFunctionality.loggedin.spec.ts | 2 -- .../proposalFunctionality.spec.ts | 2 -- .../6-miscellaneous/miscellaneous.loggedin.spec.ts | 2 -- .../tests/6-miscellaneous/miscellaneous.spec.ts | 1 - .../proposalSubmission.ga.spec.ts | 3 +-- .../proposalSubmission.loggedin.pd.spec.ts | 2 -- .../7-proposal-submission/proposalSubmission.spec.ts | 2 -- .../proposalDiscussion.loggedin.pd.spec.ts | 2 -- .../8-proposal-discussion/proposalDiscussion.spec.ts | 3 +-- .../playwright/tests/9-outcomes/outcomes.spec.ts | 7 +------ .../playwright/tests/adaholder.auth.setup.ts | 2 -- .../playwright/tests/dRep.auth.setup.ts | 4 ++-- tests/govtool-frontend/playwright/tests/dRep.setup.ts | 3 +-- .../playwright/tests/delegation.teardown.ts | 3 +-- .../playwright/tests/proposal-budget.auth.setup.ts | 2 -- .../playwright/tests/proposal-budget.dRep.setup.ts | 3 +-- .../playwright/tests/proposal-discussion.auth.setup.ts | 2 -- .../playwright/tests/proposal.setup.ts | 3 +-- .../playwright/tests/user.auth.setup.ts | 2 -- 33 files changed, 15 insertions(+), 80 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts index b99da8816..7884a5be8 100644 --- a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts +++ b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts @@ -66,5 +66,5 @@ export const allStaticWallets = [ ...proposalWallets, faucetWallet, proposalFaucetWallet, - ...budgetProposalDRepWallets + ...budgetProposalDRepWallets, ]; diff --git a/tests/govtool-frontend/playwright/lib/helpers/cardano.ts b/tests/govtool-frontend/playwright/lib/helpers/cardano.ts index ad7126a94..ae9528a7b 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/cardano.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/cardano.ts @@ -47,16 +47,6 @@ export async function skipIfNotInfoAndBootstrapping(type: ProposalType) { } } -export async function skipIfNotHardFork() { - const currentProtocolVersion = await getProtocolParamsMajorVersion(); - if (currentProtocolVersion < 9) { - await allure.description( - "Govtool Features will be available after hardfork." - ); - test.skip(); - } -} - export async function skipIfMainnet() { if (environments.networkId === 1) { await allure.description( diff --git a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.drep.spec.ts b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.drep.spec.ts index 22e49433a..c712f7ec2 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.drep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.drep.spec.ts @@ -3,7 +3,7 @@ import { createTempDRepAuth } from "@datafactory/createAuth"; import { faker } from "@faker-js/faker"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { createNewPageWithWallet } from "@helpers/page"; import DRepRegistrationPage from "@pages/dRepRegistrationPage"; @@ -13,7 +13,6 @@ import walletManager from "lib/walletManager"; test.beforeEach(async () => { await setAllureEpic("2. Delegation"); - await skipIfNotHardFork(); await skipIfMainnet(); }); 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 3149c68d0..c0b6ed60a 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 @@ -2,7 +2,6 @@ import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { fetchFirstActiveDRepDetails } from "@helpers/dRep"; import { isMobile } from "@helpers/mobile"; @@ -14,7 +13,6 @@ test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("2. Delegation"); - await skipIfNotHardFork(); }); test("2B. Should access DRep Directory page", async ({ page }) => { 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 1bab08af8..b5b859ac2 100644 --- a/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts +++ b/tests/govtool-frontend/playwright/tests/2-delegation/delegation.spec.ts @@ -1,6 +1,5 @@ import environments from "@constants/environments"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { convertDRep, fetchFirstActiveDRepDetails } from "@helpers/dRep"; import { functionWaitedAssert } from "@helpers/waitedLoop"; import DRepDetailsPage from "@pages/dRepDetailsPage"; @@ -11,7 +10,6 @@ import { DRepStatus, IDRep, PaginatedDRepResponse } from "@types"; test.beforeEach(async () => { await setAllureEpic("2. Delegation"); - await skipIfNotHardFork(); }); enum SortOption { 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 5d3e71826..0c5c1e2dd 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 @@ -24,7 +24,7 @@ import { correctDRepDirectoryFormat, } from "@helpers/adaFormat"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { createNewPageWithWallet } from "@helpers/page"; import { waitForTxConfirmation } from "@helpers/transaction"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; @@ -35,7 +35,6 @@ import walletManager from "lib/walletManager"; test.beforeEach(async () => { await setAllureEpic("2. Delegation"); - await skipIfNotHardFork(); await skipIfMainnet(); }); 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 1172ac5fc..f97449614 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 @@ -5,7 +5,7 @@ import { faker } from "@faker-js/faker"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { ShelleyWallet } from "@helpers/crypto"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { createNewPageWithWallet } from "@helpers/page"; import { waitForTxConfirmation } from "@helpers/transaction"; import DRepRegistrationPage from "@pages/dRepRegistrationPage"; @@ -18,7 +18,6 @@ import { dRep01AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); - await skipIfNotHardFork(); await skipIfMainnet(); }); 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 bdd5508eb..35e20f006 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 @@ -4,7 +4,6 @@ import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { ShelleyWallet } from "@helpers/crypto"; import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; -import { skipIfNotHardFork } from "@helpers/cardano"; import DRepRegistrationPage from "@pages/dRepRegistrationPage"; import { expect } from "@playwright/test"; import environments from "@constants/environments"; @@ -18,7 +17,6 @@ test.use({ test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); - await skipIfNotHardFork(); }); test("3B. Should access DRep registration page", async ({ page }) => { diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.spec.ts index 594aaed3b..204762cb7 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.spec.ts @@ -1,11 +1,9 @@ import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { expect } from "@playwright/test"; import { test } from "@fixtures/walletExtension"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); - await skipIfNotHardFork(); }); test("3C. Should open wallet connection popup on DRep registration in disconnected state", 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 11f186292..59ee9f0eb 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 @@ -4,7 +4,7 @@ import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { ShelleyWallet } from "@helpers/crypto"; import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import EditDRepPage from "@pages/editDRepPage"; import { expect } from "@playwright/test"; import environments from "@constants/environments"; @@ -12,7 +12,6 @@ import { dRep02AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); - await skipIfNotHardFork(); await skipIfMainnet(); }); 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 e2855c60e..b9ceb02a8 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 @@ -8,7 +8,6 @@ import { isBootStrapingPhase, lovelaceToAda, skipIfMainnet, - skipIfNotHardFork, } from "@helpers/cardano"; import { createNewPageWithWallet } from "@helpers/page"; import GovernanceActionsPage from "@pages/governanceActionsPage"; @@ -27,7 +26,6 @@ import { dRep01AuthFile } from "@constants/auth"; test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); - await skipIfNotHardFork(); await skipIfMainnet(); }); diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts index 0f400617a..afc6b5f5d 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.loggedin.spec.ts @@ -2,7 +2,6 @@ import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { isMobile, openDrawer } from "@helpers/mobile"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect } from "@playwright/test"; @@ -11,7 +10,6 @@ test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); - await skipIfNotHardFork(); }); test("4A_1. Should access Governance Actions page with connecting wallet", async ({ 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 9447e2906..1127032ab 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 @@ -1,6 +1,5 @@ import { correctVoteAdaFormat } from "@helpers/adaFormat"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { areCCVoteTotalsDisplayed, areDRepVoteTotalsDisplayed, @@ -19,7 +18,6 @@ import { InvalidMetadata } from "@constants/index"; test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); - await skipIfNotHardFork(); }); const infoTypeProposal: PaginatedLiveProposal = require("../../lib/_mock/infoTypeProposal.json"); 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 4a0b9c5d8..8a21e99f1 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 @@ -5,11 +5,7 @@ import { createTempDRepAuth } from "@datafactory/createAuth"; import { faker } from "@faker-js/faker"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { - isBootStrapingPhase, - skipIfMainnet, - skipIfNotHardFork, -} from "@helpers/cardano"; +import { isBootStrapingPhase, skipIfMainnet } from "@helpers/cardano"; import { encodeCIP129Identifier } from "@helpers/encodeDecode"; import { createNewPageWithWallet } from "@helpers/page"; import { waitForTxConfirmation } from "@helpers/transaction"; @@ -23,7 +19,6 @@ import walletManager from "lib/walletManager"; test.beforeEach(async () => { await setAllureEpic("5. Proposal functionality"); - await skipIfNotHardFork(); await skipIfMainnet(); }); diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts index dd0bb116c..de7b3e4ce 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.loggedin.spec.ts @@ -2,14 +2,12 @@ import { user01AuthFile } from "@constants/auth"; import { user01Wallet } from "@constants/staticWallets"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { expect } from "@playwright/test"; test.use({ storageState: user01AuthFile, wallet: user01Wallet }); test.beforeEach(async () => { await setAllureEpic("5. Proposal functionality"); - await skipIfNotHardFork(); }); test("5J. Should hide retirement option for non-registered DRep", async ({ diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.spec.ts index 595566e79..4d859570b 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.spec.ts @@ -1,13 +1,11 @@ import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect } from "@playwright/test"; const invalidInfinityProposals = require("../../lib/_mock/invalidInfinityProposals.json"); test.beforeEach(async () => { await setAllureEpic("5. Proposal functionality"); - await skipIfNotHardFork(); }); test.describe("Bad Proposals", () => { let govActionsPage: GovernanceActionsPage; diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts index 0afa1fc02..08c1bca6e 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.loggedin.spec.ts @@ -12,7 +12,6 @@ import { user01Wallet } from "@constants/staticWallets"; import { createTempUserAuth } from "@datafactory/createAuth"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { createNewPageWithWallet } from "@helpers/page"; import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; @@ -22,7 +21,6 @@ import { Page, expect } from "@playwright/test"; test.beforeEach(async () => { await setAllureEpic("6. Miscellaneous"); - await skipIfNotHardFork(); }); test.describe("Logged in user", () => { diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts index f10ee426c..6692c6c55 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -13,7 +13,6 @@ import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { isMobile, openDrawer } from "@helpers/mobile"; import { expect, Page } from "@playwright/test"; -import { allure } from "allure-playwright"; import environments from "lib/constants/environments"; test.beforeEach(async () => { 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 fbfa52a6a..a9ab165f7 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 @@ -7,7 +7,7 @@ import { waitForTxConfirmation } from "@helpers/transaction"; import ProposalDiscussionPage from "@pages/proposalDiscussionPage"; import ProposalSubmissionPage from "@pages/proposalSubmissionPage"; import { expect } from "@playwright/test"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { ProposalType } from "@types"; import { proposalFaucetWallet } from "@constants/proposalFaucetWallet"; import walletManager from "lib/walletManager"; @@ -15,7 +15,6 @@ import { valid } from "@mock/index"; test.beforeEach(async () => { await setAllureEpic("7. Proposal submission"); - await skipIfNotHardFork(); await skipIfMainnet(); }); 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 1618eede4..f4b0bdf36 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 @@ -17,7 +17,6 @@ import { setAllureEpic } from "@helpers/allure"; import { getDraftProposalWalletAndState } from "@helpers/auth"; import { skipIfNotInfoAndBootstrapping, - skipIfNotHardFork, isBootStrapingPhase, } from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; @@ -30,7 +29,6 @@ import { ProposalCreateRequest, ProposalType } from "@types"; test.beforeEach(async () => { await setAllureEpic("7. Proposal submission"); - await skipIfNotHardFork(); }); test.describe("Proposal created logged state", () => { diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.spec.ts index 41c1036be..a7063eb8c 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.spec.ts @@ -1,11 +1,9 @@ import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { expect } from "@playwright/test"; import { test } from "@fixtures/walletExtension"; test.beforeEach(async () => { await setAllureEpic("7. Proposal submission"); - await skipIfNotHardFork(); }); test("7A. Should open wallet connection popup, when propose a governance action in disconnected state.", async ({ diff --git a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts index 9066ba1d5..62b91df76 100644 --- a/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts +++ b/tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.loggedin.pd.spec.ts @@ -9,7 +9,6 @@ import { createNewPageWithWallet } from "@helpers/page"; import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage"; import { Page, expect } from "@playwright/test"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import ProposalSubmissionPage from "@pages/proposalSubmissionPage"; import { proposal01AuthFile, @@ -19,7 +18,6 @@ import { test.beforeEach(async () => { await setAllureEpic("8. Proposal Discussion Forum"); - await skipIfNotHardFork(); }); test.describe("Proposal created logged in state", () => { 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 84d6b408e..e4303ae9b 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 @@ -6,7 +6,7 @@ import { import { faker } from "@faker-js/faker"; import { test } from "@fixtures/proposal"; import { setAllureEpic } from "@helpers/allure"; -import { isBootStrapingPhase, skipIfNotHardFork } from "@helpers/cardano"; +import { isBootStrapingPhase } from "@helpers/cardano"; import { injectLogger } from "@helpers/page"; import { extractProposalIdFromUrl } from "@helpers/string"; import { functionWaitedAssert } from "@helpers/waitedLoop"; @@ -21,7 +21,6 @@ const mockComments = require("../../lib/_mock/proposalComments.json"); test.beforeEach(async () => { await setAllureEpic("8. Proposal Discussion Forum"); - await skipIfNotHardFork(); }); test("8A. Should access proposed governance actions in disconnected state", async ({ 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 bdce3eacc..0976ebb49 100644 --- a/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts +++ b/tests/govtool-frontend/playwright/tests/9-outcomes/outcomes.spec.ts @@ -1,11 +1,7 @@ import { InvalidMetadata } from "@constants/index"; import { test } from "@fixtures/walletExtension"; -import { - correctVoteAdaFormat, - formatWithThousandSeparator, -} from "@helpers/adaFormat"; +import { formatWithThousandSeparator } from "@helpers/adaFormat"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import extractExpiryDateFromText from "@helpers/extractExpiryDateFromText"; import { areCCVoteTotalsDisplayed, @@ -24,7 +20,6 @@ const invalidOutcomeProposals = require("../../lib/_mock/outcome.json"); test.beforeEach(async () => { await setAllureEpic("9. Outcomes"); - await skipIfNotHardFork(); }); const status = ["Expired", "Ratified", "Enacted", "Live"]; diff --git a/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts b/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts index 05200738d..e812af725 100644 --- a/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/adaholder.auth.setup.ts @@ -17,12 +17,10 @@ import { import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; import { createAuth, createAuthWithMultipleStake } from "@helpers/auth"; -import { skipIfNotHardFork } from "@helpers/cardano"; setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); - await skipIfNotHardFork(); }); const authConfigs = [ diff --git a/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts index e731527e9..f1593d593 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.auth.setup.ts @@ -3,12 +3,12 @@ import { dRep01Wallet, dRep02Wallet } from "@constants/staticWallets"; import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; import { createAuth } from "@helpers/auth"; -import { skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); - await skipIfNotHardFork(); + await skipIfMainnet(); }); const drepAuthConfigs = [ diff --git a/tests/govtool-frontend/playwright/tests/dRep.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.setup.ts index 9dde14e07..25792139f 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.setup.ts @@ -1,7 +1,7 @@ import environments from "@constants/environments"; import { dRepWallets } from "@constants/staticWallets"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { uploadMetadataAndGetJsonHash } from "@helpers/metadata"; import { generateWallets } from "@helpers/shellyWallet"; import { pollTransaction } from "@helpers/transaction"; @@ -31,7 +31,6 @@ setup.beforeAll(async () => { setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Register DRep"); - await skipIfNotHardFork(); await skipIfMainnet(); }); diff --git a/tests/govtool-frontend/playwright/tests/delegation.teardown.ts b/tests/govtool-frontend/playwright/tests/delegation.teardown.ts index 5534439f1..f1d4b279b 100644 --- a/tests/govtool-frontend/playwright/tests/delegation.teardown.ts +++ b/tests/govtool-frontend/playwright/tests/delegation.teardown.ts @@ -1,7 +1,7 @@ import environments from "@constants/environments"; import { adaHolderWallets } from "@constants/staticWallets"; import { setAllureStory, setAllureEpic } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { pollTransaction } from "@helpers/transaction"; import { test as cleanup } from "@fixtures/walletExtension"; import kuberService from "@services/kuberService"; @@ -10,7 +10,6 @@ cleanup.describe.configure({ timeout: environments.txTimeOut }); cleanup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Cleanup"); - await skipIfNotHardFork(); await skipIfMainnet(); }); cleanup(`Abstain delegation`, async () => { diff --git a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts index d908960bd..a4e24036b 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts @@ -15,12 +15,10 @@ import { import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; import { createAuthWithUserName } from "@helpers/auth"; -import { skipIfNotHardFork } from "@helpers/cardano"; setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); - await skipIfNotHardFork(); }); const walletAuthPairs = [ diff --git a/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts index ed7dbbc06..48137cc4c 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.dRep.setup.ts @@ -4,7 +4,7 @@ import { dRepWallets, } from "@constants/staticWallets"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { uploadMetadataAndGetJsonHash } from "@helpers/metadata"; import { pollTransaction } from "@helpers/transaction"; import { expect } from "@playwright/test"; @@ -15,7 +15,6 @@ import kuberService from "@services/kuberService"; setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Register DRep"); - await skipIfNotHardFork(); await skipIfMainnet(); }); diff --git a/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts index dee4bbf94..5240acd4e 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-discussion.auth.setup.ts @@ -1,5 +1,4 @@ import { setAllureEpic, setAllureStory } from "@helpers/allure"; -import { skipIfNotHardFork } from "@helpers/cardano"; import { test as setup } from "@fixtures/walletExtension"; import { createAuthWithUserName } from "@helpers/auth"; import { @@ -28,7 +27,6 @@ import { setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); - await skipIfNotHardFork(); }); const proposalSetups = [ diff --git a/tests/govtool-frontend/playwright/tests/proposal.setup.ts b/tests/govtool-frontend/playwright/tests/proposal.setup.ts index 09192d3c8..9f905b426 100644 --- a/tests/govtool-frontend/playwright/tests/proposal.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal.setup.ts @@ -1,7 +1,7 @@ import environments from "@constants/environments"; import { proposalFaucetWallet } from "@constants/proposalFaucetWallet"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; -import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; +import { skipIfMainnet } from "@helpers/cardano"; import { generateWallets } from "@helpers/shellyWallet"; import { pollTransaction } from "@helpers/transaction"; import { test as setup } from "@fixtures/walletExtension"; @@ -26,7 +26,6 @@ setup.beforeAll(async () => { setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Proposal"); - await skipIfNotHardFork(); await skipIfMainnet(); }); diff --git a/tests/govtool-frontend/playwright/tests/user.auth.setup.ts b/tests/govtool-frontend/playwright/tests/user.auth.setup.ts index 18462da0f..9f012a83e 100644 --- a/tests/govtool-frontend/playwright/tests/user.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/user.auth.setup.ts @@ -3,12 +3,10 @@ import { user01Wallet } from "@constants/staticWallets"; import { test as setup } from "@fixtures/walletExtension"; import { setAllureEpic, setAllureStory } from "@helpers/allure"; import { createAuth } from "@helpers/auth"; -import { skipIfNotHardFork } from "@helpers/cardano"; setup.beforeEach(async () => { await setAllureEpic("Setup"); await setAllureStory("Authentication"); - await skipIfNotHardFork(); }); setup("Create User 01 auth", async ({ page, context }) => { From 3c3eeece68812eb3da7245c5b61268ab4ad2e74f Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 28 Apr 2025 11:21:10 +0545 Subject: [PATCH 11/11] chore: add skipIfMainnet check to proposal budget test setup --- .../tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts index ab4e76254..8e38001f0 100644 --- a/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts +++ b/tests/govtool-frontend/playwright/tests/11-proposal-budget/proposalBudget.dRep.pb.spec.ts @@ -6,9 +6,11 @@ import { expect } from "@playwright/test"; import { dRep03Wallet } from "@constants/staticWallets"; import BudgetDiscussionPage from "@pages/budgetDiscussionPage"; import { dRep03AuthFile } from "@constants/auth"; +import { skipIfMainnet } from "@helpers/cardano"; test.beforeEach(async () => { await setAllureEpic("11. Proposal Budget"); + await skipIfMainnet(); }); test.describe("Budget proposal dRep behaviour", () => {