diff --git a/test/e2e/app-dir/app/app/old-router/IsNull.js b/test/e2e/app-dir/app/app/old-router/IsNull.js
new file mode 100644
index 000000000000000..3876fbe873654bb
--- /dev/null
+++ b/test/e2e/app-dir/app/app/old-router/IsNull.js
@@ -0,0 +1,7 @@
+export default function IsNull({ value }) {
+ if (value === null) {
+ return
Value Was Null
+ }
+
+ return Value Was Not Null
+}
diff --git a/test/e2e/app-dir/app/app/old-router/Router.client.js b/test/e2e/app-dir/app/app/old-router/Router.client.js
new file mode 100644
index 000000000000000..aaec667cb52d575
--- /dev/null
+++ b/test/e2e/app-dir/app/app/old-router/Router.client.js
@@ -0,0 +1,15 @@
+import { useRouter, withRouter } from 'next/router'
+import IsNull from './IsNull'
+
+function ClientRouter({ router: withRouter }) {
+ const router = useRouter()
+
+ return (
+ <>
+
+
+ >
+ )
+}
+
+export default withRouter(ClientRouter)
diff --git a/test/e2e/app-dir/app/app/old-router/Router.js b/test/e2e/app-dir/app/app/old-router/Router.js
new file mode 100644
index 000000000000000..930b9ddac284c44
--- /dev/null
+++ b/test/e2e/app-dir/app/app/old-router/Router.js
@@ -0,0 +1,19 @@
+import { useRouter, withRouter } from 'next/router'
+import IsNull from './IsNull'
+import ServerRouter from './Router.server'
+import ClientRouter from './Router.client'
+
+function SharedRouter({ router: withRouter }) {
+ const router = useRouter()
+
+ return (
+ <>
+
+
+
+
+ >
+ )
+}
+
+export default withRouter(SharedRouter)
diff --git a/test/e2e/app-dir/app/app/old-router/Router.server.js b/test/e2e/app-dir/app/app/old-router/Router.server.js
new file mode 100644
index 000000000000000..ca08c6668f252ba
--- /dev/null
+++ b/test/e2e/app-dir/app/app/old-router/Router.server.js
@@ -0,0 +1,15 @@
+import { useRouter, withRouter } from 'next/router'
+import IsNull from './IsNull'
+
+function ServerRouter({ router: withRouter }) {
+ const router = useRouter()
+
+ return (
+ <>
+
+
+ >
+ )
+}
+
+export default withRouter(ServerRouter)
diff --git a/test/e2e/app-dir/app/app/old-router/page.server.js b/test/e2e/app-dir/app/app/old-router/page.server.js
new file mode 100644
index 000000000000000..d74b7650d38c6bd
--- /dev/null
+++ b/test/e2e/app-dir/app/app/old-router/page.server.js
@@ -0,0 +1,9 @@
+import Router from './Router'
+
+export default function Page() {
+ return (
+
+
+
+ )
+}
diff --git a/test/e2e/app-dir/index.test.ts b/test/e2e/app-dir/index.test.ts
index e9984ce8fa0ff74..920a8800bd84bda 100644
--- a/test/e2e/app-dir/index.test.ts
+++ b/test/e2e/app-dir/index.test.ts
@@ -720,6 +720,24 @@ describe('app dir', () => {
})
})
+ describe('next/router', () => {
+ it('should always return null when accessed from /app', async () => {
+ const browser = await webdriver(next.url, '/old-router')
+
+ try {
+ await browser.waitForElementByCss('#old-router')
+
+ const notNull = await browser.elementsByCss('.was-not-null')
+ expect(notNull.length).toBe(0)
+
+ const wasNull = await browser.elementsByCss('.was-null')
+ expect(wasNull.length).toBe(6)
+ } finally {
+ await browser.close()
+ }
+ })
+ })
+
describe('hooks', () => {
describe('useCookies', () => {
it('should retrive cookies in a server component', async () => {