Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a4d6d01
chore: remove skipped test for vote context validation
kneerose Mar 14, 2025
d3ab94e
tests: add test of update context on already voted ga
kneerose Mar 14, 2025
64c85ee
fix: update network metrics intersept to total-stake
kneerose Mar 18, 2025
09a4aa7
fix: update network metrics route to use /network/info
kneerose Mar 18, 2025
dcc30c2
fix: use current metrics details on outcomes
kneerose Mar 18, 2025
c80693b
Merge pull request #3223 from IntersectMBO/fix/test-metrics-api-issue
kneerose Mar 18, 2025
d84a986
Merge pull request #3194 from IntersectMBO/tests/vote-context
kneerose Mar 18, 2025
96f3538
chore: static assets optimization and nginx config update
MSzalowski Mar 18, 2025
04222fa
Merge pull request #3227 from IntersectMBO/chore/optimize-loading-tim…
MSzalowski Mar 18, 2025
91fb8a1
chore: remove duplicated brotli directive
MSzalowski Mar 18, 2025
f88a307
Merge pull request #3228 from IntersectMBO/chore/remove-duplicated-br…
MSzalowski Mar 18, 2025
e045ec4
chore: remove unneded chunks configuration
MSzalowski Mar 18, 2025
a975f97
Merge pull request #3229 from IntersectMBO/chore/remove-unneded-chunk…
MSzalowski Mar 18, 2025
076163b
chore: add missing icons to the nginx
MSzalowski Mar 18, 2025
557d12b
Merge pull request #3231 from IntersectMBO/chore/add-missing-icons-fo…
MSzalowski Mar 18, 2025
9c45054
fix(#3193): allow casting same vote with updated rationale
MSzalowski Mar 18, 2025
1d3efa3
Merge pull request #3232 from IntersectMBO/fix/allow-casting-same-vot…
MSzalowski Mar 18, 2025
a798f17
Merge pull request #3233 from IntersectMBO/develop
MSzalowski Mar 18, 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ changes.

### Fixed

- allow casting same vote with a different rationale [Issue 3191](https://github.com/IntersectMBO/govtool/issues/3191)

### Changed

### Removed

## [v2.0.16](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.16) 2025-03-17


### Added

- Add support for preprod in matomo analytics [Issue 3173](https://github.com/IntersectMBO/govtool/issues/3173)
Expand Down
5 changes: 4 additions & 1 deletion govtool/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ RUN npm install
COPY . .
RUN npm run build

FROM nginx:stable-alpine
FROM fholzer/nginx-brotli:v1.23.4

EXPOSE 80

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=builder /src/maintenance-page/index.html /usr/share/nginx/html/maintenance.html
COPY --from=builder /src/dist /usr/share/nginx/html
5 changes: 4 additions & 1 deletion govtool/frontend/Dockerfile.qovery
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ RUN npm install
COPY . .
RUN npm run build

FROM nginx:stable-alpine
FROM fholzer/nginx-brotli:v1.23.4

EXPOSE 80

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=builder /src/maintenance-page/index.html /usr/share/nginx/html/maintenance.html
COPY --from=builder /src/dist /usr/share/nginx/html
Binary file removed govtool/frontend/public/images/AppLogo.png
Binary file not shown.
Binary file added govtool/frontend/public/images/AppLogo.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed govtool/frontend/public/images/BGBlue.png
Binary file not shown.
Binary file added govtool/frontend/public/images/BGBlue.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed govtool/frontend/public/images/BGOrange.png
Binary file not shown.
Binary file added govtool/frontend/public/images/BGOrange.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed govtool/frontend/public/images/GovActionList.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed govtool/frontend/public/images/HeroImage.png
Binary file not shown.
Binary file added govtool/frontend/public/images/HeroImage.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed govtool/frontend/public/images/SanchoLogo.png
Binary file not shown.
Binary file removed govtool/frontend/public/images/Success.png
Diff not rendered.
Binary file added govtool/frontend/public/images/Success.webp
Binary file removed govtool/frontend/public/images/Warning.png
Diff not rendered.
Binary file added govtool/frontend/public/images/Warning.webp
Binary file removed govtool/frontend/public/images/WarningYellow.png
Diff not rendered.
28 changes: 14 additions & 14 deletions govtool/frontend/src/consts/images.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export const IMAGES = {
appLogo: "/images/CardanoLogo.svg",
appLogoWithoutText: "/images/AppLogoWithoutText.png",
bgBlue: "/images/BGBlue.png",
bgOrange: "/images/BGOrange.png",
errorPageImage: "/images/ErrorPageImage.png",
govActionDefaultImage: "/images/GovActionDefault.png",
govActionDelegateImage: "/images/GovActionDelegate.png",
govActionListImage: "/images/GovActionList.png",
govActionRegisterImage: "/images/GovActionRegister.png",
heroImage: "/images/HeroImage.png",
proposeGovActionImage: "/images/ProposeGovAction.png",
directVoterImage: "/images/GovActionsDirectVoter.png",
successImage: "/images/Success.png",
warningImage: "/images/Warning.png",
warningYellowImage: "/images/WarningYellow.png",
appLogoWithoutText: "/images/AppLogoWithoutText.webp",
bgBlue: "/images/BGBlue.webp",
bgOrange: "/images/BGOrange.webp",
errorPageImage: "/images/ErrorPageImage.webp",
govActionDefaultImage: "/images/GovActionDefault.webp",
govActionDelegateImage: "/images/GovActionDelegate.webp",
govActionListImage: "/images/GovActionList.webp",
govActionRegisterImage: "/images/GovActionRegister.webp",
heroImage: "/images/HeroImage.webp",
proposeGovActionImage: "/images/ProposeGovAction.webp",
directVoterImage: "/images/GovActionsDirectVoter.webp",
successImage: "/images/Success.webp",
warningImage: "/images/Warning.webp",
warningYellowImage: "/images/WarningYellow.webp",
};
3 changes: 1 addition & 2 deletions govtool/frontend/src/hooks/forms/useVoteActionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export const useVoteActionForm = ({
txHash !== null &&
index !== undefined &&
index !== null &&
!areFormErrors &&
previousVote?.vote !== vote;
!areFormErrors;

const confirmVote = useCallback(
async (values: VoteActionFormValues) => {
Expand Down
11 changes: 11 additions & 0 deletions govtool/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ const viteConfig = defineViteConfig({
define: {
"process.env": {},
},
build: {
chunkSizeWarningLimit: 512,
minify: "terser",
terserOptions: {
compress: {
keep_infinity: true,
drop_console: true,
drop_debugger: true,
},
},
},
resolve: {
alias: [
{ find: "@", replacement: path.resolve(__dirname, "./src") },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import environments from "@constants/environments";
import { downloadMetadata } from "@helpers/metadata";
import { Download, Page, Response } from "@playwright/test";
import { Download, expect, Page, Response } from "@playwright/test";
import metadataBucketService from "@services/metadataBucketService";
import { IProposal } from "@types";
import { withTxConfirmation } from "lib/transaction.decorator";
Expand Down Expand Up @@ -76,8 +76,10 @@ export default class GovernanceActionDetailsPage {
}

@withTxConfirmation
async vote(context?: string) {
await this.yesVoteRadio.click();
async vote(context?: string, isAlreadyVoted: boolean = false) {
if (!isAlreadyVoted) {
await this.yesVoteRadio.click();
}

if (context) {
await this.contextBtn.click();
Expand All @@ -98,6 +100,12 @@ export default class GovernanceActionDetailsPage {
await this.page.getByTestId("go-to-vote-modal-button").click();
}

const isVoteButtonEnabled = await this.voteBtn.isEnabled();

await expect(this.voteBtn, {
message: !isVoteButtonEnabled && "Vote button is not enabled",
}).toBeEnabled({ timeout: 60_000 });

await this.voteBtn.click();
}

Expand Down Expand Up @@ -126,10 +134,12 @@ export default class GovernanceActionDetailsPage {

async getDRepTotalAbstainVoted(
proposal: IProposal,
metricsResponsePromise: Promise<Response>
totalStakeResponsePromise: Promise<Response>
): Promise<number | undefined> {
const metricsResponses = await Promise.resolve(metricsResponsePromise);
const alwaysAbstainVotingPower = await metricsResponses
const totalStakeResponses = await Promise.resolve(
totalStakeResponsePromise
);
const alwaysAbstainVotingPower = await totalStakeResponses
.json()
.then((data) => data.alwaysAbstainVotingPower);

Expand All @@ -154,6 +164,6 @@ export default class GovernanceActionDetailsPage {
@withTxConfirmation
async reVote() {
await this.noVoteRadio.click();
await this.voteBtn.click();
await this.changeVoteBtn.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export default class GovernanceActionsPage {
await this.page.waitForTimeout(2_000); // Waits to ensure the alert-success popup does not interfere
}

get currentPage(): Page {
return this.page;
}

async viewProposal(
proposal: IProposal
): Promise<GovernanceActionDetailsPage> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ export default class OutcomeDetailsPage {
): Promise<number | undefined> {
const alwaysAbstainVotingPower = await metricsResponses
.json()
.then((res) => res.alwaysAbstainVotingPower);
if (
alwaysAbstainVotingPower &&
typeof alwaysAbstainVotingPower === "number"
) {
.then((res) => res.always_abstain_voting_power);

if (alwaysAbstainVotingPower) {
const totalAbstainVoted =
alwaysAbstainVotingPower + parseInt(proposal.abstain_votes);
parseInt(alwaysAbstainVotingPower) + parseInt(proposal.abstain_votes);

return totalAbstainVoted;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ test.describe("Temporary DReps", async () => {
});

test("4J. Should include metadata anchor in the vote transaction", async ({}, testInfo) => {
test.skip(); // Skipped: Vote context is not displayed in UI to validate

test.setTimeout(testInfo.timeout + environments.txTimeOut);

const govActionsPage = new GovernanceActionsPage(dRepPage);
Expand All @@ -130,6 +128,8 @@ test.describe("Temporary DReps", async () => {

await govActionsPage.votedTab.click();
await govActionsPage.viewFirstVotedProposal();

// Vote context is not displayed in UI to validate
expect(false, "No vote context displayed").toBe(true);
});
});
Expand All @@ -150,10 +150,6 @@ test.describe("Check vote count", () => {
)
);

const metricsResponsePromise = page.waitForResponse((response) =>
response.url().includes(`network/metrics`)
);

const governanceActionsPage = new GovernanceActionsPage(page);
await governanceActionsPage.goto();

Expand All @@ -179,19 +175,23 @@ test.describe("Check vote count", () => {
storageState: ".auth/dRep01.json",
wallet: dRep01Wallet,
});

const totalStakeResponsePromise = dRepPage.waitForResponse((response) =>
response.url().includes(`network/total-stake`)
);
const govActionDetailsPage = new GovernanceActionDetailsPage(dRepPage);
await govActionDetailsPage.goto(
`${proposalToCheck.txHash}#${proposalToCheck.index}`
);

await govActionDetailsPage.showVotesBtn.click();

const dRepTotalAbstainVote =
await govActionDetailsPage.getDRepTotalAbstainVoted(
proposalToCheck,
metricsResponsePromise
totalStakeResponsePromise
);

await govActionDetailsPage.showVotesBtn.click();

// check dRep votes
if (await areDRepVoteTotalsDisplayed(proposalToCheck)) {
await expect(govActionDetailsPage.dRepYesVotes).toHaveText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ test("4K. Should display correct vote counts on governance details page for disc
)
);

const metricsResponsePromise = page.waitForResponse((response) =>
response.url().includes(`network/metrics`)
);

const governanceActionsPage = new GovernanceActionsPage(page);
await governanceActionsPage.goto();
const responses = await Promise.all(responsesPromise);
Expand All @@ -248,6 +244,9 @@ test("4K. Should display correct vote counts on governance details page for disc
uniqueProposalTypes.map(async (proposalToCheck) => {
const newPage = await browser.newPage();
injectLogger(newPage);
const totalStakeResponsePromise = newPage.waitForResponse((response) =>
response.url().includes(`network/total-stake`)
);
const govActionDetailsPage = new GovernanceActionDetailsPage(newPage);
await govActionDetailsPage.goto(
`${proposalToCheck.txHash}#${proposalToCheck.index}`
Expand All @@ -256,7 +255,7 @@ test("4K. Should display correct vote counts on governance details page for disc
const dRepTotalAbstainVote =
await govActionDetailsPage.getDRepTotalAbstainVoted(
proposalToCheck,
metricsResponsePromise
totalStakeResponsePromise
);

// check dRep votes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ test.describe("Proposal checks", () => {

test.describe("Perform voting", () => {
let govActionDetailsPage: GovernanceActionDetailsPage;
let dRepPage: Page;

test.beforeEach(async ({ page, browser }) => {
test.slow(); // Due to queue in pop wallets
Expand All @@ -145,7 +144,7 @@ test.describe("Perform voting", () => {

const tempDRepAuth = await createTempDRepAuth(page, wallet);

dRepPage = await createNewPageWithWallet(browser, {
const dRepPage = await createNewPageWithWallet(browser, {
storageState: tempDRepAuth,
wallet,
enableStakeSigning: true,
Expand All @@ -166,7 +165,7 @@ test.describe("Perform voting", () => {
: await govActionsPage.viewFirstProposal();
});

test("5E. Should re-vote with new data on a already voted governance action", async ({}, testInfo) => {
test("5E. Should re-vote with change vote on an already voted governance action", async ({}, testInfo) => {
test.setTimeout(testInfo.timeout + 2 * environments.txTimeOut);

await govActionDetailsPage.vote();
Expand All @@ -175,7 +174,7 @@ test.describe("Perform voting", () => {
govActionDetailsPage.currentPage
);

await dRepPage.waitForTimeout(5_000);
await governanceActionsPage.currentPage.reload();

await governanceActionsPage.votedTab.click();

Expand All @@ -190,7 +189,7 @@ test.describe("Perform voting", () => {
govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal();
await govActionDetailsPage.reVote();

await dRepPage.reload();
await govActionDetailsPage.currentPage.reload();

await governanceActionsPage.votedTab.click();

Expand Down Expand Up @@ -224,6 +223,56 @@ test.describe("Perform voting", () => {
});
});

test("5L. Should update context on an already voted governance action without changing the vote", async ({}, testInfo) => {
test.setTimeout(testInfo.timeout + 2 * environments.txTimeOut);

await govActionDetailsPage.vote();

const governanceActionsPage = new GovernanceActionsPage(
govActionDetailsPage.currentPage
);

await governanceActionsPage.currentPage.reload();

await governanceActionsPage.votedTab.click();

await govActionDetailsPage.currentPage.evaluate(() =>
window.scrollTo(0, 500)
);

await expect(
govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("Yes")
).toBeVisible();

govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal();
await govActionDetailsPage.vote(faker.lorem.sentence(200), true);

await govActionDetailsPage.currentPage.reload();

await governanceActionsPage.votedTab.click();

const isYesVoteVisible = await govActionDetailsPage.currentPage
.getByTestId("my-vote")
.getByText("Yes")
.isVisible();

const textContent = await govActionDetailsPage.currentPage
.getByTestId("my-vote")
.textContent();

await govActionDetailsPage.currentPage.evaluate(() =>
window.scrollTo(0, 500)
);
await expect(
govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("No"),
{
message:
!isYesVoteVisible &&
`"Yes" vote not visible, current vote status: ${textContent.match(/My Vote:(Yes|No)/)[1]}`,
}
).toBeVisible({ timeout: 60_000 });
});

test("5I. Should view the vote details,when viewing governance action already voted by the DRep", async ({}, testInfo) => {
test.setTimeout(testInfo.timeout + environments.txTimeOut);

Expand All @@ -233,7 +282,7 @@ test.describe("Perform voting", () => {
govActionDetailsPage.currentPage
);

await dRepPage.waitForTimeout(5_000);
await governanceActionsPage.currentPage.waitForTimeout(5_000);

await governanceActionsPage.votedTab.click();
await expect(
Expand Down
Loading