Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New example: Xstate and routes #19197

Closed
wants to merge 2 commits into from
Closed

Conversation

eliorivero
Copy link

This example shows how to trigger state changes on a Xstate machine when navigating to a different route by listening to the router events and trigger the state changes.

It also shows how to initialize the machine once and use React Context to get its state across different pages and components inside those pages.

…hanging routes and share the state across pages and components.
@ijjk ijjk added the examples Issue was opened via the examples template. label Nov 15, 2020
@ijjk
Copy link
Member

ijjk commented Nov 15, 2020

Failing test suites

Commit: e5b7e05

test/integration/dist-dir/test/index.test.js

  • distDir > should handle null/undefined distDir
  • distDir > With basic usage > should not build the app within the default .next directory
Expand output

● distDir › With basic usage › should not build the app within the default .next directory

expect(received).toBeFalsy()

Received: true

  40 |       expect(
  41 |         await fs.exists(join(__dirname, `/../.next/${BUILD_ID_FILE}`))
> 42 |       ).toBeFalsy()
     |         ^
  43 |     })
  44 |   })
  45 | 

  at Object.<anonymous> (integration/dist-dir/test/index.test.js:42:9)

● distDir › should handle null/undefined distDir

expect(received).toBe(expected) // Object.is equality

Expected: 0
Received: 189

  61 |     await fs.writeFile(nextConfig, origNextConfig)
  62 | 
> 63 |     expect(stderr.length).toBe(0)
     |                           ^
  64 |   })
  65 | })
  66 | 

  at Object.<anonymous> (integration/dist-dir/test/index.test.js:63:27)

test/integration/cli/test/index.test.js

  • CLI Usage > start > experimental react version
  • CLI Usage > start > experimental react-dom version
Expand output

● CLI Usage › start › experimental react version

expect(received).not.toMatch(expected)

Expected substring: not "outdated"
Received string:        "Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
"

  274 | 
  275 |       expect(stderr).not.toMatch('disabled')
> 276 |       expect(stderr).not.toMatch('outdated')
      |                          ^
  277 |       expect(stderr).not.toMatch(`react-dom`)
  278 | 
  279 |       await killApp(instance)

  at Object.<anonymous> (integration/cli/test/index.test.js:276:26)

● CLI Usage › start › experimental react-dom version

expect(received).not.toMatch(expected)

Expected substring: not "outdated"
Received string:        "Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
"

  292 | 
  293 |       expect(stderr).not.toMatch('disabled')
> 294 |       expect(stderr).not.toMatch('outdated')
      |                          ^
  295 |       expect(stderr).not.toMatch('`react`')
  296 | 
  297 |       await killApp(instance)

  at Object.<anonymous> (integration/cli/test/index.test.js:294:26)

test/integration/not-found-revalidate/test/index.test.js

  • SSG notFound revalidate > production mode > should revalidate after notFound is returned for fallback: blocking
Expand output

● SSG notFound revalidate › production mode › should revalidate after notFound is returned for fallback: blocking

expect(received).not.toBe(expected) // Object.is equality

Expected: not 0.7549274297115287

  64 |     expect(props2.params).toEqual({ slug: 'hello' })
  65 |     expect(isNaN(props2.random)).toBe(false)
> 66 |     expect(props2.random).not.toBe(props.random)
     |                               ^
  67 |   })
  68 | 
  69 |   it('should revalidate after notFound is returned for fallback: true', async () => {

  at Object.<anonymous> (integration/not-found-revalidate/test/index.test.js:66:31)

test/integration/re-export-all-exports-from-page-disallowed/test/index.test.js

  • Re-export all exports from page is disallowed > shows error when a page re-export all exports
Expand output

● Re-export all exports from page is disallowed › shows error when a page re-export all exports

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `Re-export all exports from page is disallowed shows error when a page re-export all exports 1`

- Snapshot  - 3
+ Received  + 3

- ./pages/contact.js:3:1
- Syntax error: Using `export * from '...'` in a page is disallowed. Please use `export { default } from '...'` instead.
- Read more: https://err.sh/next.js/export-all-in-page
+ Why you should do it regularly:
+ https://github.com/browserslist/browserslist#browsers-data-updating
+ Failed to compile.

  15 |     expect(stderr).toMatch(/https:\/\/err\.sh\/next\.js\/export-all-in-page/)
  16 | 
> 17 |     expect(stderr.split('\n\n')[1]).toMatchInlineSnapshot(`
     |                                     ^
  18 |       "./pages/contact.js:3:1
  19 |       Syntax error: Using \`export * from '...'\` in a page is disallowed. Please use \`export { default } from '...'\` instead.
  20 |       Read more: https://err.sh/next.js/export-all-in-page"

  at Object.<anonymous> (integration/re-export-all-exports-from-page-disallowed/test/index.test.js:17:37)

@ijjk
Copy link
Member

ijjk commented Nov 15, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
vercel/next.js canary eliorivero/next.js canary Change
buildDuration 13.9s 14.1s ⚠️ +190ms
nodeModulesSize 85 MB 85 MB
Page Load Tests Overall increase ✓
vercel/next.js canary eliorivero/next.js canary Change
/ failed reqs 0 0
/ total time (seconds) 2.593 2.596 0
/ avg req/sec 964.17 963 ⚠️ -1.17
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.381 1.34 -0.04
/error-in-render avg req/sec 1810.62 1865.37 +54.75
Client Bundles (main, webpack, commons)
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..d9fb.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-6b336ff..ab65.js gzip 6.53 kB 6.53 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..dule.js gzip 8.23 kB 8.23 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-878859a..dule.js gzip 5.64 kB 5.64 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary eliorivero/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary eliorivero/next.js canary Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB 3.44 kB
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d9a15a0..130a.js gzip 1.57 kB 1.57 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.98 kB 7.98 kB
Client Pages Modern
vercel/next.js canary eliorivero/next.js canary Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-973cce3..dule.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.6 kB 5.6 kB
Client Build Manifests
vercel/next.js canary eliorivero/next.js canary Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 651 B 651 B
Rendered Page Sizes
vercel/next.js canary eliorivero/next.js canary Change
index.html gzip 968 B 968 B
link.html gzip 975 B 975 B
withRouter.html gzip 962 B 962 B
Overall change 2.9 kB 2.9 kB

Serverless Mode
General
vercel/next.js canary eliorivero/next.js canary Change
buildDuration 16.2s 15.9s -293ms
nodeModulesSize 85 MB 85 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..d9fb.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-6b336ff..ab65.js gzip 6.53 kB 6.53 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..dule.js gzip 8.23 kB 8.23 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-878859a..dule.js gzip 5.64 kB 5.64 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary eliorivero/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary eliorivero/next.js canary Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB 3.44 kB
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d9a15a0..130a.js gzip 1.57 kB 1.57 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.98 kB 7.98 kB
Client Pages Modern
vercel/next.js canary eliorivero/next.js canary Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-973cce3..dule.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.6 kB 5.6 kB
Client Build Manifests
vercel/next.js canary eliorivero/next.js canary Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 651 B 651 B
Serverless bundles
vercel/next.js canary eliorivero/next.js canary Change
_error.js 918 kB 918 kB
404.html 4.61 kB 4.61 kB
hooks.html 3.86 kB 3.86 kB
index.js 918 kB 918 kB
link.js 976 kB 976 kB
routerDirect.js 969 kB 969 kB
withRouter.js 969 kB 969 kB
Overall change 4.76 MB 4.76 MB
Commit: e5b7e05

@ijjk
Copy link
Member

ijjk commented Nov 15, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
vercel/next.js canary eliorivero/next.js canary Change
buildDuration 12.4s 13.1s ⚠️ +693ms
nodeModulesSize 85 MB 85 MB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary eliorivero/next.js canary Change
/ failed reqs 0 0
/ total time (seconds) 2.343 2.471 ⚠️ +0.13
/ avg req/sec 1066.98 1011.86 ⚠️ -55.12
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.252 1.411 ⚠️ +0.16
/error-in-render avg req/sec 1997.32 1772.16 ⚠️ -225.16
Client Bundles (main, webpack, commons)
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..776c.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-95c0df2..6c91.js gzip 6.53 kB 6.53 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..dule.js gzip 8.26 kB 8.26 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-8ead8dd..dule.js gzip 5.64 kB 5.64 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary eliorivero/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary eliorivero/next.js canary Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB 3.44 kB
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d9a15a0..130a.js gzip 1.57 kB 1.57 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.98 kB 7.98 kB
Client Pages Modern
vercel/next.js canary eliorivero/next.js canary Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-973cce3..dule.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.6 kB 5.6 kB
Client Build Manifests
vercel/next.js canary eliorivero/next.js canary Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 651 B 651 B
Rendered Page Sizes
vercel/next.js canary eliorivero/next.js canary Change
index.html gzip 968 B 968 B
link.html gzip 974 B 974 B
withRouter.html gzip 961 B 961 B
Overall change 2.9 kB 2.9 kB

Serverless Mode
General
vercel/next.js canary eliorivero/next.js canary Change
buildDuration 14.8s 13.4s -1.5s
nodeModulesSize 85 MB 85 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..776c.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-95c0df2..6c91.js gzip 6.53 kB 6.53 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary eliorivero/next.js canary Change
677f882d2ed8..dule.js gzip 8.26 kB 8.26 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-8ead8dd..dule.js gzip 5.64 kB 5.64 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary eliorivero/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary eliorivero/next.js canary Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB 3.44 kB
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d9a15a0..130a.js gzip 1.57 kB 1.57 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.98 kB 7.98 kB
Client Pages Modern
vercel/next.js canary eliorivero/next.js canary Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-973cce3..dule.js gzip 1.51 kB 1.51 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.6 kB 5.6 kB
Client Build Manifests
vercel/next.js canary eliorivero/next.js canary Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 651 B 651 B
Serverless bundles
vercel/next.js canary eliorivero/next.js canary Change
_error.js 918 kB 918 kB
404.html 4.61 kB 4.61 kB
hooks.html 3.86 kB 3.86 kB
index.js 918 kB 918 kB
link.js 976 kB 976 kB
routerDirect.js 969 kB 969 kB
withRouter.js 969 kB 969 kB
Overall change 4.76 MB 4.76 MB
Commit: 6188e38

@ijjk
Copy link
Member

ijjk commented Dec 3, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
vercel/next.js canary niko20/next.js canary Change
buildDuration 8.6s 8.6s ⚠️ +20ms
nodeModulesSize 82.4 MB 82.4 MB
Page Load Tests Overall increase ✓
vercel/next.js canary niko20/next.js canary Change
/ failed reqs 0 0
/ total time (seconds) 1.74 1.695 -0.04
/ avg req/sec 1437.03 1475.12 +38.09
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.082 1.085 0
/error-in-render avg req/sec 2311.6 2304.72 ⚠️ -6.88
Client Bundles (main, webpack, commons)
vercel/next.js canary niko20/next.js canary Change
677f882d2ed8..8b6e.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-3c9ff84..1d7c.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary niko20/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary niko20/next.js canary Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-fca3d..2eb1.js gzip 3.44 kB 3.44 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 8.01 kB 8.01 kB
Client Build Manifests
vercel/next.js canary niko20/next.js canary Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Rendered Page Sizes
vercel/next.js canary niko20/next.js canary Change
index.html gzip 614 B 614 B
link.html gzip 620 B 620 B
withRouter.html gzip 608 B 608 B
Overall change 1.84 kB 1.84 kB

Serverless Mode
General
vercel/next.js canary niko20/next.js canary Change
buildDuration 9.9s 9.9s ⚠️ +72ms
nodeModulesSize 82.4 MB 82.4 MB
Client Bundles (main, webpack, commons)
vercel/next.js canary niko20/next.js canary Change
677f882d2ed8..8b6e.js gzip 12.8 kB 12.8 kB
framework.HASH.js gzip 39 kB 39 kB
main-3c9ff84..1d7c.js gzip 6.56 kB 6.56 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 59 kB 59 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary niko20/next.js canary Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary niko20/next.js canary Change
_app-7231d4b..5856.js gzip 1.28 kB 1.28 kB
_error-fca3d..2eb1.js gzip 3.44 kB 3.44 kB
hooks-d4591d..e7c2.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-db223d9..dbd7.js gzip 1.61 kB 1.61 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 8.01 kB 8.01 kB
Client Build Manifests
vercel/next.js canary niko20/next.js canary Change
_buildManifest.js gzip 321 B 321 B
Overall change 321 B 321 B
Serverless bundles
vercel/next.js canary niko20/next.js canary Change
_error.js 997 kB 997 kB
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 998 kB 998 kB
link.js 1.05 MB 1.05 MB
routerDirect.js 1.04 MB 1.04 MB
withRouter.js 1.04 MB 1.04 MB
Overall change 5.14 MB 5.14 MB
Commit: 0a9ae61

@ijjk
Copy link
Member

ijjk commented Dec 28, 2020

Failing test suites

Commit: f02bf21

test/integration/i18n-support/test/index.test.js

  • i18n Support > serverless mode > should navigate through history with query correctly
Expand output

● i18n Support › serverless mode › should navigate through history with query correctly

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  28 | 
  29 | export function runTests(ctx) {
> 30 |   it('should navigate through history with query correctly', async () => {
     |   ^
  31 |     const browser = await webdriver(ctx.appPort, `${ctx.basePath || '/'}`)
  32 | 
  33 |     await browser.eval(`(function() {

  at runTests (integration/i18n-support/test/shared.js:30:3)
  at integration/i18n-support/test/index.test.js:192:5
  at integration/i18n-support/test/index.test.js:79:3
  at Object.<anonymous> (integration/i18n-support/test/index.test.js:26:1)

@ijjk
Copy link
Member

ijjk commented Dec 28, 2020

Failing test suites

Commit: 47433b6

test/integration/i18n-support/test/index.test.js

  • i18n Support > serverless mode > should navigate through history with query correctly
Expand output

● i18n Support › serverless mode › should navigate through history with query correctly

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  28 | 
  29 | export function runTests(ctx) {
> 30 |   it('should navigate through history with query correctly', async () => {
     |   ^
  31 |     const browser = await webdriver(ctx.appPort, `${ctx.basePath || '/'}`)
  32 | 
  33 |     await browser.eval(`(function() {

  at runTests (integration/i18n-support/test/shared.js:30:3)
  at integration/i18n-support/test/index.test.js:192:5
  at integration/i18n-support/test/index.test.js:79:3
  at Object.<anonymous> (integration/i18n-support/test/index.test.js:26:1)

@ijjk
Copy link
Member

ijjk commented Dec 28, 2020

Failing test suites

Commit: 9553b6d

test/integration/i18n-support-base-path/test/index.test.js

  • i18n Support basePath > serverless mode > should navigate through history with query correctly
Expand output

● i18n Support basePath › serverless mode › should navigate through history with query correctly

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  28 | 
  29 | export function runTests(ctx) {
> 30 |   it('should navigate through history with query correctly', async () => {
     |   ^
  31 |     const browser = await webdriver(ctx.appPort, `${ctx.basePath || '/'}`)
  32 | 
  33 |     await browser.eval(`(function() {

  at runTests (integration/i18n-support/test/shared.js:30:3)
  at integration/i18n-support-base-path/test/index.test.js:191:5
  at integration/i18n-support-base-path/test/index.test.js:77:3
  at Object.<anonymous> (integration/i18n-support-base-path/test/index.test.js:24:1)

@ijjk ijjk mentioned this pull request Dec 28, 2020
@ijjk
Copy link
Member

ijjk commented Dec 28, 2020

Failing test suites

Commit: 1203b90

test/integration/i18n-support/test/index.test.js

  • i18n Support > serverless mode > should navigate through history with query correctly
Expand output

● i18n Support › serverless mode › should navigate through history with query correctly

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  28 | 
  29 | export function runTests(ctx) {
> 30 |   it('should navigate through history with query correctly', async () => {
     |   ^
  31 |     const browser = await webdriver(ctx.appPort, `${ctx.basePath || '/'}`)
  32 | 
  33 |     await browser.eval(`(function() {

  at runTests (integration/i18n-support/test/shared.js:30:3)
  at integration/i18n-support/test/index.test.js:192:5
  at integration/i18n-support/test/index.test.js:79:3
  at Object.<anonymous> (integration/i18n-support/test/index.test.js:26:1)

test/integration/i18n-support-base-path/test/index.test.js

  • i18n Support basePath > production mode > should navigate through history with query correctly
  • i18n Support basePath > serverless mode > should navigate through history with query correctly
Expand output

● i18n Support basePath › production mode › should navigate through history with query correctly

thrown: "Exceeded timeout of 120000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

  28 | 
  29 | export function runTests(ctx) {
> 30 |   it('should navigate through history with query correctly', async () => {
     |   ^
  31 |     const browser = await webdriver(ctx.appPort, `${ctx.basePath || '/'}`)
  32 | 
  33 |     await browser.eval(`(function() {

  at runTests (integration/i18n-support/test/shared.js:30:3)
  at integration/i18n-support-base-path/test/index.test.js:74:5
  at integration/i18n-support-base-path/test/index.test.js:58:3
  at Object.<anonymous> (integration/i18n-support-base-path/test/index.test.js:24:1)

● i18n Support basePath › serverless mode › should navigate through history with query correctly

expect(received).toEqual(expected) // deep equality

- Expected  - 3
+ Received  + 0

@@ -8,9 +8,6 @@
      "nl",
      "fr-BE",
      "fr",
      "en",
    ],
-   "query": Object {
-     "page": "1",
-   },
  }

  46 | 
  47 |     const props = JSON.parse(await browser.elementByCss('#props').text())
> 48 |     expect(props).toEqual({
     |                   ^
  49 |       locale: 'nl',
  50 |       locales,
  51 |       defaultLocale: 'en-US',

  at Object.<anonymous> (integration/i18n-support/test/shared.js:48:19)
      at runMicrotasks (<anonymous>)

kodiakhq bot pushed a commit that referenced this pull request Dec 28, 2020
This tweaks the new i18n query history test to address intermittent failures in CI

x-ref: #19197 (comment)
x-ref: #19135 (comment)
x-ref: #20379 (comment)
Copy link
Member

@lfades lfades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eliorivero Hi there 👋 thank you for the PR and sorry for the late review 🙏

Let's update the current with-xstate example to have a shared machine and multiple routes instead of adding a new one, that way we can avoid duplication and having one example that's better than the other.

@ijjk
Copy link
Member

ijjk commented Jan 1, 2021

Failing test suites

Commit: 2c75fa0

test/integration/basepath/test/index.test.js

  • basePath production > should allow URL query strings on index without refresh
Expand output

● basePath production › should allow URL query strings on index without refresh

JavascriptError: javascript error: document unloaded while waiting for result
  (Session info: headless chrome=87.0.4280.88)

  185 | 
  186 |     const checkHydrated = async () => {
> 187 |       await browser.executeAsyncScript(function () {
      |       ^
  188 |         var callback = arguments[arguments.length - 1]
  189 | 
  190 |         // if it's not a Next.js app return

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
      at runMicrotasks (<anonymous>)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at checkHydrated (lib/next-webdriver.js:187:7)
  at _default (lib/next-webdriver.js:210:7)
  at Object.<anonymous> (integration/basepath/test/index.test.js:1033:21)

@ijjk
Copy link
Member

ijjk commented Jan 4, 2021

Failing test suites

Commit: 54cc9fc

test/integration/preload-viewport/test/index.test.js

  • Prefetching Links in viewport > should not have unhandledRejection when failing to prefetch on link
Expand output

● Prefetching Links in viewport › should not have unhandledRejection when failing to prefetch on link

NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"#invalid-link"}
  (Session info: headless chrome=87.0.4280.88)

  256 |     expect(await browser.eval('window.hadUnhandledReject')).toBeFalsy()
  257 | 
> 258 |     await browser.elementByCss('#invalid-link').moveTo()
      |     ^
  259 |     expect(await browser.eval('window.hadUnhandledReject')).toBeFalsy()
  260 |   })
  261 | 

  at Object.throwDecodedError (../node_modules/selenium-webdriver/lib/error.js:550:15)
  at parseHttpResponse (../node_modules/selenium-webdriver/lib/http.js:565:13)
  at Executor.execute (../node_modules/selenium-webdriver/lib/http.js:491:26)
  at thenableWebDriverProxy.execute (../node_modules/selenium-webdriver/lib/webdriver.js:700:17)
  at Object.<anonymous> (integration/preload-viewport/test/index.test.js:258:5)

Copy link
Member

@timneutkens timneutkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally clicked approve. I'm going to close this PR as the proposed changes were not made and the PR is stale.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants