@@ -10,18 +10,19 @@ import GovernanceActionDetailsPage from "@pages/governanceActionDetailsPage";
1010import GovernanceActionsPage from "@pages/governanceActionsPage" ;
1111import { expect } from "@playwright/test" ;
1212import { test } from "@fixtures/walletExtension" ;
13- import { GovernanceActionType , IProposal } from "@types" ;
13+ import { GovernanceActionType , IProposal , PaginatedLiveProposal } from "@types" ;
1414import { injectLogger } from "@helpers/page" ;
1515import removeAllSpaces from "@helpers/removeAllSpaces" ;
1616import { functionWaitedAssert } from "@helpers/waitedLoop" ;
1717import extractExpiryDateFromText from "@helpers/extractExpiryDateFromText" ;
18+ import { InvalidMetadata } from "@constants/index" ;
1819
1920test . beforeEach ( async ( ) => {
2021 await setAllureEpic ( "4. Proposal visibility" ) ;
2122 await skipIfNotHardFork ( ) ;
2223} ) ;
2324
24- const infoTypeProposal = require ( "../../lib/_mock/infoTypeProposal.json" ) ;
25+ const infoTypeProposal : PaginatedLiveProposal = require ( "../../lib/_mock/infoTypeProposal.json" ) ;
2526
2627const filterOptionNames = [
2728 "Protocol Parameter Change" ,
@@ -298,3 +299,37 @@ test("4K. Should display correct vote counts on governance details page for disc
298299 } )
299300 ) ;
300301} ) ;
302+
303+ test . describe ( "Invalid Live voting Metadata" , ( ) => {
304+ InvalidMetadata . forEach ( ( { type, reason, url, hash } , index ) => {
305+ test ( `4P_${ index + 1 } : Should display ${ type } message in live voting when ${ reason } ` , async ( {
306+ page,
307+ } ) => {
308+ const proposal : IProposal = {
309+ ...infoTypeProposal . elements [ 0 ] ,
310+ url,
311+ metadataHash : hash ,
312+ } ;
313+ const liveProposalResponse : PaginatedLiveProposal = {
314+ ...infoTypeProposal ,
315+ elements : [ proposal ] ,
316+ } ;
317+
318+ await page . route ( "**/proposal/list?**" , async ( route ) =>
319+ route . fulfill ( {
320+ body : JSON . stringify ( liveProposalResponse ) ,
321+ } )
322+ ) ;
323+
324+ const governanceActionPage = new GovernanceActionsPage ( page ) ;
325+ await governanceActionPage . goto ( ) ;
326+ await governanceActionPage . viewFirstProposal ( ) ;
327+
328+ await expect ( page . getByRole ( "heading" , { name : type } ) ) . toBeVisible ( {
329+ timeout : 60_000 ,
330+ } ) ;
331+ await expect ( page . getByText ( "Learn more" ) ) . toBeVisible ( ) ;
332+ await expect ( page . getByTestId ( "external-modal-button" ) ) . toBeVisible ( ) ;
333+ } ) ;
334+ } ) ;
335+ } ) ;
0 commit comments