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

Enhance allure dashboard visibility #1055

Merged
merged 2 commits into from
May 20, 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
2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ allure-report/
.secrets
.vars
.lock-pool/
.logs/
.logs/
18 changes: 18 additions & 0 deletions tests/govtool-frontend/playwright/lib/helpers/allure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { allure } from "allure-playwright";
import { isMobile } from "./mobile";
import { chromium } from "@playwright/test";

export const setAllureEpic = async (groupName: string) => {
const browser = await chromium.launch();
const page = await browser.newPage();
if (isMobile(page)) {
await allure.epic("6. Miscellaneous");
await allure.story("6A. Should be accessible from mobile");
} else {
await allure.epic(groupName);
}
};

export const setAllureStory = async (groupName: string) => {
await allure.story(groupName);
};
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,12 @@ export default class DRepRegistrationPage {
await this.linkInput.fill(link);

for (const err of formErrors.dRepName) {
await expect(
this.page.getByTestId(err),
`Invalid name: ${name}`
).toBeHidden();
await expect(this.page.getByTestId(err)).toBeHidden();
}

await expect(
this.page.getByTestId(formErrors.email),
`Invalid email: ${email}`
).toBeHidden();
await expect(this.page.getByTestId(formErrors.email)).toBeHidden();

expect(
await this.bioInput.textContent(),
"Bio exceeded 500 characters"
).toEqual(bio);
expect(await this.bioInput.textContent()).toEqual(bio);

await expect(this.page.getByTestId(formErrors.link)).toBeHidden();

Expand Down Expand Up @@ -127,17 +118,11 @@ export default class DRepRegistrationPage {
})
.all();

expect(nameErrors.length, `Valid name: ${name}`).toEqual(1);
expect(nameErrors.length).toEqual(1);

await expect(
this.page.getByTestId(formErrors.email),
`Valid email: ${email}`
).toBeVisible();
await expect(this.page.getByTestId(formErrors.email)).toBeVisible();

expect(
await this.bioInput.textContent(),
"Bio less than 500 characters"
).not.toEqual(bio);
expect(await this.bioInput.textContent()).not.toEqual(bio);

await expect(this.page.getByTestId(formErrors.link)).toBeVisible();

Expand Down
9 changes: 8 additions & 1 deletion tests/govtool-frontend/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ export default defineConfig({
/*use Allure Playwright's testPlanFilter() to determine the grep parameter*/
grep: testPlanFilter(),
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? [["line"], ["allure-playwright"]] : [["line"]],
reporter: process.env.CI
? [
["line"],
[
"allure-playwright"
],
]
: [["line"]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { user01Wallet } from "@constants/staticWallets";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import LoginPage from "@pages/loginPage";

test.use({ storageState: ".auth/user01.json", wallet: user01Wallet });
test.beforeEach(async () => {
await setAllureEpic("1. Wallet connect");
});

test("1B: Should connect wallet with single stake key @smoke @fast", async ({
page,
}) => {
test("1B: Should connect wallet with single stake key", async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.isLoggedIn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import createWallet from "@fixtures/createWallet";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import convertBufferToHex from "@helpers/convertBufferToHex";
import { ShelleyWallet } from "@helpers/crypto";
import LoginPage from "@pages/loginPage";
import { expect } from "@playwright/test";

test("1A. Should connect wallet and choose stake-key to use @smoke @fast", async ({
test.beforeEach(async () => {
await setAllureEpic("1. Wallet connect");
});

test("1A. Should connect wallet and choose stake-key to use", async ({
page,
}) => {
const shellyWallet = await ShelleyWallet.generate();
Expand All @@ -23,9 +28,7 @@ test("1A. Should connect wallet and choose stake-key to use @smoke @fast", async
await loginPage.login();
});

test("1C: Should disconnect Wallet When connected @smoke @fast", async ({
page,
}) => {
test("1C: Should disconnect Wallet When connected", async ({ page }) => {
await createWallet(page);

const loginPage = new LoginPage(page);
Expand All @@ -34,7 +37,7 @@ test("1C: Should disconnect Wallet When connected @smoke @fast", async ({
await loginPage.logout();
});

test("1D. Should check correct network (Testnet/Mainnet) on connection @smoke @fast", async ({
test("1D. Should check correct network (Testnet/Mainnet) on connection", async ({
page,
}) => {
const wrongNetworkId = 1; // mainnet network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dRep01Wallet } from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { ShelleyWallet } from "@helpers/crypto";
import { isMobile, openDrawer } from "@helpers/mobile";
import { createNewPageWithWallet } from "@helpers/page";
Expand All @@ -12,6 +13,10 @@ import DRepDirectoryPage from "@pages/dRepDirectoryPage";
import DRepRegistrationPage from "@pages/dRepRegistrationPage";
import { expect } from "@playwright/test";

test.beforeEach(async () => {
await setAllureEpic("2. Delegation");
});

test("2C. Should open wallet connection popup on delegate in disconnected state", async ({
page,
}) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { dRep01Wallet, user01Wallet } from "@constants/staticWallets";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { ShelleyWallet } from "@helpers/crypto";
import { isMobile } from "@helpers/mobile";
import extractDRepFromWallet from "@helpers/shellyWallet";
Expand All @@ -8,11 +9,14 @@ import { expect } from "@playwright/test";

test.use({ storageState: ".auth/user01.json", wallet: user01Wallet });

test.beforeEach(async () => {
await setAllureEpic("2. Delegation");
});

test("2B. Should access DRep Directory page", async ({ page }) => {
await page.goto("/");

await page.getByTestId("view-drep-directory-button").click();

if (isMobile(page)) {
await expect(page.getByText("DRep Directory")).toBeVisible();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { dRep01Wallet } from "@constants/staticWallets";
import DRepDirectoryPage from "@pages/dRepDirectoryPage";
import { setAllureEpic } from "@helpers/allure";
import { expect, test } from "@playwright/test";
import { DRepStatus } from "@types";

test.beforeEach(async () => {
await setAllureEpic("2. Delegation");
});

test("2J. Should search by DRep id", async ({ page }) => {
const dRepDirectory = new DRepDirectoryPage(page);
await dRepDirectory.goto();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import environments from "@constants/environments";
import { adaHolder01Wallet, dRep01Wallet } from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { ShelleyWallet } from "@helpers/crypto";
import { createNewPageWithWallet } from "@helpers/page";
import extractDRepFromWallet from "@helpers/shellyWallet";
Expand All @@ -13,6 +14,10 @@ import {
import DRepDirectoryPage from "@pages/dRepDirectoryPage";
import { expect } from "@playwright/test";

test.beforeEach(async () => {
await setAllureEpic("2. Delegation");
});

test.describe("Delegate to others", () => {
test.describe.configure({ mode: "serial" });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dRep01Wallet } from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { ShelleyWallet } from "@helpers/crypto";
import { createNewPageWithWallet } from "@helpers/page";
import {
Expand All @@ -15,6 +16,10 @@ import GovernanceActionsPage from "@pages/governanceActionsPage";
import { expect } from "@playwright/test";
import * as crypto from "crypto";

test.beforeEach(async () => {
await setAllureEpic("3. DRep registration");
});

test.describe("Logged in DReps", () => {
test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet });

Expand All @@ -30,7 +35,8 @@ test.describe("Logged in DReps", () => {
test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet });

// Skipped: No option to update metadata
test.skip("3H. Should be able to update metadata", async ({ page }) => {
test("3H. Should be able to update metadata ", async ({ page }) => {
test.skip();
page.getByTestId("change-metadata-button").click();
page.getByTestId("url-input").fill("https://google.com");
page.getByTestId("hash-input").fill(crypto.randomBytes(32).toString("hex"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { user01Wallet } from "@constants/staticWallets";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import DRepRegistrationPage from "@pages/dRepRegistrationPage";
import { expect } from "@playwright/test";

Expand All @@ -9,6 +10,10 @@ test.use({
wallet: user01Wallet,
});

test.beforeEach(async () => {
await setAllureEpic("3. DRep registration");
});

test("3B. Should access DRep registration page", async ({ page }) => {
await page.goto("/");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { setAllureEpic } from "@helpers/allure";
import { expect, test } from "@playwright/test";

test.beforeEach(async () => {
await setAllureEpic("3. DRep registration");
});

test("3C. Should open wallet connection popup on DRep registration in disconnected state", async ({
page,
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dRep01Wallet } from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { lovelaceToAda } from "@helpers/cardano";
import { ShelleyWallet } from "@helpers/crypto";
import { createNewPageWithWallet } from "@helpers/page";
Expand All @@ -17,12 +18,16 @@ import { FilterOption, IProposal } from "@types";
test.describe("Logged in DRep", () => {
test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet });

test("4E. Should display DRep's voting power in governance actions page", async ({
page,
}) => {
const votingPowerPromise = page.waitForResponse("**/get-voting-power/**");
const governanceActionsPage = new GovernanceActionsPage(page);
await governanceActionsPage.goto();
test.beforeEach(async () => {
await setAllureEpic("4. Proposal visibility");
});

test("4E. Should display DRep's voting power in governance actions page", async ({
page,
}) => {
const votingPowerPromise = page.waitForResponse("**/get-voting-power/**");
const governanceActionsPage = new GovernanceActionsPage(page);
await governanceActionsPage.goto();

const res = await votingPowerPromise;
const votingPower = await res.json();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { user01Wallet } from "@constants/staticWallets";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import extractExpiryDateFromText from "@helpers/extractExpiryDateFromText";
import { isMobile, openDrawer } from "@helpers/mobile";
import removeAllSpaces from "@helpers/removeAllSpaces";
Expand All @@ -24,6 +25,10 @@ enum SortOption {

test.use({ storageState: ".auth/user01.json", wallet: user01Wallet });

test.beforeEach(async () => {
await setAllureEpic("4. Proposal visibility");
});

test("4A.1: Should access Governance Actions page with connecting wallet", async ({
page,
}) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { setAllureEpic } from "@helpers/allure";
import GovernanceActionsPage from "@pages/governanceActionsPage";
import { expect, test } from "@playwright/test";

test.beforeEach(async () => {
await setAllureEpic("4. Proposal visibility");
});

test("4A.2: Should access Governance Actions page without connecting wallet", async ({
page,
}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import environments from "@constants/environments";
import { dRep01Wallet } from "@constants/staticWallets";
import { createTempDRepAuth } from "@datafactory/createAuth";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { ShelleyWallet } from "@helpers/crypto";
import { createNewPageWithWallet } from "@helpers/page";
import {
Expand All @@ -14,6 +15,10 @@ import GovernanceActionsPage from "@pages/governanceActionsPage";
import { expect } from "@playwright/test";
import kuberService from "@services/kuberService";

test.beforeEach(async () => {
await setAllureEpic("5. Proposal functionality");
});

test.describe("Proposal checks", () => {
test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet });

Expand Down Expand Up @@ -60,7 +65,8 @@ test.describe("Proposal checks", () => {
});

// Skipped: No url/hash input to validate
test.skip("5D. Should validate proposal voting", async () => {
test("5D. Should validate proposal voting", async () => {
test.skip();
// const invalidURLs = ["testdotcom", "https://testdotcom", "https://test.c"];
// invalidURLs.forEach(async (url) => {
// govActionDetailsPage.urlInput.fill(url);
Expand Down Expand Up @@ -198,7 +204,7 @@ test.describe("Check voting power", () => {

await dRepPage.goto("/");
await dRepPage.getByTestId("retire-button").click();
await dRepPage.getByTestId("continue-retirement-button").click();
await dRepPage.getByTestId("continue-retirement-button").click();
await expect(
dRepPage.getByTestId("retirement-transaction-submitted-modal")
).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { user01Wallet } from "@constants/staticWallets";
import { test } from "@fixtures/walletExtension";
import { setAllureEpic } from "@helpers/allure";
import { expect } from "@playwright/test";

test.use({ storageState: ".auth/user01.json", wallet: user01Wallet });

test.beforeEach(async () => {
await setAllureEpic("5. Proposal functionality");
});

test("5J. Should hide retirement option for non-registered DRep", async ({
page,
}) => {
Expand Down
Loading
Loading