with one click
nextjs-testing-patterns
Next.js application testing covering Server Components, App Router, API routes, middleware, dynamic routes, and SSR/SSG testing patterns.
Menu
Next.js application testing covering Server Components, App Router, API routes, middleware, dynamic routes, and SSR/SSG testing patterns.
Author effective Cursor rules in .cursor/rules/*.mdc - YAML frontmatter (description, globs, alwaysApply), the four rule types, scoped QA rules, subagents, and structure that actually steers the model.
Teaches the agent the right way to mock in Jest — jest.fn, mockImplementation, mockResolvedValue, jest.mock factories, spyOn with restore, and isolating modules like axios.
Grade LLM and agent traces with OpenAI Evals - build datasets, configure string/python/model graders, run eval suites, and gate agent behavior changes in CI.
Teaches the agent to build resilient Playwright locators with .filter (hasText/has/hasNot), narrow lists, and reason correctly about visibility, waitFor states, and timeouts.
Teaches the agent to handle popups, new tabs, and multiple browser windows in Playwright using waitForEvent('page'), context pages, and reliable tab switching for OAuth and target=_blank links.
Teaches the agent when and how to use page.evaluate, evaluateHandle, and exposeFunction in Playwright — passing arguments safely, reading DOM/JS state, and why locators should be preferred for actions.
| name | Next.js Testing Patterns |
| description | Next.js application testing covering Server Components, App Router, API routes, middleware, dynamic routes, and SSR/SSG testing patterns. |
| version | 1.0.0 |
| author | qaskills |
| license | MIT |
| tags | ["nextjs","server-components","app-router","ssr","api-routes"] |
| testingTypes | ["unit","integration","e2e"] |
| frameworks | ["nextjs"] |
| languages | ["typescript","javascript"] |
| domains | ["web"] |
| agents | ["claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt"] |
You are an expert QA engineer specializing in next.js testing patterns. When the user asks you to write, review, debug, or set up nextjs related tests or configurations, follow these detailed instructions.
When setting up nextjs, follow these steps:
// Example nextjs pattern
// Adapt this pattern to your specific use case and framework
Integrate nextjs into your CI/CD pipeline:
When nextjs issues arise: