diff --git a/test/e2e/app-dir/app-basepath/app/use-pathname-another/page.js b/test/e2e/app-dir/app-basepath/app/use-pathname-another/page.js
new file mode 100644
index 0000000000000..b00dccbaf1690
--- /dev/null
+++ b/test/e2e/app-dir/app-basepath/app/use-pathname-another/page.js
@@ -0,0 +1,3 @@
+'use client'
+
+export { ReadPathName as default } from '../../components/read-path-name'
diff --git a/test/e2e/app-dir/app-basepath/app/use-pathname/page.js b/test/e2e/app-dir/app-basepath/app/use-pathname/page.js
new file mode 100644
index 0000000000000..b00dccbaf1690
--- /dev/null
+++ b/test/e2e/app-dir/app-basepath/app/use-pathname/page.js
@@ -0,0 +1,3 @@
+'use client'
+
+export { ReadPathName as default } from '../../components/read-path-name'
diff --git a/test/e2e/app-dir/base-path/components/page.jsx b/test/e2e/app-dir/app-basepath/components/read-path-name.js
similarity index 84%
rename from test/e2e/app-dir/base-path/components/page.jsx
rename to test/e2e/app-dir/app-basepath/components/read-path-name.js
index bb5accad6d599..1f1c047673f26 100644
--- a/test/e2e/app-dir/base-path/components/page.jsx
+++ b/test/e2e/app-dir/app-basepath/components/read-path-name.js
@@ -1,6 +1,6 @@
import { usePathname } from 'next/navigation'
-export function Page() {
+export function ReadPathName() {
const pathname = usePathname()
return (
diff --git a/test/e2e/app-dir/app-basepath/index.test.ts b/test/e2e/app-dir/app-basepath/index.test.ts
index e4b885d467d0c..d40887c8caca6 100644
--- a/test/e2e/app-dir/app-basepath/index.test.ts
+++ b/test/e2e/app-dir/app-basepath/index.test.ts
@@ -2,13 +2,11 @@ import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'
createNextDescribe(
- 'app dir basepath',
+ 'app dir - basepath',
{
files: __dirname,
skipDeployment: true,
dependencies: {
- react: 'latest',
- 'react-dom': 'latest',
sass: 'latest',
},
},
@@ -43,5 +41,14 @@ createNextDescribe(
return 'success'
}, 'success')
})
+
+ it('should render usePathname without the basePath', async () => {
+ const pathnames = ['/use-pathname', '/use-pathname-another']
+ const validatorPromises = pathnames.map(async (pathname) => {
+ const $ = await next.render$('/base' + pathname)
+ expect($('#pathname').data('pathname')).toBe(pathname)
+ })
+ await Promise.all(validatorPromises)
+ })
}
)
diff --git a/test/e2e/app-dir/base-path/app/dashboard/page.jsx b/test/e2e/app-dir/base-path/app/dashboard/page.jsx
deleted file mode 100644
index 464d4a56e759c..0000000000000
--- a/test/e2e/app-dir/base-path/app/dashboard/page.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-'use client'
-
-export { Page as default } from '../../components/page'
diff --git a/test/e2e/app-dir/base-path/app/layout.jsx b/test/e2e/app-dir/base-path/app/layout.jsx
deleted file mode 100644
index f3791f288f9d7..0000000000000
--- a/test/e2e/app-dir/base-path/app/layout.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-export default function Layout({ children }) {
- return (
-
-
- {children}
-
- )
-}
diff --git a/test/e2e/app-dir/base-path/app/page.jsx b/test/e2e/app-dir/base-path/app/page.jsx
deleted file mode 100644
index 3f6f7a1ba710a..0000000000000
--- a/test/e2e/app-dir/base-path/app/page.jsx
+++ /dev/null
@@ -1,3 +0,0 @@
-'use client'
-
-export { Page as default } from '../components/page'
diff --git a/test/e2e/app-dir/base-path/index.test.ts b/test/e2e/app-dir/base-path/index.test.ts
deleted file mode 100644
index 362d95a9d3b7b..0000000000000
--- a/test/e2e/app-dir/base-path/index.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { createNextDescribe } from 'e2e-utils'
-
-import { basePath } from './next.config'
-
-createNextDescribe(
- 'base path support for usePathname',
- {
- files: __dirname,
- },
- ({ next }) => {
- it.each(['/', '/dashboard'])(
- 'should render %s without the basePath',
- async (pathname) => {
- const $ = await next.render$(basePath + pathname)
- expect($('#pathname').data('pathname')).toBe(pathname)
- }
- )
- }
-)
diff --git a/test/e2e/app-dir/base-path/next.config.js b/test/e2e/app-dir/base-path/next.config.js
deleted file mode 100644
index ee95502b605d3..0000000000000
--- a/test/e2e/app-dir/base-path/next.config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- basePath: '/docs',
-}