|
| 1 | +# Timer Reconnect Feature - Testing Steps |
| 2 | + |
| 3 | +## Overview |
| 4 | +This document outlines the testing steps for the timer reconnect/refresh feature, which allows users to manually reconnect the timer WebSocket connection when it becomes disconnected. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | +- Timer service backend should be running |
| 8 | +- Browser DevTools should be accessible (F12) |
| 9 | +- Timer component should be visible in the application |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Test Case 1: Main Timer Preview - Reconnect Button |
| 14 | + |
| 15 | +### Steps: |
| 16 | +1. **Open the application** and ensure the timer is visible in the header |
| 17 | +2. **Open Browser DevTools** (F12) → Go to **Network** tab |
| 18 | +3. **Enable Request Blocking**: |
| 19 | + - Click the **⋮** (three dots) menu in Network tab |
| 20 | + - Select **"More tools"** → **"Request blocking"** |
| 21 | + - Click **"+ Add pattern"** |
| 22 | + - Enter pattern: `*timer-service*` |
| 23 | + - **Enable** the checkbox next to the pattern |
| 24 | +4. **Refresh the page** (F5) |
| 25 | +5. **Verify Disconnected State**: |
| 26 | + - The timer preview area should show **"Disconnected"** in red text |
| 27 | + - A **refresh icon** (circular arrows) should appear next to "Disconnected" |
| 28 | +6. **Test Hover Tooltip**: |
| 29 | + - Hover over the refresh icon |
| 30 | + - Tooltip should display: **"Reconnect"** |
| 31 | +7. **Test Reconnection**: |
| 32 | + - **Unblock** the timer-service pattern (uncheck the checkbox in Request Blocking) |
| 33 | + - Click the **refresh icon** |
| 34 | + - Wait a few seconds |
| 35 | + - Timer should reconnect and show the time display (e.g., "00:15:00") |
| 36 | + - The "Disconnected" message should disappear |
| 37 | + |
| 38 | +### Expected Results: |
| 39 | +- ✅ Disconnected state displays correctly |
| 40 | +- ✅ Reconnect button is visible and clickable |
| 41 | +- ✅ Hover tooltip shows "Reconnect" |
| 42 | +- ✅ Reconnection works when service is available |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Test Case 2: Timer Dropdown - Reconnect Button |
| 47 | + |
| 48 | +### Steps: |
| 49 | +1. **Follow steps 1-4 from Test Case 1** to get into disconnected state |
| 50 | +2. **Click on the timer icon** or the "Disconnected" preview area |
| 51 | +3. **Verify Timer Dropdown Opens**: |
| 52 | + - A dropdown should appear showing the timer status |
| 53 | + - Should display: **"The connection with the timer service is closed"** |
| 54 | + - A **refresh icon** should be visible **centered** below the message |
| 55 | +4. **Test Hover Tooltip**: |
| 56 | + - Hover over the refresh icon in the dropdown |
| 57 | + - Tooltip should display: **"Reconnect"** |
| 58 | +5. **Test Reconnection from Dropdown**: |
| 59 | + - **Unblock** the timer-service pattern |
| 60 | + - Click the **refresh icon** in the dropdown |
| 61 | + - Wait a few seconds |
| 62 | + - Dropdown should show the timer countdown interface |
| 63 | + - Timer should be functional |
| 64 | + |
| 65 | +### Expected Results: |
| 66 | +- ✅ Timer dropdown opens even when disconnected |
| 67 | +- ✅ Reconnect button is centered in the dropdown |
| 68 | +- ✅ Hover tooltip shows "Reconnect" |
| 69 | +- ✅ Reconnection works from the dropdown |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Test Case 3: Popout Timer - Reconnect Button |
| 74 | + |
| 75 | +### Steps: |
| 76 | +1. **Start the timer** (click play button) |
| 77 | +2. **Open the popout timer** (click the expand/fullscreen icon) |
| 78 | +3. **Block the timer-service** (follow steps 2-4 from Test Case 1) |
| 79 | +4. **Wait for disconnection** (approximately 3-4 minutes): |
| 80 | + - Timer sends heartbeat every 60 seconds |
| 81 | + - After 3 failed heartbeats, it will disconnect |
| 82 | + - Popout should show: **"The connection with the timer service is closed"** |
| 83 | +5. **Verify Reconnect Button**: |
| 84 | + - A **refresh icon** should be visible **centered** below the message |
| 85 | +6. **Test Hover Tooltip**: |
| 86 | + - Hover over the refresh icon |
| 87 | + - Tooltip should display: **"Reconnect"** |
| 88 | +7. **Test Reconnection**: |
| 89 | + - **Unblock** the timer-service pattern |
| 90 | + - Click the **refresh icon** |
| 91 | + - Wait a few seconds |
| 92 | + - Popout should reconnect and show the timer countdown |
| 93 | + |
| 94 | +### Expected Results: |
| 95 | +- ✅ Popout timer detects disconnection automatically |
| 96 | +- ✅ Reconnect button appears when disconnected |
| 97 | +- ✅ Hover tooltip shows "Reconnect" |
| 98 | +- ✅ Reconnection works in popout window |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## Test Case 4: Reconnecting State |
| 103 | + |
| 104 | +### Steps: |
| 105 | +1. **Get into disconnected state** (follow steps 1-4 from Test Case 1) |
| 106 | +2. **Keep timer-service blocked** |
| 107 | +3. **Click the refresh icon** |
| 108 | +4. **Verify Reconnecting State**: |
| 109 | + - Refresh icon should **spin** (animated rotation) |
| 110 | + - Button should be **disabled** (not clickable) |
| 111 | + - Hover tooltip should show: **"Reconnecting..."** |
| 112 | +5. **Unblock timer-service** while reconnecting |
| 113 | +6. **Verify Connection**: |
| 114 | + - After a few seconds, connection should be established |
| 115 | + - Spinning animation should stop |
| 116 | + - Timer should display normally |
| 117 | + |
| 118 | +### Expected Results: |
| 119 | +- ✅ Reconnecting state shows spinning animation |
| 120 | +- ✅ Button is disabled during reconnection |
| 121 | +- ✅ Tooltip shows "Reconnecting..." during reconnection |
| 122 | +- ✅ Connection succeeds when service becomes available |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Test Case 5: Clickable Disconnected Preview Area |
| 127 | + |
| 128 | +### Steps: |
| 129 | +1. **Get into disconnected state** (follow steps 1-4 from Test Case 1) |
| 130 | +2. **Click on the "Disconnected" text area** (not just the icon) |
| 131 | +3. **Verify**: |
| 132 | + - Timer dropdown should open |
| 133 | + - Cursor should show as pointer when hovering over the disconnected area |
| 134 | +4. **Click the refresh button** inside the disconnected area |
| 135 | +5. **Verify**: |
| 136 | + - Only the reconnect action happens (dropdown doesn't close) |
| 137 | + - Reconnection process starts |
| 138 | + |
| 139 | +### Expected Results: |
| 140 | +- ✅ Disconnected preview area is clickable |
| 141 | +- ✅ Clicking opens the timer dropdown |
| 142 | +- ✅ Clicking refresh button doesn't trigger dropdown toggle |
| 143 | +- ✅ Both interactions work independently |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## Test Case 6: Keyboard Accessibility |
| 148 | + |
| 149 | +### Steps: |
| 150 | +1. **Get into disconnected state** |
| 151 | +2. **Tab to focus** on the disconnected preview area |
| 152 | +3. **Press Enter**: |
| 153 | + - Timer dropdown should open |
| 154 | +4. **Tab to focus** on the refresh button |
| 155 | +5. **Press Enter**: |
| 156 | + - Reconnection should start |
| 157 | + |
| 158 | +### Expected Results: |
| 159 | +- ✅ Keyboard navigation works |
| 160 | +- ✅ Enter key triggers appropriate actions |
| 161 | +- ✅ Focus indicators are visible |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## Alternative Testing Method (Without Request Blocking) |
| 166 | + |
| 167 | +If Request Blocking doesn't work in your browser, you can: |
| 168 | + |
| 169 | +1. **Stop the timer service backend** temporarily |
| 170 | +2. **Wait for connection to fail** (or refresh page) |
| 171 | +3. **Follow the same verification steps** as above |
| 172 | +4. **Restart the timer service** to test reconnection |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## Notes |
| 177 | + |
| 178 | +- **Heartbeat Mechanism**: The timer sends heartbeat requests every 60 seconds when running. If 3 consecutive heartbeats fail (no response within 10 seconds each), it will automatically disconnect. |
| 179 | +- **Reconnect Button Location**: |
| 180 | + - Main timer preview: Next to "Disconnected" text |
| 181 | + - Timer dropdown: Centered below connection status message |
| 182 | + - Popout timer: Centered below connection status message |
| 183 | +- **Tooltip Text**: |
| 184 | + - Shows "Reconnect" when button is enabled |
| 185 | + - Shows "Reconnecting..." when actively reconnecting |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +## Known Issues / Edge Cases to Test |
| 190 | + |
| 191 | +1. **Rapid clicking**: Click refresh button multiple times quickly - should only trigger one reconnection |
| 192 | +2. **Network interruption during reconnection**: Block/unblock rapidly - should handle gracefully |
| 193 | +3. **Multiple timer instances**: Test with both main timer and popout open simultaneously |
| 194 | +4. **Browser refresh**: Refresh page while disconnected - should maintain disconnected state initially |
| 195 | + |
0 commit comments