fix: E2E test isolation and analytics consent bugs

- Isolate test web server on port 2349 so E2E tests run alongside Docker
- Use fresh SQLite database per test run via DB_PATH, fixing missing
  roles/audit_log tables from stale migration state
- Fix analytics consent redirect loop when ANALYTICS_ENABLED=false by
  auto-declining consent instead of bare redirect
- Dismiss analytics consent via API in auth setup and RBAC test user
  creation so the consent page never blocks UI tests
- Make Vite port and proxy target configurable via env vars
This commit is contained in:
ashim-hq
2026-04-24 01:24:15 +08:00
parent fe384ddfe1
commit a062aa9e5f
6 changed files with 72 additions and 11 deletions
@@ -8,7 +8,8 @@ const t = en.analytics;
export function AnalyticsConsentPage() {
const navigate = useNavigate();
const { config, configLoaded, fetchConfig, acceptAnalytics, remindLater } = useAnalyticsStore();
const { config, configLoaded, fetchConfig, acceptAnalytics, declineAnalytics, remindLater } =
useAnalyticsStore();
useEffect(() => {
fetchConfig();
@@ -16,9 +17,9 @@ export function AnalyticsConsentPage() {
useEffect(() => {
if (configLoaded && !config?.enabled) {
navigate("/", { replace: true });
declineAnalytics().then(() => navigate("/", { replace: true }));
}
}, [configLoaded, config, navigate]);
}, [configLoaded, config, navigate, declineAnalytics]);
if (!configLoaded) {
return (