iOS app
# Test Plan — XamIoT iOS
App version: v1.0.5
---
## 1. Authentication
### TC-IOS-AUTH-01 — Valid Login
Prerequisites: existing and activated account
Steps:
1. Open the app
2. Enter a valid email address and password
3. Tap "Log In"
Expected result: JWT token stored in Keychain, redirected to the list of sensors
---
### TC-IOS-AUTH-02 — Login with incorrect password
Steps:
1. Enter a valid email address and an incorrect password
2. Tap "Log in"
Expected result: error message displayed, no navigation
---
### TC-IOS-AUTH-03 — Session persistence
Steps:
1. Log in
2. Close the app completely
3. Reopen the app
Expected result: user remains logged in, no new login screen
---
### TC-IOS-AUTH-04 — Logout
Steps:
1. Go to Settings
2. Tap "Log out"
3. Confirm
Expected result: token removed from Keychain, return to login screen, Wi-Fi credentials deleted
---
### TC-IOS-AUTH-05 — Forgotten password
Steps:
1. On the login screen, tap "Forgot Password"
2. Enter the email address
3. Submit
Expected result: Reset email received, confirmation message displayed
---
### TC-IOS-AUTH-06 — Account Creation
Steps:
1. Click "Create an account"
2. Enter email, password, first name, last name, and phone number with country code
3. Submit
Expected result: confirmation email sent, message displayed
---
### TC-IOS-AUTH-07 — Server Selector (Easter Egg)
Steps:
1. On the login screen, tap the title 5 times
2. Switch servers
Expected result: the selected server is retained, API calls point to the correct server
---
## 2. BLE Enrollment
### TC-IOS-BLE-01 — Sensor Scan
Prerequisites: Bluetooth enabled, a powered and unenrolled SoundSense sensor
Steps:
1. Tap "+" to add a sensor
2. View the list of BLE devices
Expected result: The sensor appears with its name (prefixed with "SOUND-SENSOR")
---
### TC-IOS-BLE-02 — Complete Enrollment
Steps:
1. Select the sensor from the list
2. Enter the Wi-Fi SSID and password
3. Confirm the Wi-Fi connection
4. Enter a name for the sensor
5. Confirm creation
Expected result:
- WiFi provisioned via GATT
- WiFi status changes to positive (got_ip / connected)
- MQTT credentials (host, port, user, pass) sent via BLE
- Sensor created on the API
- Sensor visible in the list
---
### TC-IOS-BLE-03 — Incorrect WiFi
Steps:
1. Start enrollment with an incorrect WiFi SSID/password
Expected result: WiFi status turns negative after timeout, error message displayed, option to retry
---
### TC-IOS-BLE-04 — Bluetooth disabled
Steps:
1. Disable Bluetooth
2. Attempt to add a sensor
Expected result: Message asking to enable Bluetooth
---
### TC-IOS-BLE-05 — WiFi timeout
Steps:
1. Start enrollment with a WiFi network out of range
Expected result: timeout after 10 seconds, error message, option to retry
---
### TC-IOS-BLE-06 — BLE disconnection during enrollment
Steps:
1. Start enrollment
2. Move the sensor away during the WiFi phase
Expected result: error displayed, consistent state, no duplicate sensor created on the API
---
## 3. Sensor Data and MQTT
### TC-IOS-MQTT-01 — Display sensor list
Prerequisites: at least one sensor enrolled and connected to MQTT
Steps:
1. Open the sensor list
Expected result: each sensor displays the latest sound level (dB), the elapsed time since the last measurement, and the sparkline
---
### TC-IOS-MQTT-02 — Automatic Refresh
Steps:
1. Enable auto-refresh (toggle)
2. Wait 10 seconds
Expected result: data is automatically updated every 10 seconds
---
### TC-IOS-MQTT-03 — Bring to Foreground
Steps:
1. Move the app to the background
2. Return to the app
Expected result: Data automatically refreshes upon return
---
### TC-IOS-MQTT-04 — Sensor offline
Prerequisites: sensor turned off or disconnected
Steps:
1. View the list
Expected result: the "last seen" timestamp reflects the last actual connection, not a crash
---
## 4. Alert Rules
### TC-IOS-RULES-01 — Creating a rule from a template
Steps:
1. Go to a sensor's details
2. Click "Add a rule"
3. Select a template
4. Configure operator, threshold, cooldown, label
5. Activate and save
Expected result: rule created via API, visible in the sensor list
---
### TC-IOS-RULES-02 — Threshold Out of Range
Steps:
1. Create a rule
2. Enter a threshold below the minimum or above the maximum of the template
Expected result: threshold locked at min/max limits, no out-of-range alerts
---
### TC-IOS-RULES-03 — Cooldown Below Minimum
Steps:
1. Attempt to enter a cooldown lower than cooldown_min_sec
Expected result: cooldown locked at the minimum value
---
### TC-IOS-RULES-04 — Enabling/disabling a rule
Steps:
1. In the list of rules, toggle the activation switch
Expected result: status updated via PATCH on the API; toggle reflects the new status
---
### TC-IOS-RULES-05 — Editing an existing rule
Steps:
1. Tap on an existing rule
2. Modify the threshold and cooldown
3. Save
Expected result: changes persisted on the API
---
### TC-IOS-RULES-06 — Deleting a rule
Steps:
1. Swipe the rule to the left
2. Confirm deletion
Expected result: rule deleted from the API, disappears from the list
---
## 5. Sensor Management
### TC-IOS-DEV-01 — Editing a sensor name
Steps:
1. Tap and hold the sensor → Edit
2. Change the name
3. Save
Expected result: name updated on the API and locally (SwiftData)
---
### TC-IOS-DEV-02 — Deleting a sensor
Steps:
1. Swipe the sensor → Delete
2. Confirm
Expected result: sensor deleted from the API, removed from the list
---
### TC-IOS-DEV-03 — Local persistence (SwiftData)
Steps:
1. Enroll a sensor
2. Switch to airplane mode
3. Reopen the app
Expected result: sensors still visible (local data), no crash
---
## 6. Push notifications
### TC-IOS-NOTIF-01 — Notification Permissions
Steps:
1. First launch of the app
2. Accept notifications
Expected result: APNs token registered via API POST /devices)
---
### TC-IOS-NOTIF-02 — Foreground reception
Prerequisites: an active alert rule; the sensor triggers a threshold
Steps:
1. Keep the app open
Expected result: banner displayed, payload logged locally (SwiftData), badge incremented
---
### TC-IOS-NOTIF-03 — Background Receipt
Steps:
1. Move the app to the background
2. The sensor triggers an alert
Expected result: system notification received, payload captured silently
---
### TC-IOS-NOTIF-04 — Badge reset
Steps:
1. Return to the app after receiving notifications
Expected result: badge reset to 0 via POST /me/badge/reset
---
### TC-IOS-NOTIF-05 — Notification summary in the list
Steps:
1. Trigger an alert on a sensor
2. View the list of sensors
Expected result: the sensor row displays "Alert: Xs"
---
## 7. Settings and Configuration
### TC-IOS-CFG-01 — Account Deletion
Steps:
1. Go to settings
2. Tap "Delete my account"
3. Enter the confirmation email
4. Confirm
Expected result: account deleted via API, return to the login screen
---
### TC-IOS-CFG-02 — Saving Wi-Fi credentials
Steps:
1. Enroll a sensor with a Wi-Fi SSID/password
2. Initiate a second enrollment
Expected result: SSID and password pre-filled
---
## 8. Robustness Tests
### TC-IOS-ROB-01 — Network loss during use
Steps:
1. Switch to airplane mode while the app is open
Expected result: Network error message displayed, no crash, recovery upon network restoration
---
### TC-IOS-ROB-02 — Token expired
Steps:
1. Leave the app inactive long enough for the token to expire
2. Attempt an API action
Expected result: Redirected to the login screen
---
### TC-IOS-ROB-03 — Manual refresh
Steps:
1. Pull down on the sensor list (pull-to-refresh)
Expected result: data reloaded from the API
---


