From 3257612eb921affd966599b0dd0b3f49cf9133d3 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 12:29:37 +0545 Subject: [PATCH 1/6] fix: check success alert is not visible before fill the form field --- tests/govtool-frontend/playwright/lib/forms/dRepForm.ts | 2 +- .../playwright/tests/2-delegation/delegation.drep.spec.ts | 2 ++ .../3-drep-registration/dRepRegistration.loggedin.spec.ts | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts index da80eed4d..e129edab9 100644 --- a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts +++ b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts @@ -205,7 +205,7 @@ export default class DRepForm { message: isPaymentAddressErrorVisible && `${dRepInfo.paymentAddress} is an invalid paymentAddress`, - }).toBeHidden(); + }).toBeHidden({ timeout: 60_000 }); await expect(this.continueBtn).toBeEnabled(); } 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 104ad40fa..b4f6ecf4b 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 @@ -56,6 +56,8 @@ test("2N. Should show DRep information on details page", async ({ }, ]; + await expect(dRepPage.getByTestId("alert-success")).not.toBeVisible(); + await dRepRegistrationPage.register({ name, objectives, 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 63592c0a1..2a19d17c0 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 @@ -59,6 +59,8 @@ test.describe("Validation of dRep Registration Form", () => { const dRepRegistrationPage = new DRepRegistrationPage(page); await dRepRegistrationPage.goto(); + await expect(page.getByTestId("alert-success")).not.toBeVisible(); + for (let i = 0; i < 100; i++) { await dRepRegistrationPage.validateForm({ name: mockValid.name(), @@ -102,6 +104,7 @@ test.describe("Validation of dRep Registration Form", () => { const dRepRegistrationPage = new DRepRegistrationPage(page); await dRepRegistrationPage.goto(); + await expect(page.getByTestId("alert-success")).not.toBeVisible(); for (let i = 0; i < 100; i++) { await dRepRegistrationPage.inValidateForm({ From 0f26352ee73925e9edf2c061111835b5aa4e3e14 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 12:41:58 +0545 Subject: [PATCH 2/6] fix: skip tests related to bootstrapping phase as it is no longer applicable --- .../proposalFunctionality.dRep.spec.ts | 5 +++++ .../playwright/tests/6-miscellaneous/miscellaneous.spec.ts | 5 +++++ 2 files changed, 10 insertions(+) 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 dd4f8e5a4..013310d04 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 @@ -17,6 +17,7 @@ import GovernanceActionsPage from "@pages/governanceActionsPage"; import { Page, expect } from "@playwright/test"; import kuberService from "@services/kuberService"; import { BootstrapGovernanceActionType, GovernanceActionType } from "@types"; +import { allure } from "allure-playwright"; import walletManager from "lib/walletManager"; test.beforeEach(async () => { @@ -274,6 +275,10 @@ test.describe("Bootstrap phase", () => { test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ browser, }) => { + await allure.description( + "Skipping this test as bootstrapping is no longer applicable." + ); + test.skip(); const voteBlacklistOptions = Object.keys( BootstrapGovernanceActionType ).filter((option) => option !== GovernanceActionType.InfoAction); 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 ca88fb50b..9d6dce579 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -13,6 +13,7 @@ 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 () => { @@ -106,6 +107,10 @@ test("6N. Should Warn users that they are in bootstrapping phase via banner", as page, context, }) => { + await allure.description( + "Skipping this test as bootstrapping is no longer applicable." + ); + test.skip(); await page.route("**/epoch/params", async (route) => { // Fetch the original response from the server const response = await route.fetch(); From 0c893e838a7d7ce39ef2306168a966e949890e39 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 13:51:56 +0545 Subject: [PATCH 3/6] fix: update dRep directory delegation format --- .../playwright/lib/helpers/adaFormat.ts | 7 +++++++ .../delegationFunctionality.delegation.spec.ts | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts b/tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts index 5a3521511..3082c39af 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts @@ -29,3 +29,10 @@ export const correctDelegatedVoteAdaFormat = (ada: number | undefined) => { } return "0"; }; + +export const correctDRepDirectoryFormat = (ada: number | undefined) => { + if (ada) { + return Number(ada.toFixed(0))?.toLocaleString("en-US"); + } + return "0"; +}; 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 aa824c536..9f71eefa2 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 @@ -11,7 +11,10 @@ import { } from "@constants/staticWallets"; import { createTempDRepAuth } from "@datafactory/createAuth"; import { test } from "@fixtures/walletExtension"; -import { correctDelegatedVoteAdaFormat } from "@helpers/adaFormat"; +import { + correctDelegatedVoteAdaFormat, + correctDRepDirectoryFormat, +} from "@helpers/adaFormat"; import { setAllureEpic } from "@helpers/allure"; import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano"; import { createNewPageWithWallet } from "@helpers/page"; @@ -265,7 +268,7 @@ test.describe("Abstain delegation", () => { await expect( page.getByText( - `You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}` + `You have delegated ₳${correctDRepDirectoryFormat(balance)}` ) ).toBeVisible({ timeout: 60_000, @@ -296,7 +299,7 @@ test.describe("No confidence delegation", () => { const balance = await kuberService.getBalance(adaHolder04Wallet.address); await expect( page.getByText( - `You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}` + `You have delegated ₳${correctDRepDirectoryFormat(balance)}` ) ).toBeVisible({ timeout: 60_000, @@ -325,7 +328,7 @@ test.describe("Delegated ADA visibility", () => { ); await expect( page.getByText( - `You have delegated ₳ ${correctDelegatedVoteAdaFormat(adaHolderVotingPower)}` + `You have delegated ₳ ${correctDRepDirectoryFormat(adaHolderVotingPower)}` ) ).toBeVisible({ timeout: 60_000 }); From fc836e33ad1696a75dcd9206aa0e7d51554105e1 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 14:05:31 +0545 Subject: [PATCH 4/6] fix: increase timeout and assert popup modal hidden --- .../playwright/lib/pages/dRepDirectoryPage.ts | 2 +- .../playwright/tests/2-delegation/delegation.drep.spec.ts | 7 +++++-- .../3-drep-registration/dRepRegistration.dRep.spec.ts | 2 +- .../tests/3-drep-registration/editDRep.dRep.spec.ts | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts index 6bf65cd4d..83dae3ba1 100644 --- a/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/dRepDirectoryPage.ts @@ -217,7 +217,7 @@ export default class DRepDirectoryPage { !isEmptyContainerVisible && `DRep with id ${dRepId} is found in the list`, }).toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); } } 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 b4f6ecf4b..01bc92533 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 @@ -73,7 +73,7 @@ test("2N. Should show DRep information on details page", async ({ // Add an assertion to prevent clicking on "View Your dRep Details". await expect( dRepPage.getByTestId("dRep-id-display-card-dashboard") - ).toContainText(wallet.dRepId, { timeout: 20_000 }); + ).toContainText(wallet.dRepId, { timeout: 60_000 }); await dRepPage.getByTestId("view-drep-details-button").click(); // Verification @@ -81,7 +81,10 @@ test("2N. Should show DRep information on details page", async ({ wallet.dRepId ); await expect(dRepPage.getByTestId("copy-payment-address-button")).toHaveText( - paymentAddress + paymentAddress, + { + timeout: 60_000, + } ); await expect(dRepPage.getByTestId("Active-pill")).toHaveText("Active"); await expect(dRepPage.getByTestId("voting-power")).toHaveText("₳ 0"); 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 9b87b0669..504248997 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 @@ -147,7 +147,7 @@ test.describe("Temporary DReps", () => { await dRepRegistrationPage.confirmBtn.click(); await expect(dRepPage.getByTestId("d-rep-in-progress")).not.toBeVisible({ - timeout: 20_000, + timeout: 60_000, }); // connected state 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 16a622102..873755f55 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 @@ -25,7 +25,7 @@ test.describe("Validation of edit dRep Form", () => { await editDRepPage.goto(); // wait until wallet alert close - await page.waitForTimeout(5_000); + await expect(page.getByTestId("alert-success")).not.toBeVisible(); for (let i = 0; i < 100; i++) { await editDRepPage.validateForm({ @@ -73,7 +73,7 @@ test.describe("Validation of edit dRep Form", () => { const editDRepPage = new EditDRepPage(page); await editDRepPage.goto(); - await expect(editDRepPage.nameInput).toBeVisible({ timeout: 60_000 }); // assert to wait for the page to load + await expect(page.getByTestId("alert-success")).not.toBeVisible(); for (let i = 0; i < 100; i++) { await editDRepPage.inValidateForm({ From 7fc1110733ab80a7510e16673de818b1b41dea96 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 15:32:55 +0545 Subject: [PATCH 5/6] fix: reload dRep page after re-voting to ensure updated state --- .../proposalFunctionality.dRep.spec.ts | 3 +++ 1 file changed, 3 insertions(+) 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 013310d04..a90a286cd 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 @@ -189,6 +189,9 @@ test.describe("Perform voting", () => { govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal(); await govActionDetailsPage.reVote(); + + await dRepPage.reload(); + await governanceActionsPage.votedTab.click(); const isNoVoteVisible = await govActionDetailsPage.currentPage From acd176e8de7c6562273c7d60b8b0275f641c4799 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 12 Mar 2025 16:55:22 +0545 Subject: [PATCH 6/6] chore: remove bootstraping test --- .../proposalFunctionality.dRep.spec.ts | 67 ------------------- .../6-miscellaneous/miscellaneous.spec.ts | 38 ----------- 2 files changed, 105 deletions(-) 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 a90a286cd..3f7e7e838 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 @@ -273,70 +273,3 @@ test.describe("Check voting power", () => { expect(balance, "Retirement deposit not returned").toBeGreaterThan(500); }); }); - -test.describe("Bootstrap phase", () => { - test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ - browser, - }) => { - await allure.description( - "Skipping this test as bootstrapping is no longer applicable." - ); - test.skip(); - const voteBlacklistOptions = Object.keys( - BootstrapGovernanceActionType - ).filter((option) => option !== GovernanceActionType.InfoAction); - - await Promise.all( - voteBlacklistOptions.map(async (voteBlacklistOption) => { - const dRepPage = await createNewPageWithWallet(browser, { - storageState: ".auth/dRep01.json", - wallet: dRep01Wallet, - }); - - await dRepPage.route("**/epoch/params", async (route) => { - // Fetch the original response from the server - const response = await route.fetch(); - const json = await response.json(); - - // update protocol major version - json["protocol_major"] = 9; - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify(json), - }); - }); - - const governanceActionsPage = new GovernanceActionsPage(dRepPage); - await governanceActionsPage.goto(); - - // assert to wait until proposal cards are visible - await expect(dRepPage.getByTestId("voting-power-chips")).toBeVisible({ - timeout: 60_000, - }); - // wait until the loading button is hidden - await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ - timeout: 60_000, - }); - - const governanceActionDetailsPage = - await governanceActionsPage.viewFirstProposalByGovernanceAction( - voteBlacklistOption as GovernanceActionType - ); - - if (governanceActionDetailsPage) { - await expect( - dRepPage.getByTestId("governance-action-details-card-header") - ).toBeVisible({ timeout: 60_000 }); - await expect( - governanceActionDetailsPage.yesVoteRadio - ).not.toBeVisible(); - await expect( - governanceActionDetailsPage.contextBtn - ).not.toBeVisible(); - await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible(); - } - }) - ); - }); -}); 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 9d6dce579..ad97b87d1 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -103,44 +103,6 @@ test("6M. Should navigate between footer links", async ({ page, context }) => { await expect(helpUrl).toHaveURL(HELP_DOC_URL); }); -test("6N. Should Warn users that they are in bootstrapping phase via banner", async ({ - page, - context, -}) => { - await allure.description( - "Skipping this test as bootstrapping is no longer applicable." - ); - test.skip(); - await page.route("**/epoch/params", async (route) => { - // Fetch the original response from the server - const response = await route.fetch(); - const json = await response.json(); - - // update protocol major version - json["protocol_major"] = 9; - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify(json), - }); - }); - - const responsePromise = page.waitForResponse("**/epoch/params"); - await page.goto("/"); - - await responsePromise; - - await expect(page.getByTestId("system-bootstrapping-warning")).toBeVisible({ - timeout: 60_000, - }); - - const [bootstrap] = await Promise.all([ - context.waitForEvent("page"), - page.getByTestId("system-bootstrapping-warning-link").click(), - ]); - await expect(bootstrap).toHaveURL(BOOTSTRAP_DOC_URL); -}); - test("6O. Should display proper network name", async ({ page }) => { await page.route("**/network/metrics", async (route) => { // Fetch the original response from the server