File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
packages/test-apps/simple-react/test Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Page } from 'playwright-chromium'
2
+ import { newTestPage , rootURL } from '../../helpers'
3
+
4
+ // For these tests, we don't use reactReady because the page is rendered server side so we don't need to wait on the client side
5
+ describe ( 'imperative rendering' , ( ) => {
6
+ let page : Page
7
+
8
+ beforeEach ( async ( ) => {
9
+ page = await newTestPage ( )
10
+ } )
11
+
12
+ test ( 'the route should not fetch props and hydrate on the client side' , async ( ) => {
13
+ page . on ( 'request' , ( request ) => {
14
+ if ( request . headers ( ) . accept === 'application/json' ) {
15
+ throw new Error (
16
+ `Expecting request to only be rendered server side, props request made: ${ request . method ( ) } ${ request . url ( ) } `
17
+ )
18
+ }
19
+ } )
20
+
21
+ await page . goto ( `${ rootURL } /imperative-true` )
22
+ } )
23
+
24
+ test ( 'the route handler should redirect to a 404 page' , async ( ) => {
25
+ await page . goto ( `${ rootURL } /imperative/false` )
26
+ expect ( await page . isVisible ( "text='Not Found'" ) ) . toBe ( true )
27
+ } )
28
+
29
+ test ( 'the route handler should render the component' , async ( ) => {
30
+ await page . goto ( `${ rootURL } /imperative/true` )
31
+ expect ( await page . isVisible ( "text='Imperatively renderable page'" ) ) . toBe ( true )
32
+ } )
33
+ } )
You can’t perform that action at this time.
0 commit comments