3
3
import { join } from 'path'
4
4
import webdriver from 'next-webdriver'
5
5
import { createNext , FileRef } from 'e2e-utils'
6
- import {
7
- assertHasRedbox ,
8
- assertNoRedbox ,
9
- check ,
10
- getRedboxHeader ,
11
- } from 'next-test-utils'
6
+ import { assertNoRedbox , check } from 'next-test-utils'
12
7
import { NextInstance } from 'e2e-utils'
13
8
14
9
const installCheckVisible = ( browser ) => {
@@ -276,10 +271,22 @@ describe('GS(S)P Server-Side Change Reloading', () => {
276
271
277
272
try {
278
273
await next . patchFile ( page , originalContent . replace ( 'props:' , 'propss:' ) )
279
- await assertHasRedbox ( browser )
280
- expect ( await getRedboxHeader ( browser ) ) . toContain (
281
- 'Additional keys were returned from'
282
- )
274
+
275
+ await expect ( browser ) . toDisplayRedbox ( `
276
+ {
277
+ "count": 1,
278
+ "description": "Error: Additional keys were returned from \`getStaticProps\`. Properties intended for your component must be nested under the \`props\` key, e.g.:
279
+
280
+ return { props: { title: 'My Title', content: '...' } }
281
+
282
+ Keys that need to be moved: propss.
283
+ Read more: https://nextjs.org/docs/messages/invalid-getstaticprops-value",
284
+ "environmentLabel": null,
285
+ "label": "Runtime Error",
286
+ "source": null,
287
+ "stack": [],
288
+ }
289
+ ` )
283
290
284
291
await next . patchFile ( page , originalContent )
285
292
await assertNoRedbox ( browser )
@@ -306,8 +313,22 @@ describe('GS(S)P Server-Side Change Reloading', () => {
306
313
'throw new Error("custom oops"); const count'
307
314
)
308
315
)
309
- await assertHasRedbox ( browser )
310
- expect ( await getRedboxHeader ( browser ) ) . toContain ( 'custom oops' )
316
+
317
+ await expect ( browser ) . toDisplayRedbox ( `
318
+ {
319
+ "count": 1,
320
+ "description": "Error: custom oops",
321
+ "environmentLabel": null,
322
+ "label": "Runtime Error",
323
+ "source": "pages/index.js (18:9) @ getStaticProps
324
+ > 18 | throw new Error("custom oops"); const count = 1
325
+ | ^",
326
+ "stack": [
327
+ "getStaticProps pages/index.js (18:9)",
328
+ ],
329
+ }
330
+ ` )
331
+ expect ( next . cliOutput ) . toMatch ( / c u s t o m o o p s / )
311
332
312
333
await next . patchFile ( page , originalContent )
313
334
await assertNoRedbox ( browser )
0 commit comments