- Implement Next.js middleware for route protection - Create Zustand auth store for web (similar to mobile) - Add comprehensive tests for middleware and auth store - Protect authenticated routes (/dashboard, /profile) - Redirect unauthenticated users to /login - Redirect authenticated users from auth routes to /dashboard - Handle session expiration with 401 callback - Set access token cookie for middleware - All tests passing (105 tests total)
291 lines
6.8 KiB
YAML
291 lines
6.8 KiB
YAML
appId: com.wellnuo.app
|
|
---
|
|
# WellNuo Sensor Management E2E Tests
|
|
# Tests the complete sensor management flow:
|
|
# 1. View sensors list
|
|
# 2. Add sensors (mock/simulator mode)
|
|
# 3. Sensor status display
|
|
# 4. Navigate to device settings
|
|
# 5. Detach sensor
|
|
|
|
# Prerequisites:
|
|
# - User must be logged in with an existing beneficiary
|
|
# - Beneficiary should have sensors attached (for view/detach tests)
|
|
|
|
# --- Test Setup: Login and Navigate to Beneficiary ---
|
|
|
|
# Launch app
|
|
- launchApp:
|
|
clearState: true
|
|
|
|
# Wait for app to load
|
|
- extendedWaitUntil:
|
|
visible: "Continue"
|
|
timeout: 10000
|
|
|
|
# Enter test email
|
|
- tapOn: "Enter your email"
|
|
- inputText: "wellnuo_sensor_test@yopmail.com"
|
|
- hideKeyboard
|
|
|
|
# Tap Continue
|
|
- tapOn: "Continue"
|
|
|
|
# Wait for OTP screen
|
|
- extendedWaitUntil:
|
|
visible: "Check your email"
|
|
timeout: 10000
|
|
|
|
# Enter OTP code - test bypass code 000000
|
|
- tapOn:
|
|
point: "15%,25%"
|
|
- inputText: "000000"
|
|
- tapOn: "Verify"
|
|
|
|
# Wait for main screen with beneficiaries
|
|
- extendedWaitUntil:
|
|
visible: "My Loved Ones"
|
|
timeout: 15000
|
|
|
|
- takeScreenshot: sensor-test-01-dashboard
|
|
|
|
# --- FLOW 1: Navigate to Sensors/Equipment Screen ---
|
|
|
|
# Tap on a beneficiary (Grandma or first in list)
|
|
- runFlow:
|
|
when:
|
|
visible: "Grandma"
|
|
commands:
|
|
- tapOn: "Grandma"
|
|
|
|
- runFlow:
|
|
when:
|
|
notVisible: "Grandma"
|
|
commands:
|
|
# Tap first beneficiary card
|
|
- tapOn:
|
|
point: "50%,35%"
|
|
|
|
# Wait for beneficiary detail screen
|
|
- extendedWaitUntil:
|
|
visible: ".*Sensors.*|.*Equipment.*|.*Subscription.*"
|
|
timeout: 10000
|
|
|
|
- takeScreenshot: sensor-test-02-beneficiary-detail
|
|
|
|
# Navigate to Sensors/Equipment
|
|
- tapOn:
|
|
text: ".*Sensors.*|.*Equipment.*"
|
|
|
|
# Wait for Equipment screen to load
|
|
- extendedWaitUntil:
|
|
visible: ".*Total.*|.*Online.*|.*Offline.*|.*No Sensors Connected.*"
|
|
timeout: 10000
|
|
|
|
- takeScreenshot: sensor-test-03-equipment-screen
|
|
|
|
# --- FLOW 2: View Sensor List and Summary ---
|
|
|
|
# Verify summary card is visible (shows Total, Online, Warning, Offline counts)
|
|
- assertVisible:
|
|
text: "Total"
|
|
optional: true
|
|
|
|
- assertVisible:
|
|
text: "Online"
|
|
optional: true
|
|
|
|
# --- FLOW 3: Add Sensor Flow (Mock Mode in Simulator) ---
|
|
|
|
# Check if "Add Sensors" or "Add More Sensors" button is visible
|
|
- runFlow:
|
|
when:
|
|
visible: ".*Add.*Sensor.*"
|
|
commands:
|
|
- tapOn:
|
|
text: ".*Add.*Sensor.*"
|
|
|
|
# Wait for Add Sensor screen
|
|
- extendedWaitUntil:
|
|
visible: ".*How to Add.*|.*Scan for Sensors.*"
|
|
timeout: 10000
|
|
|
|
- takeScreenshot: sensor-test-04-add-sensor-screen
|
|
|
|
# Verify instructions are shown
|
|
- assertVisible:
|
|
text: ".*power.*on.*"
|
|
optional: true
|
|
|
|
# Check for simulator warning (will show in simulator)
|
|
- assertVisible:
|
|
text: ".*Simulator.*|.*mock.*"
|
|
optional: true
|
|
|
|
# Tap Scan button
|
|
- tapOn:
|
|
text: "Scan for Sensors"
|
|
optional: true
|
|
|
|
# Wait for scanning or results
|
|
- extendedWaitUntil:
|
|
visible: ".*Scanning.*|.*Found Sensors.*|.*WP_.*|.*No Sensors Found.*"
|
|
timeout: 15000
|
|
|
|
- takeScreenshot: sensor-test-05-scan-results
|
|
|
|
# If sensors found, verify UI elements
|
|
- runFlow:
|
|
when:
|
|
visible: ".*WP_.*"
|
|
commands:
|
|
# Verify signal indicator is shown
|
|
- assertVisible:
|
|
text: ".*dBm.*|.*Excellent.*|.*Good.*|.*Fair.*|.*Weak.*"
|
|
optional: true
|
|
|
|
# Verify "Add Selected" button appears
|
|
- assertVisible:
|
|
text: "Add Selected"
|
|
optional: true
|
|
|
|
# Select first sensor and proceed to WiFi setup
|
|
- tapOn:
|
|
text: "Add Selected.*"
|
|
optional: true
|
|
|
|
# Wait for WiFi setup screen
|
|
- extendedWaitUntil:
|
|
visible: ".*Setup WiFi.*|.*WiFi Password.*|.*Available Networks.*"
|
|
timeout: 10000
|
|
|
|
- takeScreenshot: sensor-test-06-wifi-setup
|
|
|
|
# Go back to equipment screen
|
|
- tapOn:
|
|
id: "back-button"
|
|
optional: true
|
|
- tapOn:
|
|
point: "5%,7%"
|
|
optional: true
|
|
|
|
# --- FLOW 4: Device Settings (if sensors exist) ---
|
|
|
|
# Navigate back to equipment screen if needed
|
|
- extendedWaitUntil:
|
|
visible: ".*Sensors.*|.*Equipment.*|.*Total.*"
|
|
timeout: 5000
|
|
optional: true
|
|
|
|
# If sensors exist, tap on one to view settings
|
|
- runFlow:
|
|
when:
|
|
visible: ".*WP_.*"
|
|
commands:
|
|
# Tap on sensor card
|
|
- tapOn:
|
|
text: ".*WP_.*"
|
|
|
|
# Wait for device settings or action sheet
|
|
- extendedWaitUntil:
|
|
visible: ".*Settings.*|.*Reconnect.*|.*Remove.*|.*WiFi.*"
|
|
timeout: 5000
|
|
optional: true
|
|
|
|
- takeScreenshot: sensor-test-07-device-action
|
|
|
|
# Close if action sheet
|
|
- tapOn:
|
|
text: "Cancel"
|
|
optional: true
|
|
|
|
# --- FLOW 5: Sensor Status Verification ---
|
|
|
|
# Go back to equipment screen
|
|
- extendedWaitUntil:
|
|
visible: ".*Total.*|.*Sensors.*"
|
|
timeout: 5000
|
|
|
|
# Verify sensor status badges are shown correctly
|
|
- assertVisible:
|
|
text: ".*Online.*|.*Offline.*|.*Warning.*"
|
|
optional: true
|
|
|
|
# Verify last activity time format
|
|
- assertVisible:
|
|
text: ".*ago.*|.*Just now.*"
|
|
optional: true
|
|
|
|
- takeScreenshot: sensor-test-08-status-check
|
|
|
|
# --- FLOW 6: Detach Sensor (only if sensors exist and we want to test) ---
|
|
|
|
# Note: Detach test is optional and destructive - uncomment to test
|
|
# - runFlow:
|
|
# when:
|
|
# visible: ".*WP_.*"
|
|
# commands:
|
|
# # Find and tap detach button (unlink icon)
|
|
# - tapOn:
|
|
# id: "detach-button"
|
|
# optional: true
|
|
#
|
|
# # Confirm detach in dialog
|
|
# - extendedWaitUntil:
|
|
# visible: ".*Detach.*|.*Are you sure.*"
|
|
# timeout: 5000
|
|
#
|
|
# - tapOn:
|
|
# text: "Detach"
|
|
# optional: true
|
|
#
|
|
# # Verify success message
|
|
# - extendedWaitUntil:
|
|
# visible: ".*detached.*|.*Success.*"
|
|
# timeout: 5000
|
|
#
|
|
# - takeScreenshot: sensor-test-09-detach-success
|
|
|
|
# --- FLOW 7: Empty State Verification ---
|
|
|
|
# If no sensors, verify empty state UI
|
|
- runFlow:
|
|
when:
|
|
visible: "No Sensors Connected"
|
|
commands:
|
|
- assertVisible:
|
|
text: ".*Add WP sensors.*"
|
|
optional: true
|
|
|
|
- assertVisible:
|
|
text: "Add Sensors"
|
|
optional: true
|
|
|
|
- takeScreenshot: sensor-test-10-empty-state
|
|
|
|
# --- FLOW 8: Troubleshooting Info ---
|
|
|
|
# Verify About Sensors info card is shown
|
|
- assertVisible:
|
|
text: "About Sensors"
|
|
optional: true
|
|
|
|
- takeScreenshot: sensor-test-11-info-card
|
|
|
|
# --- Cleanup: Navigate back to main screen ---
|
|
|
|
# Go back
|
|
- tapOn:
|
|
point: "5%,7%"
|
|
|
|
# Wait for beneficiary list
|
|
- extendedWaitUntil:
|
|
visible: "My Loved Ones"
|
|
timeout: 10000
|
|
|
|
- takeScreenshot: sensor-test-12-complete
|
|
|
|
# Test complete message
|
|
- assertVisible:
|
|
text: "My Loved Ones"
|