Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f609a67
chore: split out generate-address from crypto
kneerose May 30, 2025
e0f0161
chore: update stake and address on propsal wallet setup
kneerose May 30, 2025
fc139c5
refactor: remove redundant stake key creation in proposal submission …
kneerose May 30, 2025
7a9f768
fix: Check if the input field is set; otherwise, skip the process on …
kneerose May 30, 2025
8e464f3
chore: update @cardanoapi/cardano-test-wallet to version 3.3.2
kneerose May 30, 2025
a40a8a9
feat: enhance sorting functionality for proposed governance actions
kneerose Jun 2, 2025
aa41aa1
fix: update response URL filter for vote count in proposal visibility…
kneerose Jun 3, 2025
e5ba568
fix: handle visibility of progress bar during outcome searches
kneerose Jun 3, 2025
6c9751c
chore: update @intersect.mbo/pdf-ui to 0.7.0-beta-34
github-actions[bot] Jun 3, 2025
78bcc2c
Merge pull request #3718 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 3, 2025
15c62a7
fix(#3714): type error on linkReferences when editing dRep page
Ciabas Jun 3, 2025
ead46a0
Merge pull request #3717 from IntersectMBO/3714-blank-screen-and-type…
bosko-m Jun 3, 2025
a5cab03
Merge pull request #3708 from IntersectMBO/fix/test-proposal-wallet-i…
kneerose Jun 3, 2025
b9b2dfb
Merge pull request #3710 from IntersectMBO/tests/proposal-discussion-…
kneerose Jun 3, 2025
04aa7d6
fix: correct abstain votes reference in outcome details test
kneerose May 29, 2025
958a19e
fix: outcome no proposal test failing issue
kneerose May 29, 2025
527d34d
chore: decouple dRep auth setup from dRep setup dependency
kneerose May 29, 2025
1c2e7f0
feat: skip propsoal/ draft creation test for mainnet
kneerose May 29, 2025
f2c682c
fix: add missing testId of insufficient wallet balance dialog
kneerose May 30, 2025
00de129
cleanup: remove unnecessary package-lock file
kneerose May 30, 2025
991814f
fix: add faucet address on merge utxo inputs
kneerose May 30, 2025
ccc1aa7
Merge pull request #3703 from IntersectMBO/feat/mainnet-test
kneerose Jun 3, 2025
80aedef
fix(#3709): edit dRep form adds two link input fields instead of one
Ciabas Jun 3, 2025
2463d16
Merge pull request #3719 from IntersectMBO/3709-edit-drep-form-adds-t…
bosko-m Jun 3, 2025
8abcc81
chore: update @intersect.mbo/pdf-ui to 0.7.0-beta-35
github-actions[bot] Jun 3, 2025
820e0f0
Merge pull request #3720 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 3, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ changes.
### Fixed

- Fix missing off chain references in DRep details [Issue 3490](https://github.com/IntersectMBO/govtool/issues/3490)
- Fix blank screen and type error on linkReferences when navigating to edit dRep page that has no links [Issue 3714](https://github.com/IntersectMBO/govtool/issues/3714)
- Fix adding two link input fields when editing the dRep form when no links are present initially [Issue 3709](https://github.com/IntersectMBO/govtool/issues/3709)

### Changed

Expand Down
8 changes: 4 additions & 4 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.4.3",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "0.7.0-beta-33",
"@intersect.mbo/pdf-ui": "0.7.0-beta-35",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Box } from "@mui/material";

import { useCardano } from "@context";
import {
defaultEditDRepInfoValues,
useEditDRepInfoForm,
useGetDRepDetailsQuery,
useTranslation,
Expand Down Expand Up @@ -44,15 +45,21 @@ export const EditDRepForm = ({

reset({
...data,
objectives: data?.objectives ?? "",
motivations: data?.motivations ?? "",
qualifications: data?.qualifications ?? "",
paymentAddress: data?.paymentAddress ?? "",
image: data?.image ?? "",
linkReferences: data.linkReferences ?? [getEmptyReference("Link")],
identityReferences: data.identityReferences ?? [
getEmptyReference("Identity"),
],
objectives: data?.objectives ?? defaultEditDRepInfoValues.objectives,
motivations: data?.motivations ?? defaultEditDRepInfoValues.motivations,
qualifications:
data?.qualifications ?? defaultEditDRepInfoValues.qualifications,
paymentAddress:
data?.paymentAddress ?? defaultEditDRepInfoValues.paymentAddress,
image: data?.image ?? defaultEditDRepInfoValues.image,
linkReferences:
Array.isArray(data?.linkReferences) && data.linkReferences.length > 0
? data.linkReferences
: defaultEditDRepInfoValues.linkReferences,
identityReferences:
Array.isArray(data?.identityReferences) && data.identityReferences.length > 0
? data.identityReferences
: defaultEditDRepInfoValues.identityReferences,
});
}
}, [yourselfDRep, loadUserData]);
Expand All @@ -74,9 +81,3 @@ export const EditDRepForm = ({
</Box>
);
};

const getEmptyReference = (type: "Link" | "Identity") => ({
"@type": type,
uri: "",
label: "",
});
15 changes: 11 additions & 4 deletions tests/govtool-frontend/playwright/lib/helpers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { importWallet } from "@fixtures/importWallet";
import { valid as mockValid } from "@mock/index";
import LoginPage from "@pages/loginPage";
import ProposalDiscussionPage from "@pages/proposalDiscussionPage";
import { BrowserContext, Page } from "@playwright/test";
import { BrowserContext, expect, Page } from "@playwright/test";
import { ProposalType, StaticWallet } from "@types";
import { ShelleyWallet } from "./crypto";
import convertBufferToHex from "./convertBufferToHex";
Expand Down Expand Up @@ -57,9 +57,16 @@ export async function createAuthWithUserName({

const proposalDiscussionPage = new ProposalDiscussionPage(page);
await proposalDiscussionPage.goto();
await proposalDiscussionPage.verifyIdentityBtn.click({ timeout: 15_000 });

await proposalDiscussionPage.setUsername(mockValid.username());
await proposalDiscussionPage.verifyIdentityBtn.click({ timeout: 60_000 });
try {
await expect(page.getByTestId("username-input")).toBeVisible({
timeout: 10_000,
});
await proposalDiscussionPage.setUsername(mockValid.username());
} catch (error) {
// Ignore error if username is already set
console.log("Username is already set");
}

await context.storageState({ path: auth });
}
Expand Down
2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/lib/helpers/cardano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function skipIfNotInfoAndBootstrapping(type: ProposalType) {
export async function skipIfMainnet() {
if (environments.networkId === 1) {
await allure.description(
"Ada spendable features are not available on mainnet."
"Test skipped on mainnet to prevent affecting the production environment or using real ADA."
);
test.skip();
}
Expand Down
24 changes: 12 additions & 12 deletions tests/govtool-frontend/playwright/lib/helpers/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import environments from "../constants/environments";
import { ed25519 as ed } from "@noble/curves/ed25519";
import { bech32 } from "bech32";
import * as blake from "blakejs";
import { rewardAddressBech32, rewardAddressRawBytes } from "./shellyWallet";
import {
addressBech32,
addressRawBytes,
rewardAddressBech32,
rewardAddressRawBytes,
} from "./shellyWallet";

const KEY_HASH_LENGTH = 28;
const ADDR_LENGTH = KEY_HASH_LENGTH * 2 + 1;
Expand Down Expand Up @@ -103,20 +108,15 @@ export class ShelleyWallet {
}

addressBech32(networkId: number): string {
const prefix = networkId == 0 ? "addr_test" : "addr";
return bech32.encode(
prefix,
bech32.toWords(Buffer.from(this.addressRawBytes(networkId))),
200
);
const stakePkh = Buffer.from(this.stakeKey.pkh).toString("hex");
const paymentPkh = Buffer.from(this.paymentKey.pkh).toString("hex");
return addressBech32(networkId, paymentPkh, stakePkh);
}

addressRawBytes(networkId) {
const concatenatedArray1 = new Uint8Array(ADDR_LENGTH);
concatenatedArray1[0] = networkId;
concatenatedArray1.set(this.paymentKey.pkh, 1);
concatenatedArray1.set(this.stakeKey.pkh, KEY_HASH_LENGTH + 1);
return concatenatedArray1;
const stakePkh = Buffer.from(this.stakeKey.pkh).toString("hex");
const paymentPkh = Buffer.from(this.paymentKey.pkh).toString("hex");
return addressRawBytes(networkId, paymentPkh, stakePkh);
}

rewardAddressRawBytes(network: number) {
Expand Down
32 changes: 32 additions & 0 deletions tests/govtool-frontend/playwright/lib/helpers/shellyWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { bech32 } from "bech32";
import { blake2bHex } from "blakejs";
import convertBufferToHex from "./convertBufferToHex";
import { ShelleyWallet } from "./crypto";

const KEY_HASH_LENGTH = 28;
const ADDR_LENGTH = KEY_HASH_LENGTH * 2 + 1;

export default function extractDRepFromWallet(wallet: ShelleyWallet) {
const dRepPubKey = convertBufferToHex(wallet.dRepKey.public);
Expand Down Expand Up @@ -36,6 +38,36 @@ export function rewardAddressBech32(
);
}

export function addressBech32(
networkId: number,
paymentPkh: string,
stakePkh: string
): string {
const prefix = networkId == 0 ? "addr_test" : "addr";
return bech32.encode(
prefix,
bech32.toWords(
Buffer.from(addressRawBytes(networkId, paymentPkh, stakePkh))
),
200
);
}

export function addressRawBytes(
networkId: number,
paymentPkh: string,
stakePkh: string
) {
const concatenatedArray1 = new Uint8Array(ADDR_LENGTH);
concatenatedArray1[0] = networkId;
concatenatedArray1.set(Uint8Array.from(Buffer.from(paymentPkh, "hex")), 1);
concatenatedArray1.set(
Uint8Array.from(Buffer.from(stakePkh, "hex")),
KEY_HASH_LENGTH + 1
);
return concatenatedArray1;
}

export async function generateWallets(num: number) {
return await Promise.all(
Array.from({ length: num }, () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export default class OutcomeDetailsPage {
isLoggedIn
);

if (!govActionDetailsPage) {
return;
}

const outcomeResponse = await outcomeResponsePromise;
const proposalToCheck = (await outcomeResponse.json())[0];

Expand Down Expand Up @@ -267,7 +271,7 @@ export default class OutcomeDetailsPage {
{
message: `CC "Abstain" vote count checked for ${currentPageUrl}`,
}
).toHaveText(`Abstain Votes${proposalToCheck.pool_abstain_votes}`); //BUG missing testIds
).toHaveText(`Abstain Votes${proposalToCheck.cc_abstain_votes}`); //BUG missing testIds

const noPercentage = 100 - parseFloat(yesPercentage.replace("%", ""));
await expect(govActionDetailsPage.ccCommitteeNoVotes, {
Expand Down
44 changes: 31 additions & 13 deletions tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ export default class OutComesPage {
await this.page.getByTestId(this.getSortTestId(sortOption)).click();

const response = await responsePromise;
const data = await response.json();
let outcomeProposalList: outcomeProposal[] = data.length != 0 ? data : null;
const outcomeProposalList: outcomeProposal[] = await response.json();

// API validation
if (outcomeProposalList.length <= 1) return;
Expand Down Expand Up @@ -456,10 +455,15 @@ export default class OutComesPage {

async searchOutcomesById(governanceActionId: string) {
await this.searchInput.fill(governanceActionId);
await expect(
this.page.getByRole("progressbar").getByRole("img")
).toBeVisible();

try {
await expect(
this.page.getByRole("progressbar").getByRole("img")
).toBeVisible();
} catch (error) {
// Handle the case where the progress bar is not visible
console.warn("Progress bar not visible, proceeding with search.");
}
await functionWaitedAssert(
async () => {
const idSearchOutcomeCards = await this.getAllOutcomes();
Expand All @@ -480,9 +484,14 @@ export default class OutComesPage {

async searchOutcomesByTitle(governanceActionTitle: string) {
await this.searchInput.fill(governanceActionTitle);
await expect(
this.page.getByRole("progressbar").getByRole("img")
).toBeVisible();
try {
await expect(
this.page.getByRole("progressbar").getByRole("img")
).toBeVisible();
} catch (error) {
// Handle the case where the progress bar is not visible
console.warn("Progress bar not visible, proceeding with search.");
}

await functionWaitedAssert(
async () => {
Expand Down Expand Up @@ -545,17 +554,26 @@ export default class OutComesPage {
{ timeout: 60_000 }
);

const metricsResponsePromise = page.waitForResponse(
(response) => response.url().includes(`/misc/network/metrics?epoch`),
{ timeout: 60_000 }
);

const outcomePage = new OutComesPage(page);
await outcomePage.goto({ filter: filterKey });

const outcomeListResponse = await outcomeListResponsePromise;
const proposals = await outcomeListResponse.json();

if (proposals.length === 0) {
expect(true, "No proposals found!").toBeTruthy();
return {
govActionDetailsPage: null,
outcomeResponsePromise: null,
metricsResponsePromise: null,
};
}

const metricsResponsePromise = page.waitForResponse(
(response) => response.url().includes(`/misc/network/metrics?epoch`),
{ timeout: 60_000 }
);

expect(
proposals.length,
proposals.length == 0 && "No proposals found!"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { expect, Locator, Page } from "@playwright/test";
import { ProposalCreateRequest, ProposalType, ProposedGovAction } from "@types";
import {
ProposalCreateRequest,
ProposalDiscussionFilterTypes,
ProposalType,
ProposedGovAction,
} from "@types";
import environments from "lib/constants/environments";
import ProposalDiscussionDetailsPage from "./proposalDiscussionDetailsPage";
import { functionWaitedAssert, waitedLoop } from "@helpers/waitedLoop";
Expand Down Expand Up @@ -147,16 +152,30 @@ export default class ProposalDiscussionPage {
}

async sortAndValidate(
option: "asc" | "desc",
type: ProposalDiscussionFilterTypes,
validationFn: (p1: ProposedGovAction, p2: ProposedGovAction) => boolean
) {
const sortMappings = {
"Name A-Z": "&sort[prop_name]=ASC",
"Name Z-A": "&sort[prop_name]=DESC",
"Most comments": "&sort[proposal][prop_comments_number]=DESC",
"Least comments": "&sort[proposal][prop_comments_number]=ASC",
"Most likes": "&sort[proposal][prop_likes]=DESC",
"Least likes": "&sort[proposal][prop_likes]=ASC",
"Most dislikes": "&sort[proposal][prop_dislikes]=DESC",
"Least dislikes": "&sort[proposal][prop_dislikes]=ASC",
Oldest: "&sort[createdAt]=ASC",
Newest: "&sort[createdAt]=DESC",
};

const urlParam = sortMappings[type];
const populateParam = "&populate[0]=proposal_links";
const responsePromise = this.page.waitForResponse((response) =>
response
.url()
.includes(`&sort[createdAt]=${option}&populate[0]=proposal_links`)
response.url().includes(`${urlParam}${populateParam}`)
);

await this.sortBtn.click();
await this.page.getByTestId(`${type}-sort-option`).click();
const response = await responsePromise;

let proposals: ProposedGovAction[] = (await response.json()).data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ const kuberService = {
}));

const inputs = wallets.map((wallet) => wallet.address);
inputs.push(getWalletConfigForFaucet().address);
return kuber.signAndSubmitTx({
inputs,
selections,
Expand Down
Loading
Loading