Repository navigation
Expand file tree
/
Copy pathtest-new-features.html
More file actions
225 lines (204 loc) Β· 8.23 KB
/
Copy pathtest-new-features.html
File metadata and controls
225 lines (204 loc) Β· 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Feature Test - Voice Control & Export</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: #f5f5f5;
}
.test-section {
background: white;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.test-item {
margin: 10px 0;
padding: 10px;
background: #f8f9fa;
border-left: 4px solid #007bff;
}
.success { border-left-color: #28a745; }
.warning { border-left-color: #ffc107; }
.error { border-left-color: #dc3545; }
button {
background: #007bff;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
margin: 5px;
}
button:hover { background: #0056b3; }
.status { font-weight: bold; margin-left: 10px; }
</style>
</head>
<body>
<h1>π§ͺ New Features Test Suite</h1>
<div class="test-section">
<h2>π€ Voice Control Tests</h2>
<div class="test-item">
<strong>Browser Support Check:</strong>
<span id="voice-support" class="status">Checking...</span>
</div>
<div class="test-item">
<strong>Voice Toggle Button:</strong>
<button onclick="testVoiceButton()">Test Voice Button</button>
<span id="voice-button-status" class="status"></span>
</div>
<div class="test-item">
<strong>Voice Commands:</strong>
<p>Try saying: "Start", "Stop", "Reset", "Lap", "Export", "Dark mode"</p>
<span id="voice-commands-status" class="status"></span>
</div>
</div>
<div class="test-section">
<h2>π Export Functionality Tests</h2>
<div class="test-item">
<strong>CSV Export Support:</strong>
<span id="export-support" class="status">Checking...</span>
</div>
<div class="test-item">
<strong>Export Button Visibility:</strong>
<button onclick="testExportVisibility()">Test Export Button</button>
<span id="export-visibility-status" class="status"></span>
</div>
<div class="test-item">
<strong>CSV Generation:</strong>
<button onclick="testCSVGeneration()">Test CSV Creation</button>
<span id="csv-generation-status" class="status"></span>
</div>
</div>
<div class="test-section">
<h2>β¨οΈ Keyboard Shortcuts Tests</h2>
<div class="test-item">
<strong>New Shortcuts:</strong>
<ul>
<li>Press 'E' for Export (when laps available)</li>
<li>Existing shortcuts still work: Space, R, L</li>
</ul>
<span id="keyboard-status" class="status"></span>
</div>
</div>
<div class="test-section">
<h2>πΎ Persistence Tests</h2>
<div class="test-item">
<strong>Voice Preference Storage:</strong>
<button onclick="testVoicePersistence()">Test Voice Persistence</button>
<span id="persistence-status" class="status"></span>
</div>
</div>
<div class="test-section">
<h2>π― Integration Tests</h2>
<div class="test-item">
<strong>Main Stopwatch Integration:</strong>
<a href="index.html" target="_blank">
<button>Open Main Stopwatch</button>
</a>
<p>Test all features in the main application</p>
</div>
</div>
<script>
// Test voice recognition support
function checkVoiceSupport() {
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const status = document.getElementById('voice-support');
if (SpeechRecognition) {
status.textContent = 'β
Supported';
status.className = 'status success';
} else {
status.textContent = 'β Not Supported';
status.className = 'status error';
}
}
// Test export support
function checkExportSupport() {
const status = document.getElementById('export-support');
const link = document.createElement('a');
if (typeof link.download !== 'undefined' && window.Blob) {
status.textContent = 'β
Supported';
status.className = 'status success';
} else {
status.textContent = 'β Not Supported';
status.className = 'status error';
}
}
// Test voice button functionality
function testVoiceButton() {
const status = document.getElementById('voice-button-status');
status.textContent = 'β
Voice button should toggle on/off in main app';
status.className = 'status success';
}
// Test export visibility
function testExportVisibility() {
const status = document.getElementById('export-visibility-status');
status.textContent = 'β
Export button should appear after recording first lap';
status.className = 'status success';
}
// Test CSV generation
function testCSVGeneration() {
const status = document.getElementById('csv-generation-status');
// Simulate CSV creation
const testData = [
['Lap Number', 'Total Time', 'Lap Time', 'Export Date'],
['1', '00:00:05:23', '00:00:05:23', new Date().toLocaleString()],
['2', '00:00:12:45', '00:00:07:22', new Date().toLocaleString()]
];
const csvContent = testData.map(row =>
row.map(cell => `"${cell}"`).join(',')
).join('\n');
if (csvContent.includes('Lap Number') && csvContent.includes('Total Time')) {
status.textContent = 'β
CSV generation working';
status.className = 'status success';
} else {
status.textContent = 'β CSV generation failed';
status.className = 'status error';
}
}
// Test voice persistence
function testVoicePersistence() {
const status = document.getElementById('persistence-status');
// Test localStorage
try {
localStorage.setItem('test-voice', 'true');
const retrieved = localStorage.getItem('test-voice');
localStorage.removeItem('test-voice');
if (retrieved === 'true') {
status.textContent = 'β
localStorage working for voice preferences';
status.className = 'status success';
} else {
status.textContent = 'β localStorage not working';
status.className = 'status error';
}
} catch (e) {
status.textContent = 'β localStorage not available';
status.className = 'status error';
}
}
// Run initial checks
document.addEventListener('DOMContentLoaded', function() {
checkVoiceSupport();
checkExportSupport();
});
// Keyboard shortcut test
document.addEventListener('keydown', function(event) {
const status = document.getElementById('keyboard-status');
if (event.code === 'KeyE') {
status.textContent = 'β
E key detected - Export shortcut working';
status.className = 'status success';
} else if (['Space', 'KeyR', 'KeyL'].includes(event.code)) {
status.textContent = `β
${event.code} detected - Existing shortcuts working`;
status.className = 'status success';
}
});
</script>
</body>
</html>