@@ -98,11 +98,12 @@ test('can prefetch link on focus', async ({ page, browser }) => {
98
98
await page . goto ( 'prefetch/2' )
99
99
requests . listen ( page )
100
100
// If they just do a quick focus, it shouldn't make the request
101
- await page . getByRole ( 'link' , { exact : true , name : 'On Hover (Default)' } ) . focus ( )
102
- await page . getByRole ( 'link' , { exact : true , name : 'On Hover (Default)' } ) . blur ( )
101
+ const link = page . getByRole ( 'link' , { exact : true , name : 'On Hover (Default)' } )
102
+ await link . focus ( )
103
+ await link . blur ( )
103
104
expect ( requests . requests . length ) . toBe ( 0 )
104
105
105
- await page . getByRole ( ' link' , { exact : true , name : 'On Hover (Default)' } ) . focus ( )
106
+ await link . focus ( )
106
107
await page . waitForTimeout ( 80 )
107
108
expect ( requests . requests . length ) . toBe ( 1 )
108
109
await isPrefetchPage ( page , 2 )
@@ -126,8 +127,7 @@ test('can prefetch link on focus', async ({ page, browser }) => {
126
127
127
128
requests . listen ( page2 )
128
129
129
- const link = page2 . getByRole ( 'link' , { exact : true , name : 'On Hover (Default)' } )
130
- const box = await link . boundingBox ( )
130
+ const box = await page2 . getByRole ( 'link' , { exact : true , name : 'On Hover (Default)' } ) . boundingBox ( )
131
131
expect ( box ) . not . toBeNull ( )
132
132
page2 . touchscreen . tap ( box ! . x , box ! . y )
133
133
await page2 . waitForTimeout ( 75 )
0 commit comments