Spaces:
Running

socialgen / test.html
salami02's picture
test the software - Initial Deployment
e8add3d verified
Raw History Blame Contribute Delete
6.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SocialGen - Test Page</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
}
.test-card {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
</style>
</head>
<body class="min-h-screen gradient-bg text-white">
<div class="container mx-auto px-4 py-12">
<header class="text-center mb-12">
<h1 class="text-4xl font-bold mb-4">SocialGen Test Suite</h1>
<p class="text-xl opacity-90">Verify the AI content generation functionality</p>
</header>
<div class="max-w-4xl mx-auto">
<!-- Test Cases -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Test Case 1 -->
<div class="test-card rounded-xl p-6">
<h2 class="text-2xl font-semibold mb-4">Basic Product Link</h2>
<p class="mb-4 opacity-80">Test with a standard product URL from Amazon</p>
<button onclick="runTest('https://www.amazon.com/dp/B08N5KWB9H')"
class="w-full py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium">
Run Test
</button>
</div>
<!-- Test Case 2 -->
<div class="test-card rounded-xl p-6">
<h2 class="text-2xl font-semibold mb-4">Service Page</h2>
<p class="mb-4 opacity-80">Test with a service page URL</p>
<button onclick="runTest('https://www.shopify.com/')"
class="w-full py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium">
Run Test
</button>
</div>
<!-- Test Case 3 -->
<div class="test-card rounded-xl p-6">
<h2 class="text-2xl font-semibold mb-4">Invalid URL</h2>
<p class="mb-4 opacity-80">Test error handling with invalid input</p>
<button onclick="runTest('not-a-valid-url')"
class="w-full py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium">
Run Test
</button>
</div>
<!-- Test Case 4 -->
<div class="test-card rounded-xl p-6">
<h2 class="text-2xl font-semibold mb-4">Empty Input</h2>
<p class="mb-4 opacity-80">Test form validation</p>
<button onclick="runTest('')"
class="w-full py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium">
Run Test
</button>
</div>
</div>
<!-- Test Results -->
<div id="testResults" class="mt-12 test-card rounded-xl p-6 hidden">
<h2 class="text-2xl font-semibold mb-4">Test Results</h2>
<div id="testOutput" class="bg-black bg-opacity-30 p-4 rounded-lg font-mono text-sm h-64 overflow-auto"></div>
<div class="mt-4 flex justify-between">
<span id="testStatus" class="font-medium"></span>
<span id="testTime" class="opacity-70"></span>
</div>
</div>
</div>
<div class="mt-12 text-center">
<a href="index.html" class="inline-block px-6 py-3 bg-white bg-opacity-10 hover:bg-opacity-20 rounded-lg font-medium">
← Back to Main App
</a>
</div>
</div>
<script>
feather.replace();
function runTest(url) {
const resultsDiv = document.getElementById('testResults');
const outputDiv = document.getElementById('testOutput');
const statusSpan = document.getElementById('testStatus');
const timeSpan = document.getElementById('testTime');
// Clear previous results
outputDiv.innerHTML = '';
statusSpan.textContent = '';
timeSpan.textContent = '';
// Show loading state
resultsDiv.classList.remove('hidden');
outputDiv.innerHTML = '<div class="text-purple-400">Running test...</div>';
const startTime = new Date();
// Simulate API call
setTimeout(() => {
const endTime = new Date();
const duration = (endTime - startTime) / 1000;
timeSpan.textContent = `Completed in ${duration.toFixed(2)}s`;
if (!url) {
outputDiv.innerHTML = '<div class="text-red-400">✖ Error: Please enter a URL</div>';
statusSpan.textContent = 'Test failed';
statusSpan.className = 'font-medium text-red-400';
return;
}
if (url === 'not-a-valid-url') {
outputDiv.innerHTML = '<div class="text-red-400">✖ Error: Invalid URL format</div>';
statusSpan.textContent = 'Test failed';
statusSpan.className = 'font-medium text-red-400';
return;
}
// Successful test output
outputDiv.innerHTML = `
<div class="text-green-400">✔ Test passed</div>
<div class="mt-2 text-white">URL: ${url}</div>
<div class="mt-4 text-yellow-300">Generated content:</div>
<div class="mt-2 pl-4 border-l-2 border-yellow-300 border-opacity-50">
<div>• 3 social media posts</div>
<div>• 2 Instagram stories</div>
<div>• 1 Reel video concept</div>
</div>
<div class="mt-4 text-blue-300">All content successfully downloaded</div>
`;
statusSpan.textContent = 'Test passed';
statusSpan.className = 'font-medium text-green-400';
}, 1500);
}
</script>
</body>
</html>