Replies: 5 comments 1 reply
-
I'm starting to work on e2e in cypress our SSG nextjs site, and it seems that for now we have a lot work on our side to be able to do it:
If the In a more general note, it could also be interesting to have a guide in the documentation that explain how to do e2e testing of a SSG application. The SSG part of the stack make the orchestration of test process more hard |
Beta Was this translation helpful? Give feedback.
-
We've integrated automated E2E testing using Cypress and GitHub Actions on NRN. You can see it working in our PR - See E2E failure and it provides with Artifacts (video/screenshots) for easier debug Our GitHub Actions config can be found here: @Spy-Seth Also, it uses different stages (production/staging) so the whole env is duplicated and E2E can be tested on a completely separated env (no impact on prod env). The current E2E implementation also tests the production, but that can be skipped if E2E mocking production would be complex, like it seems to be your case)
|
Beta Was this translation helpful? Give feedback.
-
For my current (monorepo) project I created a standalone package import { nextApp, cli, browser, utils } from 'next-test-utils';
// starting/stopping a next app via cli
cli.runNextDev(...);
cli.runNextStart(...);
cli.killApp(...);
// starting/stopping via next app (const app = Next({ dev: false }))
nextApp.start(nextJsApp);
nextApp.stop(nextJsApp);
// low-level fetch + cheerio wrapper
browser.get(...);
browser.html(...);
browser.html$(...);
utils.getFreePort(); If have also some more features in mind. Like adding puppeteer. @timneutkens @Timer I'am open to share ❤️ |
Beta Was this translation helpful? Give feedback.
-
Related #10967 |
Beta Was this translation helpful? Give feedback.
-
I miss some tools to test all Something like this will be very useful: const page = new PageTest(nextConfig)
page('/example/bah').toBeStatus(404)
page('/example/redirect').toBeStatus(308).to('/example-redirect')
page('/example/rewrites').toBeStatus(200).to('/another-destination') I think this could even be done without compiling with webpack nor raising any server, just by analyzing the |
Beta Was this translation helpful? Give feedback.
-
Hey everyone. I wonder if someone else feels the need for the
next-test-utils
package. Like the nextjs team we also write lots of integration tests besides basic unit tests. I find it very hard writing the test setup to start nextjs in prod mode. Luckily the nextjs team has this internal lib for their own integration tests.Testing use cases:
Beta Was this translation helpful? Give feedback.
All reactions