From a20fc7785c5f19c2308b1fb4be3ca3e3c4be6906 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 23 May 2025 12:58:21 +0545 Subject: [PATCH 01/11] fix: update test to align with new landing page --- tests/govtool-frontend/playwright/lib/pages/loginPage.ts | 4 +++- .../playwright/tests/1-wallet-connect/walletConnect.spec.ts | 4 ++-- .../tests/3-drep-registration/dRepRegistration.spec.ts | 2 +- .../tests/4-proposal-visibility/proposalVisibility.spec.ts | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/loginPage.ts b/tests/govtool-frontend/playwright/lib/pages/loginPage.ts index 13c95ecab..f530c0f83 100644 --- a/tests/govtool-frontend/playwright/lib/pages/loginPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/loginPage.ts @@ -6,7 +6,9 @@ import { isMobile, openDrawer } from "@helpers/mobile"; import { Page, expect } from "@playwright/test"; export default class LoginPage { - readonly connectWalletBtn = this.page.getByTestId("connect-wallet-button"); + readonly connectWalletBtn = this.page + .getByTestId("connect-wallet-button") + .first(); readonly demosWalletBtn = this.page.getByTestId("demos-wallet-button"); readonly acceptSanchoNetInfoBtn = this.page .getByTestId("confirm-modal-button") diff --git a/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.spec.ts b/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.spec.ts index 557b55cd1..66eb07d3b 100644 --- a/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.spec.ts +++ b/tests/govtool-frontend/playwright/tests/1-wallet-connect/walletConnect.spec.ts @@ -52,7 +52,7 @@ test("1D. Should reject wallet connection if on different network", async ({ await page.goto("/"); - await page.getByTestId("connect-wallet-button").click(); + await page.getByTestId("connect-wallet-button").first().click(); await page.getByTestId("demos-wallet-button").click(); await expect(page.getByTestId("wallet-connection-error-modal")).toHaveText( @@ -70,7 +70,7 @@ test("1E. Should hide incompatible wallets when connecting", async ({ }); await newPage.goto("/"); - await newPage.getByTestId("connect-wallet-button").click(); + await newPage.getByTestId("connect-wallet-button").first().click(); await expect(newPage.getByTestId("demos-wallet-button")).not.toBeVisible(); }); 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 204762cb7..c1b892e63 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 @@ -11,6 +11,6 @@ test("3C. Should open wallet connection popup on DRep registration in disconnect }) => { await page.goto("/"); - await page.getByTestId("register-connect-wallet-button").click(); + await page.getByLabel("Become a DRep. DReps are").click(); //BUG missing test id await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible(); }); 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 1127032ab..e94028d93 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 @@ -42,9 +42,9 @@ test("4A_2. Should access Governance Actions page without connecting wallet", as page, }) => { await page.goto("/"); - await page.getByTestId("move-to-governance-actions-button").click(); + await page.getByLabel("View Live Voting. See how the").click(); // BUG missing test id - await expect(page.getByText(/Governance actions/i)).toHaveCount(1); + await expect(page.getByText(/live voting/i)).toHaveCount(2); }); test("4B_2. Should restrict voting for users who are not registered as DReps (without wallet connected)", async ({ From c4e781070a6d2c06f60e9053fa9ff622524c6952 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 23 May 2025 12:58:39 +0545 Subject: [PATCH 02/11] feat: add additional Cardano governance URLs --- .../playwright/lib/constants/docsUrl.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts b/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts index 88953c3fa..48bd8d711 100644 --- a/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts +++ b/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts @@ -13,3 +13,25 @@ export const PRIVACY_POLICY = `https://docs.intersectmbo.org/legal/policies-and- export const TERMS_AND_CONDITIONS = `https://docs.intersectmbo.org/legal/policies-and-conditions/terms-of-use`; export const HELP_DOC_URL = `${environments.docsUrl}/support`; export const BOOTSTRAP_DOC_URL = `${environments.docsUrl}/faqs/bootstrapping-phase`; +export const REPO_URL = "https://github.com/IntersectMBO/govtool"; +export const DOCS_URL = environments.docsUrl.replace("cardano-govtool", ""); +export const GOVERNANCE_OVERVIEW_DOC_URL = + "https://docs.cardano.org/about-cardano/governance-overview"; + +// other cardano governance urls + +export const CCPortal = "https://constitution.gov.tools/en"; +export const intersectWebsite = "https://www.intersectmbo.org/"; +export const tempo = "https://tempo.vote/"; +export const sixteenNinetyFour = "https://www.1694.io/en"; +export const governanceSpace = "https://governancespace.com/en-us"; +export const syncAi = "https://www.syncgovhub.com/app"; +export const ekklesia = "https://2025budget.intersectmbo.org/"; +export const adaStat = "https://adastat.net/"; +export const cexplorer = "https://cexplorer.io/"; +export const cardanoScan = "https://cardanoscan.io/"; +export const cardanoBudget = "https://cardanobudget.com/"; +export const budgetCardanoAfrica = "https://budget.cardano.africa/"; +export const reachYourPeople = "https://www.ryp.io/"; +export const sixteenNinetyFourTools = "https://1694-tools.vercel.app/"; +export const sanchonetGovernanceExplorer = "https://sancho.cardanoconnect.io/"; From 5179924e4e38369020f098e3355df9505e592369 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 23 May 2025 12:59:46 +0545 Subject: [PATCH 03/11] feat: add tests for landing page navigation on wallet connection --- .../playwright/lib/constants/index.ts | 10 +++++++ .../miscellaneous.loggedin.spec.ts | 27 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/index.ts b/tests/govtool-frontend/playwright/lib/constants/index.ts index 407772241..e6ac07192 100644 --- a/tests/govtool-frontend/playwright/lib/constants/index.ts +++ b/tests/govtool-frontend/playwright/lib/constants/index.ts @@ -61,3 +61,13 @@ export const InvalidMetadata: InvalidMetadataType[] = [ hash: "e71bf6171adda3754a87fff5c2d8d9e404eb3366428a5be13f7e76357a39004f", }, ]; + +export const connectToCardanoWalletSection = [ + { + label: "Register to Vote. Register", + urlPattern: /\/register_direct_voter/, + }, + { label: "Delegate your vote to a DRep", urlPattern: /\/drep_directory/ }, + { label: "Become a DRep. DReps are", urlPattern: /\/register_drep/ }, + { label: "Vote on Governace Actions.", urlPattern: /\governance_actions/ }, // Note: typo in original "Governace" +]; 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 08c1bca6e..4e22bf714 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 @@ -8,8 +8,11 @@ import { REGISTER_DREP_DOC_URL, SIGNAL_NO_CONFIDENCE_VOTE_DOC_URL, } from "@constants/docsUrl"; +import environments from "@constants/environments"; +import { connectToCardanoWalletSection } from "@constants/index"; import { user01Wallet } from "@constants/staticWallets"; import { createTempUserAuth } from "@datafactory/createAuth"; +import createWallet from "@fixtures/createWallet"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { ShelleyWallet } from "@helpers/crypto"; @@ -29,7 +32,7 @@ test.describe("Logged in user", () => { wallet: user01Wallet, }); - test("6E. Should open Sanchonet docs in a new tab when clicking `Learn More` on dashboards in connected state.", async ({ + test("6E. Should open docs in a new tab when clicking `Learn More` on dashboards in connected state.", async ({ page, context, }) => { @@ -104,6 +107,28 @@ test.describe("Logged in user", () => { }); }); +test.describe("Temporary user for landing page connected behaviour", () => { + connectToCardanoWalletSection.forEach((section, index) => { + test(`6N_${index + 1}. SHould navigate to specific page After connecting wallet of 'connect a cardano wallet to' section on dashboard in disconnect state`, async ({ + page, + }) => { + await createWallet(page, { + networkId: environments.networkId, + }); + await page.goto("/"); + await page.getByLabel(section.label).click(); //BUG missing test id + await page.getByTestId("demos-wallet-button").click({ force: true }); + + await page + .getByTestId("confirm-modal-button") + .nth(0) + .click({ force: true }); + + await expect(page).toHaveURL(section.urlPattern); + }); + }); +}); + test.describe("Temporary user", () => { let userPage: Page; let proposalDiscussionPage: ProposalDiscussionPage; From 789af5ddaaedb83ca931db1a503392c941277330 Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 23 May 2025 13:01:51 +0545 Subject: [PATCH 04/11] feat: refactor and add tests for landing page update --- .../6-miscellaneous/miscellaneous.spec.ts | 167 ++++++++++++++---- 1 file changed, 132 insertions(+), 35 deletions(-) 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 6692c6c55..a64cef089 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -1,18 +1,34 @@ import { - BOOTSTRAP_DOC_URL, - DELEGATION_DOC_URL, - DIRECT_VOTER_DOC_URL, + adaStat, + budgetCardanoAfrica, + cardanoBudget, + cardanoScan, + CCPortal, + cexplorer, + DOCS_URL, + ekklesia, FAQS_DOC_URL, + GOVERNANCE_OVERVIEW_DOC_URL, + governanceSpace, GUIDES_DOC_URL, HELP_DOC_URL, + intersectWebsite, PRIVACY_POLICY, - REGISTER_DREP_DOC_URL, + reachYourPeople, + REPO_URL, + sanchonetGovernanceExplorer, + sixteenNinetyFour, + sixteenNinetyFourTools, + syncAi, + tempo, TERMS_AND_CONDITIONS, } from "@constants/docsUrl"; +import { connectToCardanoWalletSection } from "@constants/index"; import { test } from "@fixtures/walletExtension"; import { setAllureEpic } from "@helpers/allure"; import { isMobile, openDrawer } from "@helpers/mobile"; import { expect, Page } from "@playwright/test"; +import { connect } from "http2"; import environments from "lib/constants/environments"; test.beforeEach(async () => { @@ -22,62 +38,143 @@ test.beforeEach(async () => { test("6C. Navigation within the dApp", async ({ page, context }) => { await page.goto("/"); - if (isMobile(page)) { - await openDrawer(page); + const dashboardCards = [ + { label: "Browse the DRep Directory.", urlPattern: /\/drep_directory/ }, + { + label: "View Live Voting. See how the", + urlPattern: /\/governance_actions/, + }, + { label: "View Voting Outcomes. See the", urlPattern: /\/outcomes/ }, + ]; + + for (const card of dashboardCards) { + await page.getByLabel(card.label).click(); // BUG missing test id + await expect(page).toHaveURL(card.urlPattern); + await page.goBack(); } - await page.getByTestId("governance-actions-link").click(); - await expect(page).toHaveURL(/\/governance_actions/); - if (isMobile(page)) { - await openDrawer(page); - } - const [guidesPage] = await Promise.all([ + + const [guidesPage2] = await Promise.all([ context.waitForEvent("page"), - page.getByTestId("guides-link").click(), + page.getByLabel("Read our Guides. The roadmap").click(), // BUG missing test id ]); - await expect(guidesPage).toHaveURL(GUIDES_DOC_URL); + await expect(guidesPage2).toHaveURL(GUIDES_DOC_URL); + + // Test navbar links navigation + const navbarLinks = [ + { testId: "dashboard-link", url: `${environments.frontendUrl}/` }, + { testId: "drep-directory-link", urlPattern: /\/drep_directory/ }, + { testId: "governance-actions-link", urlPattern: /\/governance_actions/ }, + { testId: "governance-actions-outcomes-link", urlPattern: /\/outcomes/ }, + ]; + + for (const link of navbarLinks) { + if (isMobile(page)) { + await openDrawer(page); + } + await page.getByTestId(link.testId).click(); + + if (link.url) { + expect(page.url()).toEqual(link.url); + } else { + await expect(page).toHaveURL(link.urlPattern); + } + } - if (isMobile(page)) { - await openDrawer(page); + // Test external links in navbar + const externalLinks = [ + { testId: "guides-link", url: GUIDES_DOC_URL }, + { testId: "faqs-link", url: FAQS_DOC_URL }, + ]; + + for (const link of externalLinks) { + if (isMobile(page)) { + await openDrawer(page); + } + const [newPage] = await Promise.all([ + context.waitForEvent("page"), + page.getByTestId(link.testId).click(), + ]); + await expect(newPage).toHaveURL(link.url); } - const [faqsPage] = await Promise.all([ - context.waitForEvent("page"), - page.getByTestId("faqs-link").click(), - ]); +}); + +test("6D. Should open wallet popup when navigating from 'Connect a Cardano wallet to' section on dashboard in disconnected state", async ({ + page, +}) => { + await page.goto("/"); + + const sections = connectToCardanoWalletSection.map( + (section) => section.label + ); - await expect(faqsPage).toHaveURL(FAQS_DOC_URL); + for (const sectionLabel of sections) { + await page.getByLabel(sectionLabel).click(); // BUG missing test id + await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible(); + await page.getByTestId("close-modal-button").click(); + } +}); + +test("6G. Should navigate between other cardano governance resources", async ({ + page, +}) => { + await page.goto("/"); - if (isMobile(page)) { - await openDrawer(page); + const resources = [ + { testId: "useful-link-ccPortal", url: CCPortal }, + { testId: "useful-link-intersectWebsite", url: intersectWebsite }, + { testId: "useful-link-tempo", url: tempo }, + { testId: "useful-link-1694io", url: sixteenNinetyFour }, + { testId: "useful-link-governanceSpace", url: governanceSpace }, + { testId: "useful-link-syncAi", url: syncAi }, + { testId: "useful-link-ekklesia", url: ekklesia }, + { testId: "useful-link-adaStat", url: adaStat }, + { testId: "useful-link-cexplorer", url: cexplorer }, + { testId: "useful-link-cardanoScan", url: cardanoScan }, + { testId: "useful-link-cardanoBudget", url: cardanoBudget }, + { testId: "useful-link-budgetCardanoAfrica", url: budgetCardanoAfrica }, + { testId: "useful-link-reachYourPeople", url: reachYourPeople }, + { testId: "useful-link-1694Tools", url: sixteenNinetyFourTools }, + { + testId: "useful-link-sanchonetGovernanceExplorer", + url: sanchonetGovernanceExplorer, + }, + ]; + + for (let resource of resources) { + const [newPage] = await Promise.all([ + page.context().waitForEvent("page"), + page.getByTestId(resource.testId).click(), + ]); + await expect(newPage).toHaveURL(resource.url); + await newPage.close(); } - await page.getByTestId("dashboard-link").click(); - expect(page.url()).toEqual(`${environments.frontendUrl}/`); }); -test("6D. Should open Sanchonet docs in a new tab when clicking `Learn More` on dashboards in disconnected state.", async ({ +test("6H. Should navigate between repository and documentation links", async ({ page, context, }) => { await page.goto("/"); - const [delegationLearnMorepage] = await Promise.all([ + const [repoPage] = await Promise.all([ context.waitForEvent("page"), - page.getByTestId("delegate-learn-more-button").click(), + page.getByLabel("GitHub Repo. View the GovTool").click(), // BUG missing test id ]); - await expect(delegationLearnMorepage).toHaveURL(DELEGATION_DOC_URL); + await expect(repoPage).toHaveURL(REPO_URL); - const [registerLearnMorepage] = await Promise.all([ + const [docsPage] = await Promise.all([ context.waitForEvent("page"), - page.getByTestId("d-rep-learn-more-button").click(), + page.getByLabel("Documentation. GovTool").click(), // BUG missing test id ]); - await expect(registerLearnMorepage).toHaveURL(REGISTER_DREP_DOC_URL); + await expect(docsPage).toHaveURL(DOCS_URL); - const [directVoterLearnMorepage] = await Promise.all([ + const [governance_overview] = await Promise.all([ context.waitForEvent("page"), - page.getByTestId("direct-voter-learn-more-button").click(), + page.getByTestId("link-to-docs").click(), ]); - await expect(directVoterLearnMorepage).toHaveURL(DIRECT_VOTER_DOC_URL); + await expect(governance_overview).toHaveURL(GOVERNANCE_OVERVIEW_DOC_URL); }); test("6M. Should navigate between footer links", async ({ page, context }) => { From 7fa565d23f0f601b39fd9ac9c7b8aacce020c9bb Mon Sep 17 00:00:00 2001 From: Niraj Date: Fri, 23 May 2025 13:28:33 +0545 Subject: [PATCH 05/11] fix: filter out undefined value from intercept proposals response --- .../4-proposal-visibility/proposalVisibility.dRep.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts index fd75c0b1d..c906eb47f 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 @@ -162,7 +162,9 @@ test.describe("Check vote count", () => { return data.elements; }) ) - ).flat(); + ) + .flat() + .filter((proposal): proposal is IProposal => proposal !== undefined); const uniqueProposalTypes = Array.from( new Map(proposals.map((proposal) => [proposal.type, proposal])).values() From c77dbc19a32cf1af9a40eec7fe36d50a3f21a66a Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 10:31:36 +0545 Subject: [PATCH 06/11] chore: update testId and add new sections on connect to cardano wallet --- .../playwright/lib/constants/index.ts | 41 +++++++++++++++++-- .../miscellaneous.loggedin.spec.ts | 4 +- .../6-miscellaneous/miscellaneous.spec.ts | 7 ++-- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/index.ts b/tests/govtool-frontend/playwright/lib/constants/index.ts index e6ac07192..79726d08f 100644 --- a/tests/govtool-frontend/playwright/lib/constants/index.ts +++ b/tests/govtool-frontend/playwright/lib/constants/index.ts @@ -64,10 +64,43 @@ export const InvalidMetadata: InvalidMetadataType[] = [ export const connectToCardanoWalletSection = [ { - label: "Register to Vote. Register", + testId: "home-card-discuss-budget-proposals", + urlPattern: /\/budget_discussion/, + label: "Discuss Budget Proposals", + }, + { + testId: "home-card-create-a-budget-proposal", + urlPattern: /\/budget_discussion/, + label: "Create a Budget Proposal", + }, + { + testId: "home-card-discuss-governance-actions", + urlPattern: /\/proposal_discussion/, + label: "Discuss Governance Actions", + }, + { + testId: "home-card-propose-a-governance-action", + urlPattern: /\/proposal_discussion\/propose/, + label: "Propose a Governance Action", + }, + { + testId: "home-card-register-to-vote", urlPattern: /\/register_direct_voter/, + label: "Register to Vote", + }, + { + testId: "home-card-delegate-your-vote-to-a-drep", + urlPattern: /\/drep_directory/, + label: "Delegate Your Vote to a DRep", + }, + { + testId: "home-card-become-a-drep", + urlPattern: /\/register_drep/, + Label: "Become a DRep", + }, + { + testId: "home-card-vote-on-governance-actions", + urlPattern: /\governance_actions/, + label: "Vote on Governance Actions", }, - { label: "Delegate your vote to a DRep", urlPattern: /\/drep_directory/ }, - { label: "Become a DRep. DReps are", urlPattern: /\/register_drep/ }, - { label: "Vote on Governace Actions.", urlPattern: /\governance_actions/ }, // Note: typo in original "Governace" ]; 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 4e22bf714..aa851f5b9 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 @@ -109,14 +109,14 @@ test.describe("Logged in user", () => { test.describe("Temporary user for landing page connected behaviour", () => { connectToCardanoWalletSection.forEach((section, index) => { - test(`6N_${index + 1}. SHould navigate to specific page After connecting wallet of 'connect a cardano wallet to' section on dashboard in disconnect state`, async ({ + test(`6N_${index + 1}. Should navigate to specific page after wallet connection on clicking '${section.label}'`, async ({ page, }) => { await createWallet(page, { networkId: environments.networkId, }); await page.goto("/"); - await page.getByLabel(section.label).click(); //BUG missing test id + await page.getByTestId(section.testId).click(); await page.getByTestId("demos-wallet-button").click({ force: true }); await page 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 a64cef089..193ce9a4e 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -53,7 +53,6 @@ test("6C. Navigation within the dApp", async ({ page, context }) => { await page.goBack(); } - const [guidesPage2] = await Promise.all([ context.waitForEvent("page"), page.getByLabel("Read our Guides. The roadmap").click(), // BUG missing test id @@ -106,11 +105,11 @@ test("6D. Should open wallet popup when navigating from 'Connect a Cardano walle await page.goto("/"); const sections = connectToCardanoWalletSection.map( - (section) => section.label + (section) => section.testId ); - for (const sectionLabel of sections) { - await page.getByLabel(sectionLabel).click(); // BUG missing test id + for (const sectionTestId of sections) { + await page.getByTestId(sectionTestId).click(); await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible(); await page.getByTestId("close-modal-button").click(); } From b2a32287068587d6453d71cdca44351b93e1eb51 Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 10:34:14 +0545 Subject: [PATCH 07/11] fix: update test IDs for GitHub repo and documentation link navigation tests --- .../playwright/tests/6-miscellaneous/miscellaneous.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 193ce9a4e..0c7319e1c 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -159,13 +159,13 @@ test("6H. Should navigate between repository and documentation links", async ({ const [repoPage] = await Promise.all([ context.waitForEvent("page"), - page.getByLabel("GitHub Repo. View the GovTool").click(), // BUG missing test id + page.getByTestId("home-card-github-repo").click(), ]); await expect(repoPage).toHaveURL(REPO_URL); const [docsPage] = await Promise.all([ context.waitForEvent("page"), - page.getByLabel("Documentation. GovTool").click(), // BUG missing test id + page.getByTestId("home-card-documentation").click(), ]); await expect(docsPage).toHaveURL(DOCS_URL); From da7683f980ceb6a4a06973d8ed8c222751b1e102 Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 10:42:34 +0545 Subject: [PATCH 08/11] chore: update testId and add new sections on open to any and add users --- .../6-miscellaneous/miscellaneous.spec.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) 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 0c7319e1c..c0709c374 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -39,23 +39,35 @@ test("6C. Navigation within the dApp", async ({ page, context }) => { await page.goto("/"); const dashboardCards = [ - { label: "Browse the DRep Directory.", urlPattern: /\/drep_directory/ }, { - label: "View Live Voting. See how the", + testId: "home-card-browse-the-drep-directory", + urlPattern: /\/drep_directory/, + }, + { + testId: "home-card-view-budget-proposals", + urlPattern: /\/budget_discussion/, + }, + { + testId: "home-card-see-proposed-governance-actions", + urlPattern: /\/proposal_discussion/, + }, + { + testId: "home-card-view-live-voting", urlPattern: /\/governance_actions/, }, - { label: "View Voting Outcomes. See the", urlPattern: /\/outcomes/ }, + { testId: "home-card-view-voting-outcomes", urlPattern: /\/outcomes/ }, ]; for (const card of dashboardCards) { - await page.getByLabel(card.label).click(); // BUG missing test id + await page.getByTestId(card.testId).click(); await expect(page).toHaveURL(card.urlPattern); await page.goBack(); } + // external links in dashboard cards const [guidesPage2] = await Promise.all([ context.waitForEvent("page"), - page.getByLabel("Read our Guides. The roadmap").click(), // BUG missing test id + page.getByTestId("home-card-read-our-guides").click(), ]); await expect(guidesPage2).toHaveURL(GUIDES_DOC_URL); @@ -99,7 +111,7 @@ test("6C. Navigation within the dApp", async ({ page, context }) => { } }); -test("6D. Should open wallet popup when navigating from 'Connect a Cardano wallet to' section on dashboard in disconnected state", async ({ +test("6D. Should open wallet popup when navigating from 'Connect a Cardano wallet to' sections on dashboard in disconnected state", async ({ page, }) => { await page.goto("/"); From 1e8eddf29c2b173222a19564478d26a2fa6f9e4d Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 10:53:21 +0545 Subject: [PATCH 09/11] chore: add missing navbar links on Navigation within the dApp test --- .../playwright/tests/6-miscellaneous/miscellaneous.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) 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 c0709c374..26b9f5cb6 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -76,6 +76,11 @@ test("6C. Navigation within the dApp", async ({ page, context }) => { const navbarLinks = [ { testId: "dashboard-link", url: `${environments.frontendUrl}/` }, { testId: "drep-directory-link", urlPattern: /\/drep_directory/ }, + { testId: "budget-discussion-link", urlPattern: /\/budget_discussion/ }, + { + testId: "proposed-governance-actions-link", + urlPattern: /\/proposal_discussion/, + }, { testId: "governance-actions-link", urlPattern: /\/governance_actions/ }, { testId: "governance-actions-outcomes-link", urlPattern: /\/outcomes/ }, ]; From b5054d90290396e9938ef7aecd8f04ce472dfb76 Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 11:02:27 +0545 Subject: [PATCH 10/11] fix: update test ID for wallet connection popup in proposal submission test --- .../tests/7-proposal-submission/proposalSubmission.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a7063eb8c..0939914a4 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 @@ -10,6 +10,6 @@ test("7A. Should open wallet connection popup, when propose a governance action page, }) => { await page.goto("/"); - await page.getByTestId("propose-a-governance-action-button").click(); + await page.getByTestId("home-card-propose-a-governance-action").click(); await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible(); }); From b561078207dc2f159ecf337f2970fca22b2c066f Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 26 May 2025 12:00:30 +0545 Subject: [PATCH 11/11] fix: updatelive voting and become a dRep test IDs in landing page test --- .../tests/3-drep-registration/dRepRegistration.spec.ts | 2 +- .../tests/4-proposal-visibility/proposalVisibility.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 c1b892e63..583bb9258 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 @@ -11,6 +11,6 @@ test("3C. Should open wallet connection popup on DRep registration in disconnect }) => { await page.goto("/"); - await page.getByLabel("Become a DRep. DReps are").click(); //BUG missing test id + await page.getByTestId("home-card-become-a-drep").click(); await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible(); }); 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 e94028d93..727278efe 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 @@ -42,7 +42,7 @@ test("4A_2. Should access Governance Actions page without connecting wallet", as page, }) => { await page.goto("/"); - await page.getByLabel("View Live Voting. See how the").click(); // BUG missing test id + await page.getByTestId("home-card-view-live-voting").click(); await expect(page.getByText(/live voting/i)).toHaveCount(2); });