-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Page Router with Next 14 and 'use client' does not work with cypress 12.3.0 #58061
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
Comments
← Go Back</Link>
</p>
</main>
</div>
)
}">
In ← Go Back</Link>
</p>
</main>
</div>
)
}">
|
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you. |
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding! |
Link to the code that reproduces this issue
https://github.com/eduardo-villasboas/with-cypress-app
I am getting the error when running next with cypress.
To Reproduce
There are two manners to reproduces the error
Using https://www.npmjs.com/package/start-server-and-test
npm run e2e:headless
this command will start next in dev mode and run e2e tests using https://www.npmjs.com/package/start-server-and-testRunning next server manually
rm .next -rf
rm node_modules/ -rf
npm install
npm run build
npm run dev
npx cypress run --e2e
***Note that the errors don't happen always and in the second approach, running manually I got the error in the first executions after deleting the paths .next and node_modules/. In the repo https://github.com/eduardo-villasboas/with-cypress-app, I create two branches next-14-with-app-routing-error-tests and next-14-with-pages-routing-sucess-tests, because I have discovered this error occurs only when using the new nextjs routing system and accessing an component using 'use client' ***
Current vs. Expected behavior
Test app.cy.ts should pass
But I getting the following error. I am attaching a video that the own cypress have recorded.
app.cy.ts.mp4
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 Binaries: Node: 20.9.0 npm: 10.1.0 Yarn: N/A pnpm: N/A Relevant Packages: next: 14.0.2-canary.12 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router
Additional context
I see that this issue only occurs when using the app router and it happened because webpack.js sometimes doesn't finish its execution until the test access the function webpack_require.n.
I am not sure if this is a Nextjs issue or Cypress issue, but it works with the same version using the page router, therefore I am opening this issue.
The text was updated successfully, but these errors were encountered: