diff --git a/govtool/frontend/src/components/molecules/DRepDataForm.tsx b/govtool/frontend/src/components/molecules/DRepDataForm.tsx index 6b2a65506..e5b077b49 100644 --- a/govtool/frontend/src/components/molecules/DRepDataForm.tsx +++ b/govtool/frontend/src/components/molecules/DRepDataForm.tsx @@ -107,7 +107,7 @@ export const DRepDataForm = ({ control, errors, register, watch }: Props) => { subtitle={t("forms.dRepData.imageHelpfulText")} /> ({ /> {fieldState.error && ( )} diff --git a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts index 63516b43a..74d6fe61c 100644 --- a/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts +++ b/tests/govtool-frontend/playwright/lib/forms/dRepForm.ts @@ -13,7 +13,7 @@ const formErrors = { ], linkDescription: "max-80-characters-error", email: "invalid-email-address-error", - image: "invalid-image-url-error", + image: "invalid-image-input-error", links: { url: "link-reference-description-1-error", description: "link-reference-description-1-error", @@ -304,7 +304,7 @@ export default class DRepForm { }).not.toEqual(dRepInfo.qualifications); await expect(this.form.getByTestId(formErrors.image), { - message: !isImageErrorVisible && `${dRepInfo.image} is a valid image`, + message: !isImageErrorVisible && `Invalid image URL or properly formatted base64-encoded image`, }).toBeVisible({ timeout: 60_000, }); diff --git a/tests/govtool-frontend/playwright/lib/pages/outcomeDetailsPage.ts b/tests/govtool-frontend/playwright/lib/pages/outcomeDetailsPage.ts index cbf39d9ca..6ead1d8be 100644 --- a/tests/govtool-frontend/playwright/lib/pages/outcomeDetailsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/outcomeDetailsPage.ts @@ -111,7 +111,7 @@ export default class OutcomeDetailsPage { } const outcomeResponse = await outcomeResponsePromise; - const proposalToCheck = (await outcomeResponse.json())[0]; + const proposalToCheck = (await outcomeResponse.json()); const metricsResponse = await metricsResponsePromise; @@ -188,7 +188,7 @@ export default class OutcomeDetailsPage { filterKey === "NoConfidence" ? proposalToCheck.pool_no_votes : parseInt(sPosNoConfidence.replace(/,/g, "")) * 1000000 + - parseInt(proposalToCheck.pool_no_votes); + parseInt(proposalToCheck.pool_no_votes); const totalSposYesVotesForNoConfidence = parseInt(sPosNoConfidence.replace(/,/g, "")) * 1000000 + @@ -295,19 +295,24 @@ export default class OutcomeDetailsPage { url: string; hash: string; }) { - await this.page.route(/.*\/governance-actions\/[a-f0-9]{64}\?.*/, (route) => - route.fulfill({ body: JSON.stringify([outcomeResponse]) }) + let governanceActionPromise = this.page.route("**/governance-actions/*", async (route) => { + if (route.request().url().includes("/governance-actions/metadata")) { + await route.continue(); + } else { + await route.fulfill({ body: JSON.stringify(outcomeResponse)}); + } + } ); - const outcomePage = new OutComesPage(this.page); await outcomePage.goto(); await outcomePage.viewFirstOutcomes(); + await governanceActionPromise; const outcomeTitle = await outcomePage.title.textContent(); await expect( outcomePage.title, outcomeTitle.toLowerCase() !== type.toLowerCase() && - `The URL "${url}" and hash "${hash}" do not match the expected properties for type "${type}".` + `The URL "${url}" and hash "${hash}" do not match the expected properties for type "${type}".` ).toHaveText(type, { ignoreCase: true, timeout: 60_000, diff --git a/tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts b/tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts index 97d146349..32fe6dd98 100644 --- a/tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts @@ -579,7 +579,7 @@ export default class OutComesPage { const metricsResponsePromise = page.waitForResponse( (response) => response.url().includes(`/misc/network/metrics?epoch`), - { timeout: 60_000 } + { timeout: 120_000 } ); expect( @@ -597,7 +597,7 @@ export default class OutComesPage { .includes( `governance-actions/${governanceTransactionHash}?index=${governanceActionIndex}` ), - { timeout: 60_000 } + { timeout: 120_000 } ); const govActionDetailsPage = await outcomePage.viewFirstOutcomes(); 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 aea5f9c61..ff40cf000 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 @@ -67,7 +67,6 @@ test.describe("Logged in DRep", () => { ) : await govActionsPage.viewFirstProposal(); - await govActionDetailsPage.contextBtn.click(); await govActionDetailsPage.contextInput.fill(faker.lorem.sentence(200)); await govActionDetailsPage.confirmModalBtn.click(); await page.getByRole("checkbox").click(); @@ -101,55 +100,6 @@ test.describe("Logged in DRep", () => { }); }); -test.describe("Temporary DReps", async () => { - let dRepPage: Page; - - test.beforeEach(async ({ page, browser }) => { - const wallet = await walletManager.popWallet("registeredDRep"); - const tempDRepAuth = await createTempDRepAuth(page, wallet); - dRepPage = await createNewPageWithWallet(browser, { - storageState: tempDRepAuth, - wallet, - enableDRepSigning: true, - }); - }); - - const verifyVoteWithMetadata = async (testInfo: any, useGovToolIPFS: boolean = false) => { - test.setTimeout(testInfo.timeout + environments.txTimeOut); - - const govActionsPage = new GovernanceActionsPage(dRepPage); - await govActionsPage.goto(); - - const govActionDetailsPage = await govActionsPage.viewFirstProposal(); - const fakerContext = faker.lorem.sentence(200); - - if (useGovToolIPFS) { - await govActionDetailsPage.vote(fakerContext, false, true); - } else { - await govActionDetailsPage.vote(fakerContext); - } - - await dRepPage.reload(); - await dRepPage.waitForTimeout(5_000); - await govActionsPage.votedTab.click(); - - const votedGovActionDetailsPage = await govActionsPage.viewFirstVotedProposal(); - await votedGovActionDetailsPage.currentPage.getByTestId("show-more-button").click(); - await votedGovActionDetailsPage.currentPage.waitForTimeout(2000); - - const voteRationaleContext = await votedGovActionDetailsPage.currentPage.getByTestId("vote-rationale-context"); - await expect(voteRationaleContext).toContainText(fakerContext); - }; - - test("4J. Should include metadata anchor in the vote transaction (Download and store yourself)", async ({}, testInfo) => { - await verifyVoteWithMetadata(testInfo, false); - }); - - test("4k. Should include metadata anchor in the vote transaction (GovTool pins data to IPFS)", async ({}, testInfo) => { - await verifyVoteWithMetadata(testInfo, true); - }); -}); - test.describe("Check vote count", () => { test.use({ storageState: dRep01AuthFile, wallet: dRep01Wallet }); 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 adab72a92..740935a99 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 @@ -189,7 +189,7 @@ test("4M. Should show view-all categorized governance actions", async ({ const governanceActionPage = new GovernanceActionsPage(page); await governanceActionPage.goto(); - await page.getByRole("button", { name: "Show All" }).click(); + await page.getByRole("link", { name: "Show All" }).click(); const proposalCards = await governanceActionPage.getAllProposals(); 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 e41b0def9..4d8052543 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 @@ -138,6 +138,8 @@ test.describe("Proposal checks", () => { test.describe("Perform voting", () => { let govActionDetailsPage: GovernanceActionDetailsPage; + let dRepPage: Page; + let govActionsPage: GovernanceActionsPage; test.beforeEach(async ({ page, browser }) => { test.slow(); // Due to queue in pop wallets @@ -146,14 +148,14 @@ test.describe("Perform voting", () => { const tempDRepAuth = await createTempDRepAuth(page, wallet); - const dRepPage = await createNewPageWithWallet(browser, { + dRepPage = await createNewPageWithWallet(browser, { storageState: tempDRepAuth, wallet, enableDRepSigning: true, }); - const govActionsPage = new GovernanceActionsPage(dRepPage); - await govActionsPage.goto(); + govActionsPage = new GovernanceActionsPage(dRepPage); + govActionsPage.goto(); // assert to wait until the loading button is hidden await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ @@ -282,6 +284,36 @@ test.describe("Perform voting", () => { govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("Yes") ).toBeVisible(); }); + + const verifyVoteWithMetadata = async (testInfo: any, useGovToolIPFS: boolean = false) => { + test.setTimeout(testInfo.timeout + environments.txTimeOut); + const fakerContext = faker.lorem.sentence(200); + + if (useGovToolIPFS) { + await govActionDetailsPage.vote(fakerContext, false, true); + } else { + await govActionDetailsPage.vote(fakerContext); + } + + await dRepPage.reload(); + await dRepPage.waitForTimeout(5_000); + await govActionsPage.votedTab.click(); + + const votedGovActionDetailsPage = await govActionsPage.viewFirstVotedProposal(); + await votedGovActionDetailsPage.currentPage.getByTestId("show-more-button").click(); + await votedGovActionDetailsPage.currentPage.waitForTimeout(2000); + + const voteRationaleContext = await votedGovActionDetailsPage.currentPage.getByTestId("vote-rationale-context"); + await expect(voteRationaleContext).toContainText(fakerContext); + }; + + test("5M_1. Should vote with Context (Download and store yourself)", async ({}, testInfo) => { + await verifyVoteWithMetadata(testInfo, false); + }); + + test("5M_2. Should vote with Context (GovTool pins data to IPFS)", async ({}, testInfo) => { + await verifyVoteWithMetadata(testInfo, true ); + }); }); test.describe("Check voting power", () => { diff --git a/tests/govtool-frontend/playwright/tests/dRep.setup.ts b/tests/govtool-frontend/playwright/tests/dRep.setup.ts index 47d4f1647..d4c2e9936 100644 --- a/tests/govtool-frontend/playwright/tests/dRep.setup.ts +++ b/tests/govtool-frontend/playwright/tests/dRep.setup.ts @@ -12,7 +12,6 @@ import kuberService from "@services/kuberService"; import walletManager from "lib/walletManager"; import { functionWaitedAssert } from "@helpers/waitedLoop"; import { StaticWallet } from "@types"; -import { Logger } from "@helpers/logger"; const REGISTER_DREP_WALLETS_COUNT = 6; const DREP_WALLETS_COUNT = 11;