@@ -7,7 +7,7 @@ import DRepDetailsPage from "@pages/dRepDetailsPage";
77import DRepDirectoryPage from "@pages/dRepDirectoryPage" ;
88import { expect , Locator } from "@playwright/test" ;
99import { test } from "@fixtures/walletExtension" ;
10- import { DRepStatus , IDRep } from "@types" ;
10+ import { DRepStatus , IDRep , PaginatedDRepResponse } from "@types" ;
1111
1212test . beforeEach ( async ( ) => {
1313 await setAllureEpic ( "2. Delegation" ) ;
@@ -27,7 +27,7 @@ const statusRank: Record<DRepStatus, number> = {
2727 Retired : 3 ,
2828} ;
2929
30- const scripDRepId = require ( "../../lib/_mock/scriptDRep.json" ) ;
30+ const scripDRepId : PaginatedDRepResponse = require ( "../../lib/_mock/scriptDRep.json" ) ;
3131
3232test ( "2K_2. Should sort DReps" , async ( { page } ) => {
3333 test . slow ( ) ;
@@ -226,29 +226,40 @@ test.describe("DRep dependent tests", () => {
226226 } ) ;
227227} ) ;
228228
229- test ( "2Y. Should correctly convert CIP-129/CIP-105 script dRep" , async ( { page } ) => {
230- const dRepId = scripDRepId . elements [ 0 ] [ "drepId" ] ;
231- await page . route ( "**/drep/list?page=0&pageSize=10&**" , async ( route ) => {
232- await route . fulfill ( {
233- status : 200 ,
234- contentType : "application/json" ,
235- body : JSON . stringify ( scripDRepId ) ,
229+ Object . values ( [ "script drep" , "drep" ] ) . forEach ( ( type , index ) => {
230+ test ( `2Y_${ index + 1 } . Should correctly convert CIP-129/CIP-105 ${ type } ` , async ( {
231+ page,
232+ } ) => {
233+ const dRepId = scripDRepId . elements [ 0 ] [ "drepId" ] ;
234+ const dRepResponse = {
235+ ...scripDRepId ,
236+ elements : [ { ...scripDRepId . elements [ 0 ] , isScriptBased : false } ] ,
237+ } ;
238+ await page . route ( "**/drep/list?page=0&pageSize=10&**" , async ( route ) => {
239+ await route . fulfill ( {
240+ status : 200 ,
241+ contentType : "application/json" ,
242+ body : JSON . stringify ( type === "drep" ? dRepResponse : scripDRepId ) ,
243+ } ) ;
236244 } ) ;
237- } ) ;
238245
239- const responsePromise = page . waitForResponse (
240- "**/drep/list?page=0&pageSize=10&**"
241- ) ;
246+ const responsePromise = page . waitForResponse (
247+ "**/drep/list?page=0&pageSize=10&**"
248+ ) ;
242249
243- const { cip129, cip105 } = convertDRep ( dRepId , true ) ;
250+ const { cip129, cip105 } = convertDRep (
251+ dRepId ,
252+ type === "drep" ? false : true
253+ ) ;
244254
245- await page . goto ( `/drep_directory/${ dRepId } ` ) ;
246- await responsePromise ;
255+ await page . goto ( `/drep_directory/${ dRepId } ` ) ;
256+ await responsePromise ;
247257
248- await expect (
249- page . getByTestId ( "cip-129-drep-id-info-item-description" )
250- ) . toHaveText ( cip129 , { timeout : 60_000 } ) ;
251- await expect (
252- page . getByTestId ( "cip-105-drep-id-info-item-description" )
253- ) . toHaveText ( cip105 ) ;
258+ await expect (
259+ page . getByTestId ( "cip-129-drep-id-info-item-description" )
260+ ) . toHaveText ( cip129 , { timeout : 60_000 } ) ;
261+ await expect (
262+ page . getByTestId ( "cip-105-drep-id-info-item-description" )
263+ ) . toHaveText ( cip105 ) ;
264+ } ) ;
254265} ) ;
0 commit comments