Files
OpenHands/__tests__
Rohit Malhotraandopenhands 4e6eee71fa feat(automations): add backend health check before loading automations UI (#185)
* feat(automations): add backend health check before loading automations UI

- Add checkHealth() method to AutomationService that calls /api/automation/health
- Create useAutomationHealth hook for React Query integration
- Create BackendNotConfigured component to display when backend is unavailable
- Update automations-list.tsx and automation-detail.tsx routes to check health
- Show 'Automations Backend Not Configured' UI with host URL and retry button
- Add i18n translations for new UI strings
- Add tests for hook and component

* fix: perform health check for cloud backends too, update message

- Remove assumption that cloud backends are always healthy
- Call /api/automation/health via cloud proxy for cloud backends
- Update message to generic 'Automations Unavailable' / 'not available right now'
- Remove host URL display (not needed for generic message)
- Rename component to BackendUnavailable (keep BackendNotConfigured as alias)

* fix: disable automation API calls when health check fails

- Add enabled option to useAutomations, useAutomationDetail, and useAutomationRuns hooks
- Only fetch automations data when the backend health check passes
- Update hook call sites to pass enabled flag based on isBackendHealthy
- Update tests to use new options-based API

* test: add checkHealth mock to automation-detail test

The test was failing because the health check now gates automation API calls.
Added checkHealth mock returning { status: 'ok' } so the test can proceed.

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2026-05-08 13:00:59 -04:00
..