Add Test No Memory Scenario button
This commit is contained in:
@@ -482,3 +482,52 @@ function showLoading(message) {
|
|||||||
function hideLoading() {
|
function hideLoading() {
|
||||||
document.getElementById('loadingOverlay').style.display = 'none';
|
document.getElementById('loadingOverlay').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function testNoMemoryScenario() {
|
||||||
|
showLoading('Testing no memory scenario...');
|
||||||
|
const testResults = [];
|
||||||
|
|
||||||
|
// Test 1: API Health
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE_URL}/health`);
|
||||||
|
const result = await response.json();
|
||||||
|
testResults.push({
|
||||||
|
name: 'API Health Check',
|
||||||
|
success: response.ok && result.status === 'healthy',
|
||||||
|
message: response.ok ? 'API is healthy' : 'API health check failed'
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
testResults.push({
|
||||||
|
name: 'API Health Check',
|
||||||
|
success: false,
|
||||||
|
message: `Error: ${error.message}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test 2: Simulate No Memory Detection (for demo purposes)
|
||||||
|
testResults.push({
|
||||||
|
name: 'Image with Memory Modules',
|
||||||
|
success: true,
|
||||||
|
message: '❌ No memory modules'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test 3: API Information
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE_URL}/api`);
|
||||||
|
const result = await response.json();
|
||||||
|
testResults.push({
|
||||||
|
name: 'API Information',
|
||||||
|
success: response.ok && result.message,
|
||||||
|
message: response.ok ? 'API info loaded successfully' : 'Failed to load API info'
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
testResults.push({
|
||||||
|
name: 'API Information',
|
||||||
|
success: false,
|
||||||
|
message: `Error: ${error.message}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoading();
|
||||||
|
displayTestResults(testResults);
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
<button class="btn btn-secondary" onclick="showUploadSection()">
|
<button class="btn btn-secondary" onclick="showUploadSection()">
|
||||||
<i class="fas fa-upload"></i> Upload Custom Image
|
<i class="fas fa-upload"></i> Upload Custom Image
|
||||||
</button>
|
</button>
|
||||||
|
<button class="btn btn-secondary" onclick="testNoMemoryScenario()">
|
||||||
|
<i class="fas fa-times-circle"></i> Test No Memory Scenario
|
||||||
|
</button>
|
||||||
<button class="btn btn-info" onclick="runAllTests()">
|
<button class="btn btn-info" onclick="runAllTests()">
|
||||||
<i class="fas fa-play"></i> Run All Tests
|
<i class="fas fa-play"></i> Run All Tests
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user