@@ -551,7 +551,7 @@ describe('Prerender', () => {
551
551
} )
552
552
}
553
553
554
- const runTests = ( isDev = false , isDeploy ) => {
554
+ const runTests = ( isDev : boolean = false , isDeploy : boolean ) => {
555
555
navigateTest ( isDev )
556
556
557
557
it ( 'should respond with 405 for POST to static page' , async ( ) => {
@@ -926,33 +926,45 @@ describe('Prerender', () => {
926
926
const text = await browser . elementByCss ( 'p' ) . text ( )
927
927
expect ( text ) . toContain ( 'hi fallback' )
928
928
929
- // wait for fallback data to load
930
- await check ( ( ) => browser . elementByCss ( 'p' ) . text ( ) , / P o s t / )
929
+ if ( isDeploy ) {
930
+ // patchFile does not work with deploy tests
931
+ return
932
+ }
933
+
934
+ await next . patchFile ( 'resolve-static-props' , '' , async ( ) => {
935
+ // wait for fallback data to load
936
+ await check ( ( ) => browser . elementByCss ( 'p' ) . text ( ) , / P o s t / )
931
937
932
- // check fallback data
933
- const post = await browser . elementByCss ( 'p' ) . text ( )
934
- const query = JSON . parse ( await browser . elementByCss ( '#query' ) . text ( ) )
935
- const params = JSON . parse ( await browser . elementByCss ( '#params' ) . text ( ) )
938
+ // check fallback data
939
+ const post = await browser . elementByCss ( 'p' ) . text ( )
940
+ const query = JSON . parse ( await browser . elementByCss ( '#query' ) . text ( ) )
941
+ const params = JSON . parse ( await browser . elementByCss ( '#params' ) . text ( ) )
936
942
937
- expect ( post ) . toContain ( 'first/post' )
938
- expect ( params ) . toEqual ( {
939
- slug : 'first/post' ,
943
+ expect ( post ) . toContain ( 'first/post' )
944
+ expect ( params ) . toEqual ( {
945
+ slug : 'first/post' ,
946
+ } )
947
+ expect ( query ) . toEqual ( params )
940
948
} )
941
- expect ( query ) . toEqual ( params )
942
949
} )
943
950
944
- it ( 'should handle fallback only page correctly data' , async ( ) => {
945
- const data = JSON . parse (
946
- await renderViaHTTP (
947
- next . url ,
948
- `/_next/data/${ next . buildId } /fallback-only/second%2Fpost.json`
949
- )
950
- )
951
+ // patchFile does not work with deploy tests
952
+ if ( ! isDeploy ) {
953
+ it ( 'should handle fallback only page correctly data' , async ( ) => {
954
+ await next . patchFile ( 'resolve-static-props' , '' , async ( ) => {
955
+ const data = JSON . parse (
956
+ await renderViaHTTP (
957
+ next . url ,
958
+ `/_next/data/${ next . buildId } /fallback-only/second%2Fpost.json`
959
+ )
960
+ )
951
961
952
- expect ( data . pageProps . params ) . toEqual ( {
953
- slug : 'second/post' ,
962
+ expect ( data . pageProps . params ) . toEqual ( {
963
+ slug : 'second/post' ,
964
+ } )
965
+ } )
954
966
} )
955
- } )
967
+ }
956
968
957
969
it ( 'should 404 for a missing catchall explicit route' , async ( ) => {
958
970
const res = await fetchViaHTTP (
0 commit comments