Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/bootstrap-proposal-voting-restriction #2081

Merged
merged 3 commits into from
Sep 27, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ export default class GovernanceActionDetailsPage {
readonly contextInput = this.page.getByTestId("provide-context-input");
readonly cancelModalBtn = this.page.getByTestId("cancel-modal-button");

readonly dRepYesVotes = this.page.getByTestId("submitted-votes-dReps-yes");
readonly dRepNoVotes = this.page.getByTestId("submitted-votes-dReps-no");
readonly dRepAbstainVotes = this.page.getByTestId(
"submitted-votes-dReps-abstain"
);

readonly sPosYesVotes = this.page.getByTestId("submitted-votes-sPos-yes");
readonly sPosNoVotes = this.page.getByTestId("submitted-votes-sPos-no");
readonly sPosAbstainVotes = this.page.getByTestId(
"submitted-votes-sPos-abstain"
);

readonly ccCommitteeYesVotes = this.page.getByTestId(
"submitted-votes-sPos-no"
);
readonly ccCommitteeNoVotes = this.page.getByTestId(
"submitted-votes-ccCommittee-no"
);
readonly ccCommitteeAbstainVotes = this.page.getByTestId(
"submitted-votes-ccCommittee-abstain"
);

constructor(private readonly page: Page) {}

get currentPage(): Page {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ test.describe("Check voting power", () => {
test.setTimeout(testInfo.timeout + environments.txTimeOut);

const wallet = await walletManager.popWallet("registeredDRep");
await walletManager.removeCopyWallet(wallet,"registeredDRepCopy");
await walletManager.removeCopyWallet(wallet, "registeredDRepCopy");

const tempDRepAuth = await createTempDRepAuth(page, wallet);

Expand Down Expand Up @@ -255,27 +255,31 @@ test.describe("Bootstrap phase", () => {
page,
context,
}) => {
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 voteBlacklistOptions = Object.keys(GrovernanceActionType).filter(
(option) => option !== BootstrapGovernanceActionType.InfoAction
);

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

const protocolParameter = await page.evaluate(() => {
return localStorage.getItem("protocol_params");
});
const parsedProtocolParameter = JSON.parse(protocolParameter);
// update protocol_major version
parsedProtocolParameter["protocol_major"] = 9;

const updatedProtocolParameterString = JSON.stringify(
parsedProtocolParameter
);
// add updated protocol parameter
await context.addInitScript(`
localStorage.setItem('protocol_params', '${updatedProtocolParameterString}');
`);
// wait until the loading button is hidden
await expect(
page.getByRole("progressbar").getByRole("img")
).not.toBeVisible({ timeout: 10_000 });

for (const voteBlacklistOption of voteBlacklistOptions) {
const governanceActionDetailsPage =
Expand All @@ -284,9 +288,30 @@ test.describe("Bootstrap phase", () => {
);

if (governanceActionDetailsPage !== null) {
await expect(page.getByText("yes₳").first()).toBeVisible();
await expect(page.getByText("abstain₳").first()).toBeVisible();
await expect(page.getByText("no₳").first()).toBeVisible();
// dRep vote
await expect(governanceActionDetailsPage.dRepYesVotes).toBeVisible();
await expect(
governanceActionDetailsPage.dRepAbstainVotes
).toBeVisible();
await expect(governanceActionDetailsPage.dRepNoVotes).toBeVisible();

// sPos vote
await expect(governanceActionDetailsPage.sPosYesVotes).toBeVisible();
await expect(
governanceActionDetailsPage.sPosAbstainVotes
).toBeVisible();
await expect(governanceActionDetailsPage.sPosNoVotes).toBeVisible();

// ccCommittee vote
await expect(
governanceActionDetailsPage.ccCommitteeYesVotes
).toBeVisible();
await expect(
governanceActionDetailsPage.ccCommitteeAbstainVotes
).toBeVisible();
await expect(
governanceActionDetailsPage.ccCommitteeNoVotes
).toBeVisible();

await expect(
governanceActionDetailsPage.yesVoteRadio
Expand Down
Loading