From 3118ade0fc8868a1dcac68cbfbc9c6cb60683192 Mon Sep 17 00:00:00 2001 From: hrmny Date: Fri, 15 Sep 2023 18:40:48 +0200 Subject: [PATCH 1/2] add test for turbopack refresh error --- test/development/app-dir/basic/app/layout.js | 7 ++++++ test/development/app-dir/basic/app/page.js | 3 +++ test/development/app-dir/basic/basic.test.ts | 26 ++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 test/development/app-dir/basic/app/layout.js create mode 100644 test/development/app-dir/basic/app/page.js create mode 100644 test/development/app-dir/basic/basic.test.ts diff --git a/test/development/app-dir/basic/app/layout.js b/test/development/app-dir/basic/app/layout.js new file mode 100644 index 0000000000000..a3a86a5ca1e12 --- /dev/null +++ b/test/development/app-dir/basic/app/layout.js @@ -0,0 +1,7 @@ +export default function Root({ children }) { + return ( + + {children} + + ) +} diff --git a/test/development/app-dir/basic/app/page.js b/test/development/app-dir/basic/app/page.js new file mode 100644 index 0000000000000..f6818ff77bd17 --- /dev/null +++ b/test/development/app-dir/basic/app/page.js @@ -0,0 +1,3 @@ +export default function Page() { + return

Page

+} diff --git a/test/development/app-dir/basic/basic.test.ts b/test/development/app-dir/basic/basic.test.ts new file mode 100644 index 0000000000000..545d0921792be --- /dev/null +++ b/test/development/app-dir/basic/basic.test.ts @@ -0,0 +1,26 @@ +import { nextTestSetup } from 'e2e-utils' +import { describeVariants as describe, waitFor } from 'next-test-utils' +import { sandbox, waitForHydration } from 'development-sandbox' + +describe.each(['default', 'turbo'])('basic app-dir tests', () => { + const { next } = nextTestSetup({ + files: __dirname, + }) + + it('should reload app pages without error', async () => { + const { session, cleanup, browser } = await sandbox(next, undefined, '/') + expect(await session.hasRedbox(false)).toBe(false) + + browser.refresh() + + await waitFor(750) + await waitForHydration(browser) + + for (let i = 0; i < 15; i++) { + expect(await session.hasRedbox(false)).toBe(false) + await waitFor(1000) + } + + await cleanup() + }) +}) From b11454c7438516d43c925b8c7911286bec8d9aa6 Mon Sep 17 00:00:00 2001 From: hrmny Date: Fri, 15 Sep 2023 18:50:58 +0200 Subject: [PATCH 2/2] enable test in CI --- test/turbopack-tests-manifest.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/turbopack-tests-manifest.js b/test/turbopack-tests-manifest.js index fc5e2db345c1a..ca222af3c84eb 100644 --- a/test/turbopack-tests-manifest.js +++ b/test/turbopack-tests-manifest.js @@ -5,6 +5,7 @@ const enabledTests = [ 'test/development/acceptance-app/server-components.test.ts', 'test/development/acceptance/hydration-error.test.ts', 'test/development/api-cors-with-rewrite/index.test.ts', + 'test/development/app-dir/basic/basic.test.ts', 'test/development/app-dir/multiple-compiles-single-route/multiple-compiles-single-route.test.ts', 'test/development/app-dir/strict-mode-enabled-by-default/strict-mode-enabled-by-default.test.ts', 'test/development/basic/define-class-fields.test.ts',