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

Enable proposal auth setup #1460

Merged
merged 2 commits into from
Jul 3, 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 @@ -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 });
});