Skip to content

Commit

Permalink
chore: add extra assertion on save proposal as a draft
Browse files Browse the repository at this point in the history
save treasury proposal as a draft and validate the input value inside the draft
  • Loading branch information
kneerose committed Dec 10, 2024
1 parent e073eb7 commit a94ee13
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export default class ProposalSubmissionPage {
);
readonly amountInput = this.page.getByTestId("amount-0-text-input");
readonly closeDraftSuccessModalBtn = this.page.getByTestId("close-button");
readonly linkTextInput = this.page.getByTestId("link-0-text-input");
readonly linkUrlInput = this.page.getByTestId("link-0-url-input");


constructor(private readonly page: Page) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,45 @@ test.describe("Info Proposal Draft", () => {

const proposalSubmissionPage = new ProposalSubmissionPage(page);
const { proposalFormValue } = await proposalSubmissionPage.createDraft(
ProposalType.info
ProposalType.treasury
);
const draftCard = proposalSubmissionPage.getFirstDraft();
const draftCardAllInnerText = await (await draftCard).allInnerTexts();

expect(draftCardAllInnerText.includes(proposalFormValue.prop_name));
expect(draftCardAllInnerText.includes(proposalFormValue.prop_abstract));

(await draftCard)
.locator('[data-testid^="draft-"][data-testid$="-start-editing"]')
.click();

await expect(proposalSubmissionPage.governanceActionType).toHaveText(
ProposalType.treasury
);
await expect(proposalSubmissionPage.titleInput).toHaveValue(
proposalFormValue.prop_name
);
await expect(proposalSubmissionPage.abstractInput).toHaveValue(
proposalFormValue.prop_abstract
);
await expect(proposalSubmissionPage.motivationInput).toHaveValue(
proposalFormValue.prop_motivation
);
await expect(proposalSubmissionPage.rationaleInput).toHaveValue(
proposalFormValue.prop_rationale
);
await expect(proposalSubmissionPage.receivingAddressInput).toHaveValue(
proposalFormValue.prop_receiving_address
);
await expect(proposalSubmissionPage.amountInput).toHaveValue(
proposalFormValue.prop_amount
);
await expect(proposalSubmissionPage.linkUrlInput).toHaveValue(
proposalFormValue.proposal_links[0].prop_link
);
await expect(proposalSubmissionPage.linkTextInput).toHaveValue(
proposalFormValue.proposal_links[0].prop_link_text
);
});

test("7M_1. Should edit a info proposal draft", async ({ browser }) => {
Expand Down

0 comments on commit a94ee13

Please sign in to comment.