|
|
import unittest |
|
|
from unittest.mock import patch, MagicMock |
|
|
import sys |
|
|
import os |
|
|
|
|
|
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'src')) |
|
|
|
|
|
|
|
|
class TestChatbotFrontend(unittest.TestCase): |
|
|
|
|
|
def test_html_structure(self): |
|
|
"""Test that the HTML file exists and has the expected structure""" |
|
|
html_path = os.path.join(os.path.dirname(__file__), '..', 'src', 'static', 'index.html') |
|
|
self.assertTrue(os.path.exists(html_path), "Frontend HTML file should exist") |
|
|
|
|
|
with open(html_path, 'r') as f: |
|
|
content = f.read() |
|
|
|
|
|
|
|
|
self.assertIn('<html', content, "Should have HTML tag") |
|
|
self.assertIn('<head', content, "Should have head section") |
|
|
self.assertIn('<body', content, "Should have body section") |
|
|
self.assertIn('chat-container', content, "Should have chat container") |
|
|
self.assertIn('chat-messages', content, "Should have messages container") |
|
|
self.assertIn('user-input', content, "Should have user input field") |
|
|
self.assertIn('send-button', content, "Should have send button") |
|
|
|
|
|
|
|
|
self.assertIn('citation', content, "Should have citation styling") |
|
|
|
|
|
|
|
|
self.assertIn('viewport', content, "Should have viewport meta tag for responsiveness") |
|
|
|
|
|
|
|
|
self.assertIn('addEventListener', content, "Should have event listeners") |
|
|
self.assertIn('fetch', content, "Should have API fetch functionality") |
|
|
self.assertIn('conversation_history', content, "Should track conversation history") |
|
|
|
|
|
if __name__ == '__main__': |
|
|
unittest.main() |
|
|
|