feat: add comprehensive testing mechanism for dashboard features
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 2m0s
Run Tests / Backend Tests (push) Failing after 4m26s
Run Tests / Frontend Tests (push) Failing after 49s
Run Tests / Test Summary (push) Failing after 15s
Run Tests / Backend Tests (pull_request) Failing after 6m9s
Run Tests / Frontend Tests (pull_request) Failing after 3m54s
Run Tests / Test Summary (pull_request) Failing after 15s

- Add smoke test script for post-deployment verification
- Add health monitoring script with Telegram alerts
- Add backend integration tests for conversation tracker API
- Add frontend tests to verify correct API paths
- Update CI/CD workflows to enforce test failures and run smoke tests
- Add comprehensive testing documentation

This testing mechanism will catch issues like the double /api/ prefix bug
before they reach users.
This commit is contained in:
Gan, Jimmy
2026-04-19 21:54:13 +08:00
parent 9b8d7cfb00
commit 01fcb53a3a
8 changed files with 801 additions and 0 deletions
+61
View File
@@ -287,3 +287,64 @@ def mock_request():
request.client.host = "192.168.31.100"
request.headers = {}
return request
@pytest.fixture
def mock_conversation_db(tmp_path, monkeypatch):
"""Mock conversation tracker database"""
import sqlite3
db_path = tmp_path / "conversations.db"
# Create minimal SQLite schema
conn = sqlite3.connect(db_path)
conn.execute("""
CREATE TABLE conversations (
session_id TEXT PRIMARY KEY,
project_path TEXT,
started_at DATETIME,
message_count INTEGER,
total_input_tokens INTEGER DEFAULT 0,
total_output_tokens INTEGER DEFAULT 0
)
""")
conn.execute("""
CREATE TABLE messages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT NOT NULL,
message_uuid TEXT UNIQUE NOT NULL,
role TEXT NOT NULL,
content_text TEXT,
timestamp DATETIME NOT NULL
)
""")
conn.execute("""
CREATE TABLE tool_calls (
id INTEGER PRIMARY KEY AUTOINCREMENT,
message_uuid TEXT NOT NULL,
tool_name TEXT NOT NULL,
timestamp DATETIME NOT NULL
)
""")
conn.execute("""
CREATE TABLE daily_summaries (
id INTEGER PRIMARY KEY AUTOINCREMENT,
date TEXT UNIQUE NOT NULL,
summary_content TEXT NOT NULL
)
""")
# Insert test data
conn.execute("""
INSERT INTO conversations VALUES
('test-session-id', '/test/project', '2026-04-19 10:00:00', 10, 1000, 500)
""")
conn.execute("""
INSERT INTO messages VALUES
(1, 'test-session-id', 'msg-1', 'user', 'test message', '2026-04-19 10:00:00')
""")
conn.commit()
conn.close()
monkeypatch.setenv("CONVERSATION_TRACKER_DB", str(db_path))
return db_path