Skip to content

Commit

Permalink
Merge pull request #1115 from IntersectMBO/bugfix/tests-2E-2S
Browse files Browse the repository at this point in the history
Add retry and Add assertion for continue-button
  • Loading branch information
NabinKawan authored May 31, 2024
2 parents 8ae95fb + 53e645c commit bdd71eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function generateWallets(num: number) {

async function globalSetup() {
const registeredDRepWallets = await generateWallets(9);
const registerDRepWallets = await generateWallets(5);
const registerDRepWallets = await generateWallets(9);

// faucet setup
const res = await loadAmountFromFaucet(faucetWallet.address);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ test.describe("Delegate to myself", () => {
let dRepPage: Page;
let wallet: StaticWallet;

test.beforeEach(async ({ page, browser }, testInfo) => {
test.describe.configure({ retries: 3 });

test.beforeEach(async ({ page, browser }) => {
wallet = await walletManager.popWallet("registerDRep");

const dRepAuth = await createTempDRepAuth(page, wallet);
Expand All @@ -98,26 +100,27 @@ test.describe("Delegate to myself", () => {
});
});

test("2E. Should register as Sole voter", async ({ page }, testInfo) => {
test("2E. Should register as Sole voter", async ({}, testInfo) => {
test.setTimeout(testInfo.timeout + environments.txTimeOut);

const dRepId = wallet.dRepId;

await dRepPage.goto("/");
await dRepPage.getByTestId("register-as-sole-voter-button").click();

await expect(dRepPage.getByTestId("continue-button")).toBeVisible();
await dRepPage.getByTestId("continue-button").click();
await expect(
dRepPage.getByTestId("registration-transaction-submitted-modal")
).toBeVisible();
await dRepPage.getByTestId("confirm-modal-button").click();
await waitForTxConfirmation(dRepPage);

// Checks in dashboard
// BUG
await expect(page.getByText(dRepId)).toHaveText(dRepId);

// Checks in dRep directory
await expect(dRepPage.getByText("You are a Direct Voter")).toBeVisible();
await expect(
dRepPage.getByTestId("register-as-sole-voter-button")
).not.toBeVisible();

await dRepPage.getByTestId("drep-directory-link").click();
await expect(dRepPage.getByText("Direct Voter")).toBeVisible();
await expect(dRepPage.getByTestId(`${dRepId}-copy-id-button`)).toHaveText(
Expand All @@ -130,6 +133,8 @@ test.describe("Delegate to myself", () => {

await dRepPage.goto("/");
await dRepPage.getByTestId("register-as-sole-voter-button").click();

await expect(dRepPage.getByTestId("continue-button")).toBeVisible();
await dRepPage.getByTestId("continue-button").click();
await expect(
dRepPage.getByTestId("registration-transaction-submitted-modal")
Expand Down

0 comments on commit bdd71eb

Please sign in to comment.