fix & feat: resolve user reports #1 through #8 (TTS voice & speed, modals, scrollbar, CEFR hint, SRS grammar exclusion, global word lookup)
This commit is contained in:
1 parent
8cffae46fa
commit
7871191c90
12 files changed
+443
-103
No files matched your search
+61
-54
@@ -2572,67 +2572,74 @@ def test_feedback_endpoints_workflow():
|
||||
login_resp = client.post("/api/login", json={"username": "testadmin", "password": "testpass12345"})
|
||||
assert login_resp.status_code == 200
|
||||
|
||||
# 3. Create a bug report
|
||||
bug_payload = {
|
||||
"category": "bug",
|
||||
"message": "Кнопка в читалке не нажимается на мобилке",
|
||||
"context_url": "#reader/book/1/ch/2",
|
||||
"context_data": {"screen": "390x844", "device": "Mobile"}
|
||||
}
|
||||
create_resp = client.post("/api/feedback", json=bug_payload)
|
||||
assert create_resp.status_code == 201
|
||||
c_data = create_resp.json()
|
||||
assert c_data["ok"] is True
|
||||
report_id = c_data["id"]
|
||||
assert c_data["category"] == "bug"
|
||||
assert c_data["status"] == "new"
|
||||
try:
|
||||
# 3. Create a bug report
|
||||
bug_payload = {
|
||||
"category": "bug",
|
||||
"message": "Кнопка в читалке не нажимается на мобилке",
|
||||
"context_url": "#reader/book/1/ch/2",
|
||||
"context_data": {"screen": "390x844", "device": "Mobile"}
|
||||
}
|
||||
create_resp = client.post("/api/feedback", json=bug_payload)
|
||||
assert create_resp.status_code == 201
|
||||
c_data = create_resp.json()
|
||||
assert c_data["ok"] is True
|
||||
report_id = c_data["id"]
|
||||
assert c_data["category"] == "bug"
|
||||
assert c_data["status"] == "new"
|
||||
|
||||
# 4. Create a feature request
|
||||
feat_payload = {
|
||||
"category": "feature",
|
||||
"message": "Добавить темную тему OLED",
|
||||
"context_url": "#reader",
|
||||
"context_data": {"screen": "1920x1080", "device": "Desktop"}
|
||||
}
|
||||
create_resp2 = client.post("/api/feedback", json=feat_payload)
|
||||
assert create_resp2.status_code == 201
|
||||
report_id2 = create_resp2.json()["id"]
|
||||
# 4. Create a feature request
|
||||
feat_payload = {
|
||||
"category": "feature",
|
||||
"message": "Добавить темную тему OLED",
|
||||
"context_url": "#reader",
|
||||
"context_data": {"screen": "1920x1080", "device": "Desktop"}
|
||||
}
|
||||
create_resp2 = client.post("/api/feedback", json=feat_payload)
|
||||
assert create_resp2.status_code == 201
|
||||
report_id2 = create_resp2.json()["id"]
|
||||
|
||||
# 5. List reports
|
||||
list_resp = client.get("/api/feedback")
|
||||
assert list_resp.status_code == 200
|
||||
reports = list_resp.json()
|
||||
assert len(reports) >= 2
|
||||
r_ids = [r["id"] for r in reports]
|
||||
assert report_id in r_ids
|
||||
assert report_id2 in r_ids
|
||||
# 5. List reports
|
||||
list_resp = client.get("/api/feedback")
|
||||
assert list_resp.status_code == 200
|
||||
reports = list_resp.json()
|
||||
assert len(reports) >= 2
|
||||
r_ids = [r["id"] for r in reports]
|
||||
assert report_id in r_ids
|
||||
assert report_id2 in r_ids
|
||||
|
||||
# 6. Filter by category
|
||||
bugs_resp = client.get("/api/feedback?category=bug")
|
||||
assert bugs_resp.status_code == 200
|
||||
assert all(r["category"] == "bug" for r in bugs_resp.json())
|
||||
# 6. Filter by category
|
||||
bugs_resp = client.get("/api/feedback?category=bug")
|
||||
assert bugs_resp.status_code == 200
|
||||
assert all(r["category"] == "bug" for r in bugs_resp.json())
|
||||
|
||||
# 7. Update status to resolved
|
||||
patch_resp = client.patch(f"/api/feedback/{report_id}", json={"status": "resolved"})
|
||||
assert patch_resp.status_code == 200
|
||||
assert patch_resp.json()["status"] == "resolved"
|
||||
# 7. Update status to resolved
|
||||
patch_resp = client.patch(f"/api/feedback/{report_id}", json={"status": "resolved"})
|
||||
assert patch_resp.status_code == 200
|
||||
assert patch_resp.json()["status"] == "resolved"
|
||||
|
||||
# Verify updated
|
||||
get_updated = client.get("/api/feedback?status=resolved")
|
||||
assert get_updated.status_code == 200
|
||||
assert any(r["id"] == report_id and r["status"] == "resolved" for r in get_updated.json())
|
||||
# Verify updated
|
||||
get_updated = client.get("/api/feedback?status=resolved")
|
||||
assert get_updated.status_code == 200
|
||||
assert any(r["id"] == report_id and r["status"] == "resolved" for r in get_updated.json())
|
||||
|
||||
# 8. Delete report
|
||||
del_resp = client.delete(f"/api/feedback/{report_id2}")
|
||||
assert del_resp.status_code == 200
|
||||
assert del_resp.json()["ok"] is True
|
||||
# 8. Delete report
|
||||
del_resp = client.delete(f"/api/feedback/{report_id2}")
|
||||
assert del_resp.status_code == 200
|
||||
assert del_resp.json()["ok"] is True
|
||||
|
||||
# 9. Verify markdown sync file exists and has content
|
||||
reports_md = Path("/home/ai-projects/memory/USER_REPORTS.md")
|
||||
assert reports_md.exists()
|
||||
content = reports_md.read_text(encoding="utf-8")
|
||||
assert "Пользовательские репорты" in content
|
||||
assert "Кнопка в читалке не нажимается" in content
|
||||
# 9. Verify markdown sync file exists and has content
|
||||
reports_md = Path("/home/ai-projects/memory/USER_REPORTS.md")
|
||||
assert reports_md.exists()
|
||||
content = reports_md.read_text(encoding="utf-8")
|
||||
assert "Пользовательские репорты" in content
|
||||
assert "Кнопка в читалке не нажимается" in content
|
||||
finally:
|
||||
try:
|
||||
from scripts.sync_reports import sync
|
||||
sync()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user