Files
anal-front/docs/testing.md
Gleb Korotkiy 67ec34d619
Some checks failed
CI/CD Pipeline / Quality Gate (push) Failing after 2m37s
CI/CD Pipeline / Build and Deploy Dev via Compose (push) Has been skipped
refactor: align frontend with FSD architecture
2026-06-22 12:33:33 +03:00

100 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Testing Policy
Дата актуализации: 2026-06-22
## Обязательные проверки перед сдачей
```bash
bun run format:check
bun run check:full
```
`check:full` запускает:
- ESLint;
- Steiger FSD lint;
- Vitest unit tests;
- TypeScript typecheck;
- production build;
- Playwright E2E.
## Текущее покрытие
Unit:
- dashboard filter normalization;
- dashboard API params;
- structured query keys;
- dashboard empty state;
- chart adapters;
- sorting;
- formatting/pluralization;
- tooltip escaping;
- dashboard filter draft mapping;
- dashboard filter definitions;
- `CompetenceMapFilterField` render/v-model contract;
- auth login schema;
- auth safe redirect helper;
- UI-kit entrypoint smoke.
E2E:
- redirect protected route `/dashboard` to `/auth` without auth session;
- auth form empty validation.
## Что нужно покрыть следующим этапом
Component tests:
- `CompetenceMapFilters.vue`: open/sync draft, apply, reset, cancel, disabled/loading state;
- `DashboardTabs.vue`: tab selection and region rating branch;
- `RegionRankingCard.vue`: sort controls;
- `TopIndustriesCard.vue`: empty and filled states;
- `ChartTooltipPortal.vue`: visibility and positioning contract.
E2E with mocked backend:
- authorized dashboard load;
- all/sez/technoparks/clusters tabs;
- filters dialog apply/reset/cancel;
- ranking table sort;
- region rating tab;
- mobile layout smoke.
Visual regression:
- desktop auth page;
- desktop dashboard all/sez/technoparks/clusters;
- filters dialog;
- mobile dashboard top section.
## Правила написания тестов
- Pure helpers тестировать unit-тестами без Vue mount.
- Page-specific UI тестировать рядом с owner slice.
- UI-kit internals не тестировать в page tests; для сложных компонентов использовать stubs или E2E.
- API-зависимые E2E должны использовать route mocks, а не реальный backend.
- Для security-sensitive строковых HTML templates обязательно оставлять tests на escaping.
- После изменения FSD-границ всегда запускать `bun run lint:fsd`.
## Известные build warnings
Сборка проходит, но Vite/Rolldown предупреждает:
- `INVALID_ANNOTATION` в `node_modules/@vueuse/core/dist/index.js`;
- главный chunk больше 500 kB.
Это не runtime failures. Bundle size требует отдельного performance-pass с анализатором чанков.
## Известные test warnings
Vitest component test для Vue SFC может печатать jsdom warning:
```text
Could not parse CSS stylesheet
```
Тесты при этом проходят. Это связано с парсингом runtime-injected SFC/UI-kit CSS в jsdom, а не с
ошибкой production CSS. Если warning начнет мешать CI logs, стоит добавить test setup с точечной
фильтрацией этого сообщения или вынести component tests на browser-based runner.