Skip to content

Commit 55f2887

Browse files
committed
fix: filter proposal before show all button action
1 parent d04969d commit 55f2887

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

tests/govtool-frontend/playwright/tests/8-proposal-discussion/proposalDiscussion.spec.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,15 @@ test("8D. Should show the view-all categorized proposed governance actions.", as
102102
[ProposalType.info]: mockInfoProposedGA,
103103
[ProposalType.treasury]: mockTreasuryProposal,
104104
}).map(async ([proposalType, mockData]) => {
105-
const govActionTypeId = proposalType === ProposalType.info ? 1 : 2;
106-
const requestUrl = `**/api/proposals?filters[$and][0][gov_action_type_id]=${govActionTypeId}&**`;
107-
let requestHandled = false;
105+
const requestUrl = `**/api/proposals?**`;
106+
let requestHandled = 0;
108107

109108
const context = await browser.newContext();
110109
const page = await context.newPage();
111110

112111
await page.route(requestUrl, async (route) => {
113-
if (!requestHandled) {
114-
requestHandled = true;
112+
if (requestHandled < 2) {
113+
requestHandled = requestHandled + 1;
115114
return route.fulfill({
116115
body: JSON.stringify(mockData),
117116
});
@@ -122,13 +121,12 @@ test("8D. Should show the view-all categorized proposed governance actions.", as
122121
const proposalDiscussionPage = new ProposalDiscussionPage(page);
123122
await proposalDiscussionPage.goto();
124123

125-
const showAllButton = page.getByTestId("show-all-button");
124+
await proposalDiscussionPage.filterBtn.click();
125+
await proposalDiscussionPage.filterProposalByNames([proposalType]);
126+
// to close the filter menu
127+
await proposalDiscussionPage.filterBtn.click({ force: true });
126128

127-
if (proposalType === ProposalType.treasury) {
128-
await showAllButton.nth(1).click();
129-
} else {
130-
await showAllButton.first().click();
131-
}
129+
proposalDiscussionPage.showAllBtn.click();
132130

133131
const proposalCards = await proposalDiscussionPage.getAllProposals();
134132

0 commit comments

Comments
 (0)