Senior QA Engineer
Test automation, coverage analysis, and QA patterns for React/Next.js.
Three workflows
1. Unit test generation (Jest + React Testing Library)
- Scan for untested components.
- Generate test stubs — describe blocks, render tests, interaction tests.
- Review/customize. Each component gets: a render-with-props test + an interaction (
fireEvent / userEvent) test + accessibility queries.
- Run with coverage:
npm test -- --coverage.
Stub shape:
describe('Button', () => {
it('renders with label', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument();
});
it('calls onClick when clicked', () => {
const handleClick = jest.fn();
render(<Button
fireEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
});
2. Coverage analysis
- Generate report:
npm test -- --coverage --coverageReporters=json.
- Parse Istanbul/LCOV → identify uncovered branches and critical paths.
- Enforce threshold (exit non-zero below target). Set in
jest.config.js:
coverageThreshold: { global: { branches: 80, functions: 80, lines: 80, statements: 80 } }
- Generate stubs for uncovered code, re-run, compare against previous.
3. E2E setup (Playwright)
npm init playwright@latest.
- Scaffold tests from Next.js routes (one file per route, common interactions).
- Configure auth fixtures (login once, reuse authenticated page).
- Run:
npx playwright test; report: npx playwright show-report.
- Add to CI (run tests + upload
playwright-report/ artifact).
Key patterns
RTL queries (prefer accessible): getByRole('button', { name: /submit/i }), getByLabelText(/email/i); fall back to getByTestId.
Async: await screen.findByText(...), waitForElementToBeRemoved(...), waitFor(() => expect(mockFn).toHaveBeenCalled()).
MSW mocking:
const server = setupServer(rest.get('/api/users', (_, res, ctx) => res(ctx.json([{ id: 1 }]))));
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
Playwright locators: page.getByRole('button', { name: 'submit' }), chain with .filter({ hasText: 'Product' }).
Strategy: test pyramid — many unit, fewer integration, fewest E2E. Target 80% coverage on critical paths; don't chase 100%. Stabilize flaky tests by removing arbitrary waits and using web-first assertions.
1---2name: senior-qa-engineer3description: Use when you need to generate tests, analyze coverage, or set up E2E testing for React/Next.js apps — scaffolds Jest + RTL unit tests, Playwright E2E, MSW mocks, and reads Istanbul/LCOV coverage to surface gaps.4tags: [testing, jest, playwright, react-testing-library, coverage, e2e, msw, qa, nextjs]5source: alirezarezvani/claude-skills6derived_from: engineering-team/skills/senior-qa7metadata:8 source: https://skillmd.com/skills/aashutosh396/senior-qa-engineer9---1011# Senior QA Engineer1213Test automation, coverage analysis, and QA patterns for React/Next.js.1415## Three workflows1617### 1. Unit test generation (Jest + React Testing Library)181. Scan for untested components.192. Generate test stubs — describe blocks, render tests, interaction tests.203. Review/customize. Each component gets: a render-with-props test + an interaction (`fireEvent` / `userEvent`) test + accessibility queries.214. Run with coverage: `npm test -- --coverage`.2223Stub shape:24```tsx25describe('Button', () => {26 it('renders with label', () => {27 render(<Button>Click me</Button>);28 expect(screen.getByRole('button', { name: /click me/i })).toBeInTheDocument();29 });30 it('calls onClick when clicked', () => {31 const handleClick = jest.fn();32 render(<Button onClick={handleClick}>Click</Button>);33 fireEvent.click(screen.getByRole('button'));34 expect(handleClick).toHaveBeenCalledTimes(1);35 });36});37```3839### 2. Coverage analysis401. Generate report: `npm test -- --coverage --coverageReporters=json`.412. Parse Istanbul/LCOV → identify uncovered branches and critical paths.423. Enforce threshold (exit non-zero below target). Set in `jest.config.js`:43```js44coverageThreshold: { global: { branches: 80, functions: 80, lines: 80, statements: 80 } }45```464. Generate stubs for uncovered code, re-run, compare against previous.4748### 3. E2E setup (Playwright)491. `npm init playwright@latest`.502. Scaffold tests from Next.js routes (one file per route, common interactions).513. Configure auth fixtures (login once, reuse authenticated page).524. Run: `npx playwright test`; report: `npx playwright show-report`.535. Add to CI (run tests + upload `playwright-report/` artifact).5455## Key patterns5657**RTL queries (prefer accessible):** `getByRole('button', { name: /submit/i })`, `getByLabelText(/email/i)`; fall back to `getByTestId`.5859**Async:** `await screen.findByText(...)`, `waitForElementToBeRemoved(...)`, `waitFor(() => expect(mockFn).toHaveBeenCalled())`.6061**MSW mocking:**62```ts63const server = setupServer(rest.get('/api/users', (_, res, ctx) => res(ctx.json([{ id: 1 }]))));64beforeAll(() => server.listen());65afterEach(() => server.resetHandlers());66afterAll(() => server.close());67```6869**Playwright locators:** `page.getByRole('button', { name: 'submit' })`, chain with `.filter({ hasText: 'Product' })`.7071## Strategy: test pyramid — many unit, fewer integration, fewest E2E. Target 80% coverage on critical paths; don't chase 100%. Stabilize flaky tests by removing arbitrary waits and using web-first assertions.