@@ -431,27 +431,57 @@ async function exerciseCertificates(page) {
431431 await waitForWindowAnimation ( page , 'certificates' ) ;
432432 const mobileRoot = appWindow . locator ( '[data-certificates-root]' ) ;
433433 await mobileRoot . locator ( '[data-certificate-preview]' ) . waitFor ( { state : 'visible' } ) ;
434+ await mobileRoot . locator ( '[data-certificate-filter="security"]' ) . click ( ) ;
435+ await mobileRoot . locator ( '[data-certificate-id="asis-security-defense"]' ) . click ( ) ;
436+ await page . waitForFunction ( ( ) => {
437+ const detail = document . querySelector ( '.window[data-window-id="certificates"] [data-certificate-detail]' ) ;
438+ return detail && detail . getAnimations ( { subtree : true } ) . every ( ( animation ) => animation . playState === 'finished' ) ;
439+ } ) ;
434440 const mobile = await mobileRoot . evaluate ( ( rootNode ) => {
435441 const appRect = rootNode . getBoundingClientRect ( ) ;
436442 const filters = rootNode . querySelector ( '.xp-certificate-filters' ) ;
443+ const list = rootNode . querySelector ( '.xp-certificate-list' ) ;
437444 const detail = rootNode . querySelector ( '[data-certificate-detail]' ) ;
438445 const preview = rootNode . querySelector ( '[data-certificate-preview]' ) ;
439446 const caption = rootNode . querySelector ( '.xp-certificate-preview figcaption' ) ;
440447 const actions = Array . from ( rootNode . querySelectorAll ( '.xp-certificate-actions a:not([hidden])' ) ) ;
448+ const visibleItems = Array . from ( rootNode . querySelectorAll ( '[data-certificate-id]' ) )
449+ . filter ( ( item ) => getComputedStyle ( item ) . display !== 'none' ) ;
441450 const previewRect = preview . getBoundingClientRect ( ) ;
442451 const captionRect = caption . getBoundingClientRect ( ) ;
443452 const detailRect = detail . getBoundingClientRect ( ) ;
453+ const listRect = list . getBoundingClientRect ( ) ;
454+ const cardsContained = visibleItems . every ( ( item ) => {
455+ const itemRect = item . getBoundingClientRect ( ) ;
456+ const copyRect = item . querySelector ( '.xp-certificate-item-copy' ) . getBoundingClientRect ( ) ;
457+ return itemRect . top >= listRect . top - 1
458+ && itemRect . bottom <= listRect . bottom + 1
459+ && copyRect . top >= itemRect . top - 1
460+ && copyRect . bottom <= itemRect . bottom + 1
461+ && getComputedStyle ( item ) . overflow === 'hidden' ;
462+ } ) ;
444463 return {
445464 noPageOverflow : document . documentElement . scrollWidth <= window . innerWidth + 1 ,
446465 appContained : appRect . left >= - 1 && appRect . right <= window . innerWidth + 1 ,
447466 appRect : { left : appRect . left , right : appRect . right , width : appRect . width , viewport : window . innerWidth } ,
448467 filtersScrollable : filters . scrollWidth >= filters . clientWidth ,
468+ securityCards : visibleItems . length ,
469+ cardsContained,
470+ listSeparated : listRect . bottom <= detailRect . top + 1 ,
449471 previewContained : previewRect . left >= detailRect . left - 1 && previewRect . right <= detailRect . right + 1 ,
450472 captionSeparated : previewRect . bottom <= captionRect . top + 0.5 && captionRect . height >= 23.5 ,
451473 actionsReachable : actions . every ( ( action ) => action . getBoundingClientRect ( ) . height >= 39.5 )
452474 } ;
453475 } ) ;
454- ensure ( mobile . noPageOverflow && mobile . appContained && mobile . filtersScrollable && mobile . previewContained && mobile . captionSeparated && mobile . actionsReachable , `Certificados no se adaptó al viewport móvil (${ JSON . stringify ( mobile ) } )` ) ;
476+ ensure ( mobile . noPageOverflow
477+ && mobile . appContained
478+ && mobile . filtersScrollable
479+ && mobile . securityCards === 2
480+ && mobile . cardsContained
481+ && mobile . listSeparated
482+ && mobile . previewContained
483+ && mobile . captionSeparated
484+ && mobile . actionsReachable , `Certificados no se adaptó al viewport móvil (${ JSON . stringify ( mobile ) } )` ) ;
455485
456486 await page . evaluate ( ( ) => window . zarateXP . windowManager . closeWindow ( 'certificates' ) ) ;
457487 await appWindow . waitFor ( { state : 'detached' } ) ;
0 commit comments