Files
BreakEscape/test-password-minigame.html

292 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Minigame Test</title>
<!-- Include the game's CSS -->
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/minigames-framework.css">
<link rel="stylesheet" href="css/password-minigame.css">
<link rel="stylesheet" href="css/notifications.css">
<style>
body {
background: #1a1a1a;
color: white;
font-family: 'Press Start 2P', monospace;
margin: 0;
padding: 20px;
}
.test-container {
max-width: 800px;
margin: 0 auto;
}
.test-section {
margin: 20px 0;
padding: 20px;
border: 2px solid #444;
border-radius: 10px;
background: #2a2a2a;
}
.test-button {
background: #3498db;
color: white;
border: none;
padding: 12px 24px;
border-radius: 5px;
cursor: pointer;
font-family: 'Press Start 2P', monospace;
font-size: 10px;
margin: 5px;
transition: background 0.3s ease;
}
.test-button:hover {
background: #2980b9;
}
.test-button.success {
background: #2ecc71;
}
.test-button.success:hover {
background: #27ae60;
}
.test-button.warning {
background: #f39c12;
}
.test-button.warning:hover {
background: #e67e22;
}
.test-button.danger {
background: #e74c3c;
}
.test-button.danger:hover {
background: #c0392b;
}
.test-description {
font-size: 8px;
color: #ccc;
margin-bottom: 10px;
line-height: 1.4;
}
.test-results {
margin-top: 20px;
padding: 15px;
background: #1a1a1a;
border-radius: 5px;
border: 1px solid #444;
}
.test-results h3 {
color: #00ff00;
margin-top: 0;
}
.test-results pre {
background: #0a0a0a;
padding: 10px;
border-radius: 3px;
overflow-x: auto;
font-size: 8px;
}
</style>
</head>
<body>
<div class="test-container">
<h1>Password Minigame Test Suite</h1>
<p>Test the new password minigame with various configurations and options.</p>
<!-- Basic Password Test -->
<div class="test-section">
<h2>Basic Password Test</h2>
<div class="test-description">
Test basic password entry with show/hide functionality. Password: "secret123"
</div>
<button class="test-button success" onclick="testBasicPassword()">Test Basic Password</button>
</div>
<!-- Password with Hint -->
<div class="test-section">
<h2>Password with Hint (Desktop Background)</h2>
<div class="test-description">
Test password entry with hint button inside monitor bezel with desktop wallpaper. Password: "admin"<br>
Hint: "The default administrator password"
</div>
<button class="test-button warning" onclick="testPasswordWithHint()">Test Password with Hint</button>
</div>
<!-- Password with Onscreen Keyboard -->
<div class="test-section">
<h2>Password with Onscreen Keyboard (with Shift)</h2>
<div class="test-description">
Test password entry with onscreen QWERTY keyboard including shift key for caps. Password: "Keyboard"
</div>
<button class="test-button" onclick="testPasswordWithKeyboard()">Test Password with Keyboard</button>
</div>
<!-- Full Featured Password -->
<div class="test-section">
<h2>Full Featured Password</h2>
<div class="test-description">
Test password with all features: hint, keyboard, and custom attempts. Password: "fulltest"<br>
Hint: "A complete test of all features"
</div>
<button class="test-button" onclick="testFullFeaturedPassword()">Test Full Featured Password</button>
</div>
<!-- Password with Post-it Note -->
<div class="test-section">
<h2>Password with Post-it Note</h2>
<div class="test-description">
Test password with post-it note on desktop. Password: "postit"<br>
Post-it: "Password is written on the sticky note!"
</div>
<button class="test-button" onclick="testPasswordWithPostit()">Test Password with Post-it</button>
</div>
<!-- Wrong Password Test -->
<div class="test-section">
<h2>Wrong Password Test</h2>
<div class="test-description">
Test entering wrong passwords to trigger failure scenarios. Try: "wrong", "incorrect", "fail"
</div>
<button class="test-button danger" onclick="testWrongPassword()">Test Wrong Password</button>
</div>
<!-- Test Results -->
<div class="test-results">
<h3>Test Results</h3>
<pre id="test-results">Click a test button to see results here...</pre>
</div>
</div>
<!-- Include the minigame framework -->
<script type="module">
// Import the minigame framework and password minigame
import { MinigameFramework } from './js/minigames/framework/minigame-manager.js';
import { PasswordMinigame } from './js/minigames/password/password-minigame.js';
// Initialize the framework
window.MinigameFramework = MinigameFramework;
MinigameFramework.registerScene('password', PasswordMinigame);
// Mock game alert function
window.gameAlert = function(message, type, title, duration) {
console.log(`[${type.toUpperCase()}] ${title}: ${message}`);
updateTestResults(`[${type.toUpperCase()}] ${title}: ${message}`);
};
// Test functions
window.testBasicPassword = function() {
updateTestResults("Starting basic password test...");
MinigameFramework.startMinigame('password', null, {
title: 'Basic Password Test',
password: 'secret123',
showHint: false,
showKeyboard: false,
maxAttempts: 3,
onComplete: (success, result) => {
updateTestResults(`Basic password test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
window.testPasswordWithHint = function() {
updateTestResults("Starting password with hint test...");
MinigameFramework.startMinigame('password', null, {
title: 'Password with Hint Test',
password: 'admin',
passwordHint: 'The default administrator password',
showHint: true,
showKeyboard: false,
maxAttempts: 3,
onComplete: (success, result) => {
updateTestResults(`Password with hint test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
window.testPasswordWithKeyboard = function() {
updateTestResults("Starting password with keyboard test (try using shift key for caps)...");
MinigameFramework.startMinigame('password', null, {
title: 'Password with Keyboard Test',
password: 'Keyboard',
showHint: false,
showKeyboard: true,
maxAttempts: 3,
onComplete: (success, result) => {
updateTestResults(`Password with keyboard test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
window.testFullFeaturedPassword = function() {
updateTestResults("Starting full featured password test...");
MinigameFramework.startMinigame('password', null, {
title: 'Full Featured Password Test',
password: 'fulltest',
passwordHint: 'A complete test of all features',
showHint: true,
showKeyboard: true,
maxAttempts: 5,
onComplete: (success, result) => {
updateTestResults(`Full featured password test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
window.testWrongPassword = function() {
updateTestResults("Starting wrong password test...");
MinigameFramework.startMinigame('password', null, {
title: 'Wrong Password Test',
password: 'correct',
showHint: false,
showKeyboard: false,
maxAttempts: 3,
onComplete: (success, result) => {
updateTestResults(`Wrong password test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
window.testPasswordWithPostit = function() {
updateTestResults("Starting password with post-it test...");
MinigameFramework.startMinigame('password', null, {
title: 'Password with Post-it Test',
password: 'postit',
showHint: false,
showKeyboard: false,
maxAttempts: 3,
postitNote: 'Password is written on the sticky note!',
showPostit: true,
onComplete: (success, result) => {
updateTestResults(`Password with post-it test completed. Success: ${success}, Result: ${JSON.stringify(result)}`);
}
});
};
function updateTestResults(message) {
const resultsElement = document.getElementById('test-results');
const timestamp = new Date().toLocaleTimeString();
resultsElement.textContent += `[${timestamp}] ${message}\n`;
resultsElement.scrollTop = resultsElement.scrollHeight;
}
// Initialize test results
updateTestResults("Password minigame test suite loaded and ready.");
</script>
</body>
</html>