Prompt
We are building a test suite for login and forms and need it to run in CI
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
To make a login/forms test suite reliable in CI, focus on three things: determinism, speed, and isolation.
Recommended approach
1) Use a layered test strategy
- Unit tests for validation logic, helpers, reducers, serializers, etc.
- Component tests for form behavior: field updates, validation messages, disabled/enabled states, submit handlers.
- End-to-end (E2E) tests for critical paths only:
- login
- password reset
- form submission success/failure
- auth redirects
This keeps CI fast while still covering the important user flows.
2) Make tests CI-friendly
- Run tests in headless mode
- Avoid dependence on real external services
- Use mocked APIs or a dedicated test backend
- Use fixed test data, not shared/stale environments
- Ensure tests can run in parallel without interfering with each other
3) Set up isolated test data
For login/forms, CI failures often come from shared state. Use:
- seeded test users
- disposable databases or in-memory DBs
- setup/teardown per test run
- unique emails/IDs per test
4) Add stability practices
- Prefer
data-testidor accessible labels over brittle CSS selectors - Wait for specific UI states instead of arbitrary sleeps
- Retry only sparingly; use it to mask flake, not hide bugs
- Ensure tests clean up after themselves
Typical CI flow
- Install dependencies
- Lint
- Run unit/component tests
- Spin up app + mock/test backend
- Run E2E tests
- Collect screenshots/videos/logs on failure
Example CI considerations
- GitHub Actions / GitLab CI / Jenkins all work well
- Use caching for dependencies and browser binaries
- Set environment variables for test config:
NODE_ENV=testBASE_URL- test credentials
- API mocks/stub URLs
- Store secrets securely in CI variables
Useful tooling
Depending on your stack:
- React/Vue/Svelte: Testing Library + Vitest/Jest
- E2E: Playwright or Cypress
- Forms: test validation with component tests rather than only E2E
A good starting rule
For login/forms, aim for:
- 80% unit/component coverage
- 20% E2E coverage
- E2E should validate “does the whole thing work?”, not every edge case
If you want, I can also give you:
- a sample CI pipeline,
- a test architecture for login/forms, or
- Playwright/Cypress examples for CI.