11import { test } from "@fixtures/walletExtension" ;
22import { setAllureEpic } from "@helpers/allure" ;
3+ import { injectLogger } from "@helpers/page" ;
34import { functionWaitedAssert } from "@helpers/waitedLoop" ;
45import BudgetDiscussionPage from "@pages/budgetDiscussionPage" ;
56import { expect } from "@playwright/test" ;
@@ -81,7 +82,7 @@ test.describe("Budget proposal list manipulation", () => {
8182 budgetDiscussionPage = new BudgetDiscussionPage ( page ) ;
8283 await budgetDiscussionPage . goto ( ) ;
8384 } ) ;
84-
85+
8586 test ( "11B_2. Should filter budget proposals by categories" , async ( ) => {
8687 test . slow ( ) ;
8788 await budgetDiscussionPage . filterBtn . click ( ) ;
@@ -98,7 +99,7 @@ test.describe("Budget proposal list manipulation", () => {
9899 "asc" ,
99100 ( p1 , p2 ) => p1 . attributes . createdAt <= p2 . attributes . createdAt
100101 ) ;
101-
102+
102103 await budgetDiscussionPage . sortAndValidate (
103104 "desc" ,
104105 ( p1 , p2 ) => p1 . attributes . createdAt >= p2 . attributes . createdAt
@@ -107,7 +108,45 @@ test.describe("Budget proposal list manipulation", () => {
107108 } ) ;
108109} ) ;
109110
110- test ( "11C. Should show view-all categorized budget proposal" , async ( { } ) => { } ) ;
111+ test ( "11C. Should show view-all categorized budget proposal" , async ( {
112+ browser,
113+ } ) => {
114+ await Promise . all (
115+ Object . values ( BudgetProposalType ) . map ( async ( proposalType : string ) => {
116+ const context = await browser . newContext ( ) ;
117+ const page = await context . newPage ( ) ;
118+ injectLogger ( page ) ;
119+
120+ const budgetDiscussionPage = new BudgetDiscussionPage ( page ) ;
121+ await budgetDiscussionPage . goto ( ) ;
122+ const isShowAllButtonVisible = await page
123+ . waitForSelector (
124+ `[data-testid="${ proposalType . toLowerCase ( ) . replace ( / / g, "-" ) } -show-all-button"]` ,
125+ { timeout : 60_000 }
126+ )
127+ . then ( ( ) => true )
128+ . catch ( ( ) => false ) ;
129+
130+ if ( isShowAllButtonVisible ) {
131+ await page
132+ . getByTestId (
133+ proposalType . toLowerCase ( ) . replace ( / / g, "-" ) + "-show-all-button"
134+ )
135+ . click ( ) ;
136+
137+ const proposalCards = await budgetDiscussionPage . getAllProposals ( ) ;
138+
139+ for ( const proposalCard of proposalCards ) {
140+ await expect (
141+ proposalCard . getByTestId ( "budget-discussion-type" )
142+ ) . toHaveText ( proposalType , { timeout : 60_000 } ) ;
143+ }
144+ } else {
145+ expect ( true , `No ${ proposalType } found` ) . toBeTruthy ( ) ;
146+ }
147+ } )
148+ ) ;
149+ } ) ;
111150
112151test ( "11D. Should share budget proposal" , async ( { } ) => { } ) ;
113152
0 commit comments