File tree 1 file changed +27
-0
lines changed
test/e2e/specs/interactivity
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -258,4 +258,31 @@ test.describe( 'Router styles', () => {
258
258
await expect ( csn ) . toBeVisible ( ) ;
259
259
await expect ( orderChecker ) . toHaveCSS ( 'color' , COLOR_GREEN ) ;
260
260
} ) ;
261
+
262
+ test ( 'should refresh the page when stylesheet loading fails' , async ( {
263
+ page,
264
+ } ) => {
265
+ const csn = page . getByTestId ( 'client-side navigation' ) ;
266
+ const red = page . getByTestId ( 'red-from-link' ) ;
267
+ const redBlock = page . getByTestId ( 'red-block' ) ;
268
+
269
+ await expect ( red ) . toHaveCSS ( 'color' , COLOR_WRAPPER ) ;
270
+ await expect ( redBlock ) . toBeHidden ( ) ;
271
+
272
+ // Setup a route handler to make requests to the red stylesheet fail.
273
+ // The route handler is removed after navigation to simulate a
274
+ // temporary error.
275
+ const linkPattern = '**/router-styles-red/style-from-link.css*' ;
276
+ await page . route ( linkPattern , async ( route ) => {
277
+ await page . unroute ( linkPattern ) ;
278
+ return route . abort ( 'failed' ) ;
279
+ } ) ;
280
+
281
+ // Navigate to the page with the Red block
282
+ await page . getByTestId ( 'link red' ) . click ( ) ;
283
+
284
+ await expect ( csn ) . toBeHidden ( ) ;
285
+ await expect ( red ) . toHaveCSS ( 'color' , COLOR_RED ) ;
286
+ await expect ( redBlock ) . toBeVisible ( ) ;
287
+ } ) ;
261
288
} ) ;
You can’t perform that action at this time.
0 commit comments