-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Add an e2e test for the css serving issue #81683
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
Merged
+69
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
48d38c0
Add an e2e test for the css serving issue
lukesandberg 43fc323
adjust for the fact that this is failing
lukesandberg 861961a
adjust for failure
lukesandberg b68c3e5
Simplify the test
lukesandberg ff26be4
fix the env variable being queried
lukesandberg 088433d
typo
lukesandberg bcc20b2
reference issues
lukesandberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
test/e2e/app-dir/initial-css-not-found/app/(default)/layout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { ReactNode } from 'react' | ||
import styles from '../styles.module.css' | ||
|
||
export default function RootLayout({ children }: { children: ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<body className={styles.foo}>{children}</body> | ||
</html> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/initial-css-not-found/app/(default)/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { ReactNode } from 'react' | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return children | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import styles from './styles.module.css' | ||
|
||
/** | ||
* The mere existence of a not found page importing the same css as a layout used to prevent it from being served. | ||
* | ||
* See https://github.com/vercel/next.js/issues/77861 and https://github.com/vercel/next.js/issues/79535 | ||
*/ | ||
export default function NotFoundPage() { | ||
return ( | ||
<html lang="en"> | ||
<body className={styles.foo}> | ||
<main> | ||
<h1>Page not found</h1> | ||
</main> | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.foo { | ||
color: red; | ||
} |
24 changes: 24 additions & 0 deletions
24
test/e2e/app-dir/initial-css-not-found/initial-css-not-found.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('initial-css-not-found', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
// Regression test for a bug where the existence of a not-found page would prevent the css from being discovered. | ||
lukesandberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// See https://github.com/vercel/next.js/issues/77861 and https://github.com/vercel/next.js/issues/79535 | ||
it('should serve styles', async () => { | ||
const browser = await next.browser('/') | ||
|
||
expect( | ||
await browser.eval( | ||
`window.getComputedStyle(document.querySelector('body')).color` | ||
) | ||
).toBe( | ||
// This only fails in production turbopack builds | ||
process.env.IS_TURBOPACK_TEST && process.env.NEXT_TEST_MODE !== 'dev' | ||
? 'rgb(0, 0, 0)' | ||
: 'rgb(255, 0, 0)' | ||
) | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const nextConfig = {} | ||
|
||
module.exports = nextConfig |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.