mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-22 02:32:10 +10:00
Portal: request-scoped shell bundle, SPA connect poll fix, test tidy
- Use per-request PortalShellRenderBundle and one root shell template; drop server-side template registry and simplify WiFiManagerServer. - PortalAppJS: centralize chrome/form binding; fix WiFi connect polling by stopping previous timers on view change and before new polls. - processPortalConnect honors _cleanConnect like connectWifi. - Remove brittle full-JSON API tests; trim test harness surface. - README: small doc touch-up for the shell/portal flow.
This commit is contained in:
@@ -15,8 +15,6 @@ TestCase tests[] = {
|
||||
TEST_ENTRY(test_api_info_json_shape),
|
||||
TEST_ENTRY(test_api_params_json_shape),
|
||||
TEST_ENTRY(test_api_status_json_shape),
|
||||
TEST_ENTRY(test_api_action_response_json_literals),
|
||||
TEST_ENTRY(test_api_ota_done_success_json_literal),
|
||||
|
||||
// Configuration tests
|
||||
TEST_ENTRY(test_configuration_setters),
|
||||
|
||||
@@ -131,8 +131,6 @@ void test_api_wifi_meta_json_shape();
|
||||
void test_api_info_json_shape();
|
||||
void test_api_params_json_shape();
|
||||
void test_api_status_json_shape();
|
||||
void test_api_action_response_json_literals();
|
||||
void test_api_ota_done_success_json_literal();
|
||||
|
||||
// State transition tests
|
||||
void test_portal_to_connected_transition();
|
||||
|
||||
@@ -81,41 +81,3 @@ void test_api_status_json_shape() {
|
||||
|
||||
Serial.println("[TEST] API status JSON shape test completed successfully");
|
||||
}
|
||||
|
||||
void test_api_action_response_json_literals() {
|
||||
Serial.println("[TEST] Testing POST /api action JSON payloads...");
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"Restart scheduled\"}",
|
||||
WiFiManagerHandlers::jsonApiDeviceRestartScheduled().c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"Setup saved\"}",
|
||||
WiFiManagerHandlers::jsonApiParamsSaveOk().c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"Captive portal detection disabled\"}",
|
||||
WiFiManagerHandlers::jsonApiPortalCloseOk().c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"Exiting portal\"}",
|
||||
WiFiManagerHandlers::jsonApiPortalExitOk().c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":false,\"message\":\"Exit not allowed\"}",
|
||||
WiFiManagerHandlers::jsonApiPortalExitForbidden().c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"WiFi configuration erased. Device will restart shortly.\"}",
|
||||
WiFiManagerHandlers::jsonApiEraseResponse(true).c_str());
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":false,\"message\":\"Erase failed\"}",
|
||||
WiFiManagerHandlers::jsonApiEraseResponse(false).c_str());
|
||||
|
||||
Serial.println("[TEST] Action response JSON literals test completed successfully");
|
||||
}
|
||||
|
||||
void test_api_ota_done_success_json_literal() {
|
||||
Serial.println("[TEST] Testing POST /u completion success JSON...");
|
||||
|
||||
TEST_ASSERT_EQUAL_STRING(
|
||||
"{\"ok\":true,\"message\":\"Firmware updated. Restarting...\"}",
|
||||
WiFiManagerHandlers::jsonApiOtaUpdateSuccess().c_str());
|
||||
|
||||
Serial.println("[TEST] OTA success JSON literal test completed successfully");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user