Mirrored from https://github.com/davoodmehraban89/Aram.git
Synced Dec 3, 18:15 UTC
test(desktop): run five real statement engines through native Windows success UI
davoodmehraban89 committed
Oct 31, 2026 at 18:36 UTC
04397f8ad6c329d1f16d0e2d41981f57be43426d
1 file changed
+39
backend/tests/test_desktop_five_statement.py
+39
@@ -3,6 +3,8 @@ from __future__ import annotations
3
4
from hashlib import sha256
5
import json
6
+import sys
7
+import time
8
9
import pytest
10
@@ -186,3 +188,40 @@ def test_headless_executable_smoke_and_all_enabled_actions_have_methods():
188
}
189
for key, method in ACTIONS.items():
190
assert callable(getattr(FiveStatementWindow, method)), key
191
+
192
+
193
+@pytest.mark.skipif(sys.platform != "win32", reason="Native Tk smoke requires Windows runner")
194
+def test_native_window_shows_real_successful_five_statement_result(tmp_path):
195
+ paths = fixtures(tmp_path)
196
+ file_names = {"workbook": str(paths[0]), "manifest": str(paths[1])}
197
+ window = FiveStatementWindow(picker=lambda kind: file_names[kind])
198
+ try:
199
+ window.withdraw()
200
+ window.update_idletasks()
201
+ assert str(window.run_button.cget("state")) == "disabled"
202
+ window.workbook_button.invoke()
203
+ window.manifest_button.invoke()
204
+ assert str(window.run_button.cget("state")) == "normal"
205
+ window.run_button.invoke()
206
+ for _ in range(500):
207
+ window.update()
208
+ if not window._busy:
209
+ break
210
+ time.sleep(0.02)
211
+ assert not window._busy
212
+ assert window.controller.state == "ELIGIBLE"
213
+ assert window.controller.result is not None
214
+ assert window.controller.result.eligible_for_analyst_review
215
+ rows = window.outcome_tree.get_children()
216
+ assert len(rows) == 5
217
+ assert all(
218
+ window.outcome_tree.item(row, "values")[1] == "قابل بررسی"
219
+ for row in rows
220
+ )
221
+ window.clear_button.invoke()
222
+ assert not window.outcome_tree.get_children()
223
+ assert window.controller.result is None
224
+ assert str(window.run_button.cget("state")) == "disabled"
225
+ finally:
226
+ if window.winfo_exists():
227
+ window.destroy()