Systematically test the modal.cards application - run unit tests, component tests, and E2E tests. Use when testing components, validating functionality, checking broken features, or running the full test suite.
41:Te5a,
Systematically test the modal.cards Next.js application.
npm run dev (port 3000 or 3001)jest.config.js, playwright.config.tsjest.setup.js (loads @testing-library/jest-dom)test-utils/render.tsx__tests__/ directorye2e/ directory# Run all unit tests
npm test
# Run specific test file
npx jest __tests__/components/Modal1.test.tsx
# Run tests matching a pattern
npx jest --testPathPattern="Generator"
# Run with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e
When invoked with /test-app, follow this workflow:
all or no argument:npm test to execute all unit/component testsunit:npm teste2e:npm run test:e2eModal1, Generator):npx jest --testPathPattern="$ARGUMENTS"When writing new tests, always:
test-utils/render.tsx (NOT from @testing-library/react directly)import { render, screen } from '../../test-utils/render';
import userEvent from '@testing-library/user-event';
import ComponentName from '../../components/ComponentName';
describe('ComponentName', () => {
it('should render correctly', () => {
render(<ComponentName />);
expect(screen.getByText('Expected text')).toBeInTheDocument();
});
it('should handle user interaction', async () => {
const user = userEvent.setup();
render(<ComponentName />);
await user.click(screen.getByRole('button', { name: /click me/i }));
expect(screen.getByText('Result')).toBeInTheDocument();
});
});
value prop preventing user typing (Targeting section)After running tests, provide a structured report:
## Test Results Summary
**Passed**: X | **Failed**: Y | **Skipped**: Z
### Failures
- [ComponentName] Description of failure
- [ComponentName] Description of failure
### Identified Issues
1. **Critical**: Issues that break core functionality
2. **Major**: Features that don't work as expected
3. **Minor**: UI inconsistencies, warnings
### Recommendations
- Prioritized list of fixes needed