@@ -168,22 +168,13 @@ describe(`LlamaLend Markets`, () => {
168168 } )
169169
170170 it ( `should allow filtering by token` , ( ) => {
171- const tokenField = 'collateral_token'
172171 if ( breakpoint == 'mobile' ) {
173172 cy . get ( `[data-testid="btn-drawer-filter-lamalend-markets"]` ) . click ( )
174173 } else {
175174 cy . get ( `[data-testid="btn-expand-filters"]` ) . click ( )
176175 }
177-
178- const collateralCoins = vaultData . ethereum . data
179- . filter ( ( d ) => d . total_assets_usd - d . total_debt_usd > SMALL_POOL_TVL )
180- . map ( ( d ) => d [ tokenField ] . symbol )
181-
182- const collateral = oneOf ( ...collateralCoins )
183- const borrowed = oneOf ( 'CRV' , 'crvUSD' )
184-
185- selectCoin ( collateral , 'collateral' )
186- selectCoin ( borrowed , 'borrowed' )
176+ selectCoin ( 'collateral' )
177+ selectCoin ( 'borrowed' )
187178 } )
188179
189180 it ( 'should allow filtering favorites' , { scrollBehavior : false } , ( ) => {
@@ -316,6 +307,25 @@ describe(`LlamaLend Markets`, () => {
316307 }
317308 cy . get ( `[data-testid="line-graph-${ type } "] path` ) . first ( ) . should ( 'have.attr' , 'stroke' , color )
318309 }
310+
311+ function selectCoin ( type : TokenType ) {
312+ const symbol = oneOf (
313+ ...vaultData . ethereum . data
314+ . filter ( ( d ) => d . total_assets_usd - d . total_debt_usd > SMALL_POOL_TVL )
315+ . map ( ( d ) => d [ `${ type } _token` ] . symbol ) ,
316+ )
317+ const columnId = `assets_${ type } _symbol`
318+ cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu
319+ cy . get ( `[data-testid="multi-select-clear"]` ) . click ( ) // deselect previously selected tokens
320+ cy . get ( `[data-testid="menu-${ columnId } "]` ) . should ( 'not.exist' ) // clicking on clear closes the menu
321+ cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu again
322+ cy . get ( `[data-testid="menu-${ columnId } "] [value="${ symbol } "]` ) . click ( ) // select the token
323+ cy . get ( 'body' ) . click ( 0 , 0 ) // close popover
324+ cy . get ( `[data-testid="data-table-cell-assets"] [data-testid^="token-icon-${ symbol } "]` ) . should ( 'exist' ) // token might be hidden behind other tokens
325+
326+ cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu
327+ cy . get ( `[data-testid="multi-select-clear"]` ) . click ( ) // deselect previously selected tokens
328+ }
319329} )
320330
321331describe ( `LlamaLend Storage Migration` , ( ) => {
@@ -344,20 +354,6 @@ function visitAndWait([width, height]: [number, number, Breakpoint], options?: P
344354 cy . get ( '[data-testid="data-table"]' , LOAD_TIMEOUT ) . should ( 'be.visible' )
345355}
346356
347- const selectCoin = ( symbol : string , type : TokenType ) => {
348- const columnId = `assets_${ type } _symbol`
349- cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu
350- cy . get ( `[data-testid="multi-select-clear"]` ) . click ( ) // deselect previously selected tokens
351- cy . get ( `[data-testid="menu-${ columnId } "]` ) . should ( 'not.exist' ) // clicking on clear closes the menu
352- cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu again
353- cy . get ( `[data-testid="menu-${ columnId } "] [value="${ symbol } "]` ) . click ( ) // select the token
354- cy . get ( 'body' ) . click ( 0 , 0 ) // close popover
355- cy . get ( `[data-testid="data-table-cell-assets"] [data-testid^="token-icon-${ symbol } "]` ) . should ( 'exist' ) // token might be hidden behind other tokens
356-
357- cy . get ( `[data-testid="multi-select-filter-${ columnId } "]` ) . click ( ) // open the menu
358- cy . get ( `[data-testid="multi-select-clear"]` ) . click ( ) // deselect previously selected tokens
359- }
360-
361357function enableGraphColumn ( ) {
362358 cy . get ( `[data-testid="line-graph-${ MarketRateType . Borrow } "]` ) . should ( 'not.exist' )
363359 cy . get ( `[data-testid="btn-visibility-settings"]` ) . click ( )
0 commit comments