FreedomBox/debian/tests/access-web-interface
James Valleroy b6e122816d
d/tests: Re-arrange test steps to help with debugging
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2026-08-17 19:52:04 -07:00

39 lines
1.1 KiB
Bash

#!/bin/sh
set -e
# Wait for FreedomBox first-boot setup to complete and the web server to
# start listening. App setup order is not deterministic, so a fixed sleep can
# expire before the apache app configures port 443. Poll instead of guessing.
echo "Waiting for first-boot setup to complete..."
SETUP_COMPLETE=0
for _ in $(seq 1 120); do
if curl --fail --insecure --silent --output /tmp/fbx_status.json \
https://localhost/freedombox/status/; then
if grep -q '"is_first_setup_running"[[:space:]]*:[[:space:]]*false' /tmp/fbx_status.json; then
SETUP_COMPLETE=1
break
fi
fi
sleep 2
done
# Print final status in test log
cat /tmp/fbx_status.json || true
rm -f /tmp/fbx_status.json
journalctl --unit=plinth --unit=freedombox-privileged
# Access FreedomBox interface
curl --location --cookie "" --fail --write-out "%{response_code}" --insecure \
--stderr - https://localhost/freedombox/
if [ "$SETUP_COMPLETE" -eq 0 ]; then
echo "Error: first-boot setup did not complete in the allotted time." >&2
exit 1
fi