Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/govtool-frontend/playwright/lib/constants/docsUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
43 changes: 43 additions & 0 deletions tests/govtool-frontend/playwright/lib/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,46 @@ export const InvalidMetadata: InvalidMetadataType[] = [
hash: "e71bf6171adda3754a87fff5c2d8d9e404eb3366428a5be13f7e76357a39004f",
},
];

export const connectToCardanoWalletSection = [
{
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",
},
];
4 changes: 3 additions & 1 deletion tests/govtool-frontend/playwright/lib/pages/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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();
});
Original file line number Diff line number Diff line change
Expand Up @@ -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.getByTestId("home-card-become-a-drep").click();
await expect(page.getByTestId("connect-your-wallet-modal")).toBeVisible();
});
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.getByTestId("home-card-view-live-voting").click();

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 ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
}) => {
Expand Down Expand Up @@ -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 wallet connection on clicking '${section.label}'`, async ({
page,
}) => {
await createWallet(page, {
networkId: environments.networkId,
});
await page.goto("/");
await page.getByTestId(section.testId).click();
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;
Expand Down
Loading
Loading