Fix Home and Phone settings states

This commit is contained in:
Gabriel Brown
2026-08-17 18:02:09 -04:00
parent 65966200fe
commit c8eb344a0b
6 changed files with 144 additions and 15 deletions
@@ -93,6 +93,7 @@ assert_contains 'HomePreferences.add' "$home_page"
assert_contains 'HomePreferences.retrySave' "$home_page"
assert_contains 'Choose lights below to build your Control Center shelf.' "$home_page"
assert_contains 'All discovered lights are already selected' "$home_page"
assert_contains 'No lights discovered' "$home_page"
assert_contains 'No lights match that search' "$home_page"
assert_contains 'Opens BlueBubbles' "$home_page"
[[ "$(rg -Fc 'required property var modelData' "$home_page")" -ge 2 ]] \
@@ -173,9 +174,100 @@ for _ in $(seq 1 40); do
fi
sleep 0.1
done
jq -e '.open == true and .page == "home-phone" and .discoveredCount == 7 and .selectedCount == 7' \
jq -e '
.open == true and
.page == "home-phone" and
.discoveredCount == 7 and
.selectedCount == 7 and
.homePhone.availableLightIds == [] and
.homePhone.availableEmptyText == "All discovered lights are already selected"
' \
<<<"$status" >/dev/null || fail "Home & Phone diagnostics are incomplete: $status"
qs_for_test ipc call home-assistant fixture available-extra >/dev/null
available_status='{}'
for _ in $(seq 1 40); do
available_status="$(qs_for_test ipc call settings status | jq -c .)"
if jq -e '
.discoveredCount == 8 and
.selectedCount == 7 and
.homePhone.availableLightIds == ["light.fixture_guest"]
' <<<"$available_status" >/dev/null; then
break
fi
sleep 0.1
done
jq -e '
.discoveredCount == 8 and
.selectedCount == 7 and
.homePhone.availableLightIds == ["light.fixture_guest"]
' <<<"$available_status" >/dev/null \
|| fail "an unselected fixture light was not the only available row: $available_status"
qs_for_test ipc call home-assistant fixture stale-authentication >/dev/null
authentication_status='{}'
for _ in $(seq 1 40); do
authentication_status="$(qs_for_test ipc call settings status | jq -c .)"
if jq -e '
.discoveredCount == 7 and
.selectedCount == 7 and
.homePhone.homeStatus == "Authentication required"
' <<<"$authentication_status" >/dev/null; then
break
fi
sleep 0.1
done
jq -e '
.discoveredCount == 7 and
.selectedCount == 7 and
.homePhone.homeStatus == "Authentication required"
' <<<"$authentication_status" >/dev/null \
|| fail "stale authentication did not retain actionable copy: $authentication_status"
qs_for_test ipc call home-assistant fixture stale-not-configured >/dev/null
not_configured_status='{}'
for _ in $(seq 1 40); do
not_configured_status="$(qs_for_test ipc call settings status | jq -c .)"
if jq -e '
.discoveredCount == 7 and
.selectedCount == 7 and
.homePhone.homeStatus == "Home Assistant is not configured"
' <<<"$not_configured_status" >/dev/null; then
break
fi
sleep 0.1
done
jq -e '
.discoveredCount == 7 and
.selectedCount == 7 and
.homePhone.homeStatus == "Home Assistant is not configured"
' <<<"$not_configured_status" >/dev/null \
|| fail "stale not-configured state did not retain actionable copy: $not_configured_status"
qs_for_test ipc call home-assistant fixture unavailable >/dev/null
empty_status='{}'
for _ in $(seq 1 40); do
empty_status="$(qs_for_test ipc call settings status | jq -c .)"
if jq -e '
.discoveredCount == 0 and
.selectedCount == 0 and
.homePhone.homeStatus == "Home Assistant is not configured" and
.homePhone.availableLightIds == [] and
.homePhone.availableEmptyText == "No lights discovered"
' <<<"$empty_status" >/dev/null; then
break
fi
sleep 0.1
done
jq -e '
.discoveredCount == 0 and
.selectedCount == 0 and
.homePhone.homeStatus == "Home Assistant is not configured" and
.homePhone.availableLightIds == [] and
.homePhone.availableEmptyText == "No lights discovered"
' <<<"$empty_status" >/dev/null \
|| fail "an empty catalog did not render its distinct copy: $empty_status"
system_status="$(qs_for_test ipc call settings-system status | jq -c .)"
jq -e '.bluebubblesAvailable == true' <<<"$system_status" >/dev/null \
|| fail "BlueBubbles availability was not exposed: $system_status"