@@ -2747,12 +2747,17 @@ async function blastRadiusChecks() {
27472747const PREFETCHED_ON_LAYOUT = [
27482748 { label : 'chat list' , pattern : / ^ \/ a p i \/ m o t h e r s h i p \/ c h a t s \? / } ,
27492749 { label : 'profile' , pattern : / ^ \/ a p i \/ u s e r s \/ m e \/ p r o f i l e / } ,
2750+ { label : 'workspace list' , pattern : / ^ \/ a p i \/ w o r k s p a c e s ( \? | $ ) / } ,
27502751]
2751- const PREFETCHED_ON_HOME = [
2752+ const PREFETCHED_INVENTORY = [
27522753 { label : 'connected accounts' , pattern : / \/ c o n n e c t e d - a c c o u n t s ( \? | $ ) / } ,
27532754 { label : 'search integrations' , pattern : / \/ a p i \/ k n o w l e d g e \/ s i m - s e a r c h \/ i n t e g r a t i o n s / } ,
2754- { label : 'search history' , pattern : / \/ s e a r c h \/ h i s t o r y ( \? | $ ) / } ,
27552755]
2756+ const PREFETCHED_HISTORY = [ { label : 'search history' , pattern : / \/ s e a r c h \/ h i s t o r y ( \? | $ ) / } ]
2757+ const PREFETCHED_SECRET_SOURCE = [
2758+ { label : 'secret source' , pattern : / \/ s e c r e t s \/ s o u r c e | \/ s e c r e t - s o u r c e / } ,
2759+ ]
2760+ const PREFETCHED_LINKS = [ { label : 'links first page' , pattern : / \/ s i m - l i n k s ( \? (? ! .* c u r s o r = ) | $ ) / } ]
27562761
27572762async function firstPaintChecks ( ) {
27582763 section ( '6 First paint' )
@@ -2761,32 +2766,77 @@ async function firstPaintChecks() {
27612766 name : 'Home' ,
27622767 path : 'home' ,
27632768 primary : ( page : Page ) => composer ( page ) ,
2764- prefetched : [ ...PREFETCHED_ON_LAYOUT , ...PREFETCHED_ON_HOME ] ,
2769+ prefetched : [ ...PREFETCHED_ON_LAYOUT , ...PREFETCHED_INVENTORY , ... PREFETCHED_HISTORY ] ,
27652770 } ,
27662771 {
27672772 name : 'Search' ,
27682773 path : 'search?mode=search' ,
27692774 primary : ( page : Page ) => searchField ( page ) ,
2770- prefetched : PREFETCHED_ON_LAYOUT ,
2775+ prefetched : [ ... PREFETCHED_ON_LAYOUT , ... PREFETCHED_HISTORY ] ,
27712776 } ,
27722777 {
27732778 name : 'Integrations' ,
27742779 path : 'integrations' ,
27752780 primary : ( page : Page ) => page . getByRole ( 'link' , { name : / ^ G m a i l / } ) ,
2776- prefetched : PREFETCHED_ON_LAYOUT ,
2781+ prefetched : [ ... PREFETCHED_ON_LAYOUT , ... PREFETCHED_INVENTORY , ... PREFETCHED_SECRET_SOURCE ] ,
27772782 } ,
27782783 {
27792784 name : 'Links' ,
27802785 path : 'links' ,
27812786 primary : ( page : Page ) => page . getByRole ( 'row' ) . nth ( 1 ) ,
2782- prefetched : PREFETCHED_ON_LAYOUT ,
2787+ prefetched : [ ...PREFETCHED_ON_LAYOUT , ...PREFETCHED_LINKS ] ,
2788+ } ,
2789+ {
2790+ name : 'Links by opens' ,
2791+ path : 'links?sort=popular&dir=desc' ,
2792+ primary : ( page : Page ) => page . getByRole ( 'row' ) . nth ( 1 ) ,
2793+ prefetched : [ ...PREFETCHED_ON_LAYOUT , ...PREFETCHED_LINKS ] ,
27832794 } ,
27842795 ] satisfies {
27852796 name : string
27862797 path : string
27872798 primary : ( page : Page ) => Locator
27882799 prefetched : { label : string ; pattern : RegExp } [ ]
27892800 } [ ]
2801+ await check (
2802+ 'Links paints its first page from the server, even with the client read refused' ,
2803+ async ( ) => {
2804+ await withSession ( MEMBER , async ( { page } ) => {
2805+ const reads : string [ ] = [ ]
2806+ await page . route ( `**/api/organizations/${ ORGANIZATION_ID } /sim-links**` , ( route ) => {
2807+ reads . push ( route . request ( ) . url ( ) )
2808+ return route . fulfill ( { status : 500 , json : { error : 'The client must not need this' } } )
2809+ } )
2810+ await page . goto ( url ( `${ root } /links` ) )
2811+ await expect (
2812+ page . getByRole ( 'row' ) . filter ( { hasText : NAMED_LINKS . handbook . name } )
2813+ ) . toBeVisible ( )
2814+ await expect ( page . getByRole ( 'button' , { name : / R e t r y / } ) ) . toHaveCount ( 0 )
2815+ assert . deepEqual (
2816+ reads . filter ( ( address ) => ! address . includes ( 'cursor=' ) ) ,
2817+ [ ] ,
2818+ 'The seeded first page was fetched again'
2819+ )
2820+ await page . goto ( url ( `${ root } /links?sort=popular&dir=desc` ) )
2821+ await expect ( page . getByRole ( 'row' ) . nth ( 1 ) ) . toContainText ( NAMED_LINKS . mostUsed . name )
2822+ await page . goto ( url ( `${ root } /links?search=${ NAMED_LINKS . mostUsed . name } ` ) )
2823+ await expect ( page . getByRole ( 'row' ) . nth ( 1 ) ) . toContainText ( NAMED_LINKS . mostUsed . name )
2824+ assert . deepEqual (
2825+ reads . filter ( ( address ) => ! address . includes ( 'cursor=' ) ) ,
2826+ [ ] ,
2827+ 'A seeded view of the URL was fetched again'
2828+ )
2829+ } )
2830+ } ,
2831+ { allow : [ / s i m - l i n k s / ] }
2832+ )
2833+ await check ( 'the Links document already carries the first page of rows' , async ( ) => {
2834+ await withSession ( MEMBER , async ( { page, context } ) => {
2835+ await page . goto ( url ( `${ root } /home` ) )
2836+ const html = await ( await context . request . get ( url ( `${ root } /links` ) ) ) . text ( )
2837+ assert ( html . includes ( NAMED_LINKS . handbook . url ) , 'The document holds the seeded rows' )
2838+ } )
2839+ } )
27902840 for ( const persona of [ MEMBER , ADMIN ] ) {
27912841 for ( const entry of pages ) {
27922842 await check (
0 commit comments