Skip to content
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
2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/lib/forms/dRepForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default class DRepForm {
message:
isPaymentAddressErrorVisible &&
`${dRepInfo.paymentAddress} is an invalid paymentAddress`,
}).toBeHidden();
}).toBeHidden({ timeout: 60_000 });
await expect(this.continueBtn).toBeEnabled();
}

Expand Down
7 changes: 7 additions & 0 deletions tests/govtool-frontend/playwright/lib/helpers/adaFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ export const correctDelegatedVoteAdaFormat = (ada: number | undefined) => {
}
return "0";
};

export const correctDRepDirectoryFormat = (ada: number | undefined) => {
if (ada) {
return Number(ada.toFixed(0))?.toLocaleString("en-US");
}
return "0";
};
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default class DRepDirectoryPage {
!isEmptyContainerVisible &&
`DRep with id ${dRepId} is found in the list`,
}).toBeVisible({
timeout: 20_000,
timeout: 60_000,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ test("2N. Should show DRep information on details page", async ({
},
];

await expect(dRepPage.getByTestId("alert-success")).not.toBeVisible();

await dRepRegistrationPage.register({
name,
objectives,
Expand All @@ -71,15 +73,18 @@ test("2N. Should show DRep information on details page", async ({
// Add an assertion to prevent clicking on "View Your dRep Details".
await expect(
dRepPage.getByTestId("dRep-id-display-card-dashboard")
).toContainText(wallet.dRepId, { timeout: 20_000 });
).toContainText(wallet.dRepId, { timeout: 60_000 });
await dRepPage.getByTestId("view-drep-details-button").click();

// Verification
await expect(dRepPage.getByTestId("copy-drep-id-button")).toHaveText(
wallet.dRepId
);
await expect(dRepPage.getByTestId("copy-payment-address-button")).toHaveText(
paymentAddress
paymentAddress,
{
timeout: 60_000,
}
);
await expect(dRepPage.getByTestId("Active-pill")).toHaveText("Active");
await expect(dRepPage.getByTestId("voting-power")).toHaveText("₳ 0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
} from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { test } from "@fixtures/walletExtension";
import { correctDelegatedVoteAdaFormat } from "@helpers/adaFormat";
import {
correctDelegatedVoteAdaFormat,
correctDRepDirectoryFormat,
} from "@helpers/adaFormat";
import { setAllureEpic } from "@helpers/allure";
import { skipIfMainnet, skipIfNotHardFork } from "@helpers/cardano";
import { createNewPageWithWallet } from "@helpers/page";
Expand Down Expand Up @@ -265,7 +268,7 @@ test.describe("Abstain delegation", () => {

await expect(
page.getByText(
`You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}`
`You have delegated ₳${correctDRepDirectoryFormat(balance)}`
)
).toBeVisible({
timeout: 60_000,
Expand Down Expand Up @@ -296,7 +299,7 @@ test.describe("No confidence delegation", () => {
const balance = await kuberService.getBalance(adaHolder04Wallet.address);
await expect(
page.getByText(
`You have delegated ₳${correctDelegatedVoteAdaFormat(balance)}`
`You have delegated ₳${correctDRepDirectoryFormat(balance)}`
)
).toBeVisible({
timeout: 60_000,
Expand Down Expand Up @@ -325,7 +328,7 @@ test.describe("Delegated ADA visibility", () => {
);
await expect(
page.getByText(
`You have delegated ₳ ${correctDelegatedVoteAdaFormat(adaHolderVotingPower)}`
`You have delegated ₳ ${correctDRepDirectoryFormat(adaHolderVotingPower)}`
)
).toBeVisible({ timeout: 60_000 });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test.describe("Temporary DReps", () => {
await dRepRegistrationPage.confirmBtn.click();

await expect(dRepPage.getByTestId("d-rep-in-progress")).not.toBeVisible({
timeout: 20_000,
timeout: 60_000,
});

// connected state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ test.describe("Validation of dRep Registration Form", () => {
const dRepRegistrationPage = new DRepRegistrationPage(page);
await dRepRegistrationPage.goto();

await expect(page.getByTestId("alert-success")).not.toBeVisible();

for (let i = 0; i < 100; i++) {
await dRepRegistrationPage.validateForm({
name: mockValid.name(),
Expand Down Expand Up @@ -102,6 +104,7 @@ test.describe("Validation of dRep Registration Form", () => {

const dRepRegistrationPage = new DRepRegistrationPage(page);
await dRepRegistrationPage.goto();
await expect(page.getByTestId("alert-success")).not.toBeVisible();

for (let i = 0; i < 100; i++) {
await dRepRegistrationPage.inValidateForm({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe("Validation of edit dRep Form", () => {
await editDRepPage.goto();

// wait until wallet alert close
await page.waitForTimeout(5_000);
await expect(page.getByTestId("alert-success")).not.toBeVisible();

for (let i = 0; i < 100; i++) {
await editDRepPage.validateForm({
Expand Down Expand Up @@ -73,7 +73,7 @@ test.describe("Validation of edit dRep Form", () => {
const editDRepPage = new EditDRepPage(page);
await editDRepPage.goto();

await expect(editDRepPage.nameInput).toBeVisible({ timeout: 60_000 }); // assert to wait for the page to load
await expect(page.getByTestId("alert-success")).not.toBeVisible();

for (let i = 0; i < 100; i++) {
await editDRepPage.inValidateForm({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import GovernanceActionsPage from "@pages/governanceActionsPage";
import { Page, expect } from "@playwright/test";
import kuberService from "@services/kuberService";
import { BootstrapGovernanceActionType, GovernanceActionType } from "@types";
import { allure } from "allure-playwright";
import walletManager from "lib/walletManager";

test.beforeEach(async () => {
Expand Down Expand Up @@ -188,6 +189,9 @@ test.describe("Perform voting", () => {

govActionDetailsPage = await governanceActionsPage.viewFirstVotedProposal();
await govActionDetailsPage.reVote();

await dRepPage.reload();

await governanceActionsPage.votedTab.click();

const isNoVoteVisible = await govActionDetailsPage.currentPage
Expand Down Expand Up @@ -269,66 +273,3 @@ test.describe("Check voting power", () => {
expect(balance, "Retirement deposit not returned").toBeGreaterThan(500);
});
});

test.describe("Bootstrap phase", () => {
test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({
browser,
}) => {
const voteBlacklistOptions = Object.keys(
BootstrapGovernanceActionType
).filter((option) => option !== GovernanceActionType.InfoAction);

await Promise.all(
voteBlacklistOptions.map(async (voteBlacklistOption) => {
const dRepPage = await createNewPageWithWallet(browser, {
storageState: ".auth/dRep01.json",
wallet: dRep01Wallet,
});

await dRepPage.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 governanceActionsPage = new GovernanceActionsPage(dRepPage);
await governanceActionsPage.goto();

// assert to wait until proposal cards are visible
await expect(dRepPage.getByTestId("voting-power-chips")).toBeVisible({
timeout: 60_000,
});
// wait until the loading button is hidden
await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({
timeout: 60_000,
});

const governanceActionDetailsPage =
await governanceActionsPage.viewFirstProposalByGovernanceAction(
voteBlacklistOption as GovernanceActionType
);

if (governanceActionDetailsPage) {
await expect(
dRepPage.getByTestId("governance-action-details-card-header")
).toBeVisible({ timeout: 60_000 });
await expect(
governanceActionDetailsPage.yesVoteRadio
).not.toBeVisible();
await expect(
governanceActionDetailsPage.contextBtn
).not.toBeVisible();
await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible();
}
})
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { isMobile, openDrawer } from "@helpers/mobile";
import { expect, Page } from "@playwright/test";
import { allure } from "allure-playwright";
import environments from "lib/constants/environments";

test.beforeEach(async () => {
Expand Down Expand Up @@ -102,40 +103,6 @@ test("6M. Should navigate between footer links", async ({ page, context }) => {
await expect(helpUrl).toHaveURL(HELP_DOC_URL);
});

test("6N. Should Warn users that they are in bootstrapping phase via banner", async ({
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 responsePromise = page.waitForResponse("**/epoch/params");
await page.goto("/");

await responsePromise;

await expect(page.getByTestId("system-bootstrapping-warning")).toBeVisible({
timeout: 60_000,
});

const [bootstrap] = await Promise.all([
context.waitForEvent("page"),
page.getByTestId("system-bootstrapping-warning-link").click(),
]);
await expect(bootstrap).toHaveURL(BOOTSTRAP_DOC_URL);
});

test("6O. Should display proper network name", async ({ page }) => {
await page.route("**/network/metrics", async (route) => {
// Fetch the original response from the server
Expand Down