Sunil Mohan Adapa ce341b18ab
homeassistant: Add the most popular app for home automation
- Use docker container via registry.freedombox.org to obtain the package.
Specify this in the description.

- Mark the app as experimental.

- Show information that a dedicated domain is required to host Home Assistant.

- Use special YAML loader/dumper to deal with custom YAML tags in configuration
file.

- Obtain logo file from a test file in code repository with Apache license as
the actual logo files are freely licensed.

- Write functional tests without accessing the website as a dedicated domain is
necessary.

Tests:

- Functional tests work.

- Add a domain 'mydomain.example' using the Names app. Assign this domain in
Home Assistant app configuration. In /etc/hosts on the host machine add a
mapping from mydomain.example to the IP address of the container/VM. Access the
web interface using https://mydomain.example. Home Assistant web interface is
available and functional.

- After install of the app the configuration.yaml file contains the proxy
related lines are expected.

- Diagnostics work (expect the URL access).

- Re-run setup works.

- 'Launch web client' and frontpage shortcut work as expected.

- Non-admin users can't connect on port 8123.

- Home Assistant is able to establish websocket connection in its web UI.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-05-30 15:14:55 -04:00

29 lines
946 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""Functional, browser based tests for Home Assistant app."""
import pytest
from plinth.tests import functional
pytestmark = [pytest.mark.apps, pytest.mark.homeassistant]
class TestHomeAssitantApp(functional.BaseAppTests):
"""Basic tests for Home Assistant app."""
app_name = 'homeassistant'
has_service = True
has_web = False # Can't yet check separate sub-domain
diagnostics_delay = 5
def install_and_setup(self, session_browser):
"""Set the domain to freedombox.local so that it can tested."""
super().install_and_setup(session_browser)
_domain_set(session_browser, 'freedombox.local')
def _domain_set(browser, domain):
"""Set the domain in the domain selection drop down."""
functional.nav_to_module(browser, 'homeassistant')
browser.select('domain_name', domain)
functional.submit(browser, form_class='form-configuration')