Skip to content

Commit

Permalink
refactor: add cleanup logic for test-created proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
kneerose committed Dec 23, 2024
1 parent 6728870 commit b1ee1ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ test.describe("Proposal created logged state", () => {
await proposalSubmissionPage.submitBtn.click();

await expect(page.getByTestId("submit-as-GA-button")).toBeVisible();
const proposalDetailsPage = new ProposalDiscussionDetailsPage(page);

await expect(proposalSubmissionPage.titleContent).toHaveText(
proposal.prop_name
);
Expand All @@ -159,6 +161,9 @@ test.describe("Proposal created logged state", () => {
await expect(proposalSubmissionPage.linkTextContent).toHaveText(
proposal.proposal_links[0].prop_link_text
);

// cleanup
await proposalDetailsPage.deleteProposal();
});
});
});
Expand Down Expand Up @@ -428,6 +433,9 @@ test.describe("Info Proposal Draft", () => {
await proposalSubmissionPage.submitBtn.click();

await expect(page.getByTestId("submit-as-GA-button")).toBeVisible();
const proposalDiscussionDetailsPage = new ProposalDiscussionDetailsPage(
page
);
await expect(proposalSubmissionPage.titleContent).toHaveText(
proposalFormValue.prop_name
);
Expand All @@ -446,6 +454,9 @@ test.describe("Info Proposal Draft", () => {
await expect(proposalSubmissionPage.linkTextContent).toHaveText(
proposalFormValue.proposal_links[0].prop_link_text
);

//cleanup
proposalDiscussionDetailsPage.deleteProposal();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
proposal02Wallet,
user01Wallet,
} from "@constants/staticWallets";
import { createTempUserAuth } from "@datafactory/createAuth";
import { faker } from "@faker-js/faker";
import { test } from "@fixtures/proposal";
import { ShelleyWallet } from "@helpers/crypto";
import { createNewPageWithWallet } from "@helpers/page";
import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage";
import { Page, expect } from "@playwright/test";
Expand Down Expand Up @@ -133,20 +131,6 @@ test.describe("Proposal created with poll enabled (user auth)", () => {
});
});

test.describe("Proposal created logged out state", () => {
let userPage: Page;

test.beforeEach(async ({ page, browser }) => {
const wallet = (await ShelleyWallet.generate()).json();
const tempUserAuth = await createTempUserAuth(page, wallet);

userPage = await createNewPageWithWallet(browser, {
storageState: tempUserAuth,
wallet,
});
});
});

test.describe("Proposal created with poll enabled (proposal auth)", () => {
test.use({
storageState: ".auth/user01.json",
Expand Down

0 comments on commit b1ee1ea

Please sign in to comment.