@@ -86,6 +86,10 @@ test("2N. Should show DRep information on details page", async ({
8686
8787 await dRepRegistrationPage . confirmBtn . click ( ) ;
8888
89+ // Add an assertion to prevent clicking on "View Your dRep Details".
90+ await expect (
91+ dRepPage . getByTestId ( "dRep-id-display-card-dashboard" )
92+ ) . toContainText ( wallet . dRepId , { timeout : 10_000 } ) ;
8993 await dRepPage . getByTestId ( "view-drep-details-button" ) . click ( ) ;
9094
9195 // Verification
@@ -189,12 +193,47 @@ test("2I. Should check validity of DRep Id", async ({ page }) => {
189193 await expect ( dRepDirectory . getDRepCard ( invalidDRepId ) ) . not . toBeVisible ( ) ;
190194} ) ;
191195
192- test ( "2J. Should search by DRep id" , async ( { page } ) => {
196+ test ( "2J. Should search by DRep id and DRep givenname" , async ( { page } ) => {
197+ let dRepGivenName = "test" ;
198+
199+ await page . route (
200+ "**/drep/list?page=0&pageSize=10&sort=Random" ,
201+ async ( route ) => {
202+ const response = await route . fetch ( ) ;
203+ const json = await response . json ( ) ;
204+ const elements = json [ "elements" ] . filter (
205+ ( element ) => element [ "givenName" ] != null
206+ ) ;
207+ dRepGivenName =
208+ elements [ Math . floor ( Math . random ( ) * elements . length ) ] [ "givenName" ] ;
209+ await route . fulfill ( {
210+ status : 200 ,
211+ contentType : "application/json" ,
212+ body : JSON . stringify ( json ) ,
213+ } ) ;
214+ }
215+ ) ;
216+
217+ const responsePromise = page . waitForResponse (
218+ "**/drep/list?page=0&pageSize=10&sort=Random"
219+ ) ;
220+
193221 const dRepDirectory = new DRepDirectoryPage ( page ) ;
194222 await dRepDirectory . goto ( ) ;
195223
224+ await responsePromise ;
225+
226+ // search by dRep Id
196227 await dRepDirectory . searchInput . fill ( dRep01Wallet . dRepId ) ;
197228 await expect ( dRepDirectory . getDRepCard ( dRep01Wallet . dRepId ) ) . toBeVisible ( ) ;
229+
230+ // search by dRep givenname
231+ await dRepDirectory . searchInput . fill ( dRepGivenName ) ;
232+ const searchDRepCards = await dRepDirectory . getAllListedDReps ( ) ;
233+
234+ for ( const dRepCard of searchDRepCards ) {
235+ expect ( ( await dRepCard . innerText ( ) ) . includes ( dRepGivenName ) ) ;
236+ }
198237} ) ;
199238
200239test ( "2M. Should access dRep directory page on disconnected state" , async ( {
0 commit comments