Skip to content

Commit

Permalink
Merge pull request #1460 from IntersectMBO/feat/enable-proposal-auth-…
Browse files Browse the repository at this point in the history
…setup

Enable proposal auth setup
  • Loading branch information
NabinKawan authored Jul 3, 2024
2 parents 48d871c + 20f1b63 commit f69f8d8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { faker } from "@faker-js/faker";
import { generateWalletAddress } from "@helpers/cardano";
import { extractProposalIdFromUrl } from "@helpers/string";
import { Page } from "@playwright/test";
import { ProposalCreateRequest } from "@services/proposalDiscussion/types";
import environments from "lib/constants/environments";
import ProposalDiscussionDetailsPage from "./proposalDiscussionDetailsPage";
import {ProposalCreateRequest} from "@types";

export default class ProposalDiscussionPage {
// Buttons
Expand All @@ -24,6 +24,9 @@ export default class ProposalDiscussionPage {
readonly showLessBtn = this.page.getByRole("button", { name: "Show less" });
readonly infoRadio = this.page.getByLabel("Info");
readonly treasuryRadio = this.page.getByLabel("Treasury");
readonly verifyIdentityBtn = this.page.getByRole("button", {
name: "Verify your identity",
});

constructor(private readonly page: Page) {}

Expand Down
18 changes: 18 additions & 0 deletions tests/govtool-frontend/playwright/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,21 @@ export type CommentResponse = {
subcommens_number: number;
};
};


export type ProposalLink = {
prop_link: string;
prop_link_text: string;
};

export type ProposalCreateRequest = {
proposal_links: Array<ProposalLink>;
gov_action_type_id: number;
prop_name: string;
prop_abstract: string;
prop_motivation: string;
prop_rationale: string;
prop_receiving_address?: string;
prop_amount?: string;
is_draft: boolean;
};
34 changes: 17 additions & 17 deletions tests/govtool-frontend/playwright/tests/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ setup("Create AdaHolder 06 auth", async ({ page, context }) => {
await context.storageState({ path: adaHolder06AuthFile });
});

/**
* TODO: Uncomment this
* This has been commented to temporarily disable pdf-tests
*/
// setup("Create Proposal 01 auth", async ({ page, context }) => {
// await importWallet(page, proposal01Wallet);

// const loginPage = new LoginPage(page);
// await loginPage.login();
// await loginPage.isLoggedIn();

// const proposalDiscussionPage = new ProposalDiscussionPage(page);
// await proposalDiscussionPage.goto();
// await proposalDiscussionPage.setUsername(faker.internet.userName());

// await context.storageState({ path: proposal01AuthFile });
// });
setup("Create Proposal 01 auth", async ({ page, context }) => {
await importWallet(page, proposal01Wallet);

const loginPage = new LoginPage(page);
await loginPage.login();
await loginPage.isLoggedIn();

const proposalDiscussionPage = new ProposalDiscussionPage(page);
await proposalDiscussionPage.goto();
await proposalDiscussionPage.verifyIdentityBtn.click();

await proposalDiscussionPage.setUsername(
faker.internet.userName().toLowerCase()
);

await context.storageState({ path: proposal01AuthFile });
});

0 comments on commit f69f8d8

Please sign in to comment.