From c87a1f5d3c2983c7dcbc19eabd5e099f9bc2340e Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 8 May 2025 12:12:58 +0545 Subject: [PATCH 1/2] feat: add budgetProposal05 wallet and its auth file references --- tests/govtool-frontend/playwright/lib/constants/auth.ts | 1 + .../playwright/lib/constants/staticWallets.ts | 1 + tests/govtool-frontend/playwright/package.json | 2 +- .../playwright/tests/proposal-budget.auth.setup.ts | 7 +++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/auth.ts b/tests/govtool-frontend/playwright/lib/constants/auth.ts index e2d85b948..b853b7c2b 100644 --- a/tests/govtool-frontend/playwright/lib/constants/auth.ts +++ b/tests/govtool-frontend/playwright/lib/constants/auth.ts @@ -25,3 +25,4 @@ export const budgetProposal01AuthFile = ".auth/budgetProposal01.json"; export const budgetProposal02AuthFile = ".auth/budgetProposal02.json"; export const budgetProposal03AuthFile = ".auth/budgetProposal03.json"; export const budgetProposal04AuthFile = ".auth/budgetProposal04.json"; +export const budgetProposal05AuthFile = ".auth/budgetProposal05.json"; diff --git a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts index 529551a51..396685bac 100644 --- a/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts +++ b/tests/govtool-frontend/playwright/lib/constants/staticWallets.ts @@ -30,6 +30,7 @@ export const budgetProposal01Wallet: StaticWallet = staticWallets[19]; export const budgetProposal02Wallet: StaticWallet = staticWallets[20]; export const budgetProposal03Wallet: StaticWallet = staticWallets[21]; export const budgetProposal04Wallet: StaticWallet = staticWallets[22]; +export const budgetProposal05Wallet: StaticWallet = staticWallets[23]; export const adaHolderWallets = [ adaHolder01Wallet, diff --git a/tests/govtool-frontend/playwright/package.json b/tests/govtool-frontend/playwright/package.json index 62bdac42d..b0127afe7 100644 --- a/tests/govtool-frontend/playwright/package.json +++ b/tests/govtool-frontend/playwright/package.json @@ -44,7 +44,7 @@ "test:headless:usersnap": "npx playwright test userSnap.spec.ts", "test:headless:misc": "npx playwright test miscellaneous", "format": "prettier . --write", - "generate-wallets": "ts-node ./generate_wallets.ts 23", + "generate-wallets": "ts-node ./generate_wallets.ts 24", "generate-faucet-wallet": "ts-node ./generate_faucet_wallet.ts" }, "dependencies": { 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 a4e24036b..6b0ab4ea8 100644 --- a/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts +++ b/tests/govtool-frontend/playwright/tests/proposal-budget.auth.setup.ts @@ -3,6 +3,7 @@ import { budgetProposal02AuthFile, budgetProposal03AuthFile, budgetProposal04AuthFile, + budgetProposal05AuthFile, dRep03AuthFile, } from "@constants/auth"; import { @@ -10,6 +11,7 @@ import { budgetProposal02Wallet, budgetProposal03Wallet, budgetProposal04Wallet, + budgetProposal05Wallet, dRep03Wallet, } from "@constants/staticWallets"; import { test as setup } from "@fixtures/walletExtension"; @@ -42,6 +44,11 @@ const walletAuthPairs = [ auth: budgetProposal04AuthFile, name: "Budget Proposal 04", }, + { + wallet: budgetProposal05Wallet, + auth: budgetProposal05AuthFile, + name: "Budget Proposal 05", + }, ]; walletAuthPairs.forEach(({ wallet, auth, name }) => { From ca9fa5b082818dabfea7d5e834347577f36d62c9 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 8 May 2025 12:13:35 +0545 Subject: [PATCH 2/2] tests: verify created proposal in my proposal list filter --- .../lib/pages/budgetDiscussionDetailsPage.ts | 3 +- .../lib/pages/budgetDiscussionPage.ts | 8 +++- ...oposalBudgetSubmission.loggedin.pb.spec.ts | 38 ++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionDetailsPage.ts b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionDetailsPage.ts index babcc07bb..7b578deb4 100644 --- a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionDetailsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionDetailsPage.ts @@ -19,6 +19,7 @@ export default class BudgetDiscussionDetailsPage { ); readonly verifyIdentityBtn = this.page.getByTestId("verify-identity-button"); readonly readMoreBtn = this.page.getByTestId("read-more-button"); + readonly menuButton = this.page.getByTestId("menu-button"); // content readonly copyLinkText = this.page.getByTestId("copy-link-text"); @@ -139,7 +140,7 @@ export default class BudgetDiscussionDetailsPage { async deleteProposal() { await this.page.waitForTimeout(2_000); - await this.page.getByTestId("menu-button").click(); + await this.menuButton.click(); await this.page.getByTestId("delete-proposal").click(); await this.page.getByTestId("delete-proposal-yes-button").click(); } diff --git a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts index 0d6264e8a..3ca0fa9db 100644 --- a/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/budgetDiscussionPage.ts @@ -13,6 +13,9 @@ export default class BudgetDiscussionPage { readonly verifyIdentityBtn = this.page.getByTestId("verify-identity-button"); readonly filterBtn = this.page.getByTestId("filter-button"); readonly sortBtn = this.page.getByTestId("sort-button"); + readonly myProposalBtn = this.page.getByTestId( + "My Proposals-owner-filter-option" + ); // input readonly searchInput = this.page.getByTestId("search-input"); @@ -49,7 +52,10 @@ export default class BudgetDiscussionPage { }); const proposalCards = await this.page.locator(proposalCardSelector).all(); - expect(true, "No budget proposals found.").toBeTruthy(); + expect( + true, + proposalCards.length === 0 && "No budget proposals found." + ).toBeTruthy(); return proposalCards; } 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 a2c320b8f..ce5863062 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 @@ -3,18 +3,21 @@ import { budgetProposal02AuthFile, budgetProposal03AuthFile, budgetProposal04AuthFile, + budgetProposal05AuthFile, } from "@constants/auth"; import { budgetProposal01Wallet, budgetProposal02Wallet, budgetProposal03Wallet, budgetProposal04Wallet, + budgetProposal05Wallet, } from "@constants/staticWallets"; import { faker } from "@faker-js/faker"; import { test } from "@fixtures/budgetProposal"; import { setAllureEpic } from "@helpers/allure"; import { createNewPageWithWallet } from "@helpers/page"; import BudgetDiscussionDetailsPage from "@pages/budgetDiscussionDetailsPage"; +import BudgetDiscussionPage from "@pages/budgetDiscussionPage"; import BudgetDiscussionSubmissionPage from "@pages/budgetDiscussionSubmissionPage"; import { expect } from "@playwright/test"; import { @@ -305,7 +308,7 @@ test.describe("Budget proposal 01 wallet", () => { await budgetProposalSubmissionPage.currentPage .getByTestId(`${contractingType}-button`) .click(); - if (contractingType === "Other") { + if (contractingType === "other") { await budgetProposalSubmissionPage.otherDescriptionInput.fill( faker.lorem.paragraph(2) ); @@ -510,3 +513,36 @@ test("12I. Should submit a valid draft budget proposal", async ({ await budgetDiscussionDetailsPage.deleteProposal(); }); + +test("12J. Should verify created proposal appears in my proposals list", async ({ + browser, +}) => { + test.slow(); + const page = await createNewPageWithWallet(browser, { + storageState: budgetProposal05AuthFile, + wallet: budgetProposal05Wallet, + }); + + const budgetSubmissionPage = new BudgetDiscussionSubmissionPage(page); + await budgetSubmissionPage.goto(); + const { proposalDetails } = await budgetSubmissionPage.createBudgetProposal(); + const budgetDiscussionPage = new BudgetDiscussionPage(page); + await budgetDiscussionPage.goto(); + + await budgetDiscussionPage.filterBtn.click(); + await budgetDiscussionPage.myProposalBtn.click(); + + const proposalList = await budgetDiscussionPage.getAllProposals(); + + expect(proposalList.length).toBeGreaterThan(0); + + // Close the filter dropdown to ensure the proposals list is visible + await budgetDiscussionPage.sortBtn.click({ force: true }); + const budgetDiscussionDetailsPage = + await budgetDiscussionPage.viewFirstProposal(); + + await expect(budgetDiscussionDetailsPage.menuButton).toBeVisible(); + await budgetDiscussionDetailsPage.validateProposalDetails(proposalDetails); + + await budgetDiscussionDetailsPage.deleteProposal(); +});