更新
This commit is contained in:
@@ -669,3 +669,55 @@ def test_shell_directional_controls_have_no_unicode_arrow_text(
|
||||
if hasattr(button, "text") and callable(button.text)
|
||||
for arrow in ("←", "→", "↑", "↓", "▲", "▼", "▴", "▾")
|
||||
)
|
||||
|
||||
|
||||
def test_chat_notification_takes_the_doctor_to_the_matching_workspace(
|
||||
application: QApplication,
|
||||
shell_window: ShellWindow,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
opened: list[Any] = []
|
||||
monkeypatch.setattr(
|
||||
ShellWindow,
|
||||
"open_diagnosis_by_id",
|
||||
lambda self, diagnosis_id, *, modeless=False: opened.append(diagnosis_id),
|
||||
)
|
||||
center = shell_window.chat_notifications
|
||||
assert shell_window.navigate("consultations")
|
||||
|
||||
center.add_notifications(
|
||||
[
|
||||
{
|
||||
"id": "n1",
|
||||
"type": "patient_opened_chat",
|
||||
"patient_name": "甘先生",
|
||||
"created_at": 1787882294,
|
||||
}
|
||||
]
|
||||
)
|
||||
application.processEvents()
|
||||
assert [item.id for item in center.pending] == ["n1"]
|
||||
|
||||
# 患者进入会话 → 直接落到接诊台。
|
||||
next(iter(center._cards.values())).open_button.click()
|
||||
application.processEvents()
|
||||
assert shell_window._active_page_key == "reception"
|
||||
assert center.pending == []
|
||||
|
||||
# 面诊结束 → 打开对应诊单。
|
||||
center.add_notifications(
|
||||
[
|
||||
{
|
||||
"id": "n2",
|
||||
"type": "consultation_complete",
|
||||
"patient_name": "甘先生",
|
||||
"doctor_name": "陈医生",
|
||||
"diagnosis_id": 8169,
|
||||
"created_at": 1787882294,
|
||||
}
|
||||
]
|
||||
)
|
||||
next(iter(center._cards.values())).open_button.click()
|
||||
application.processEvents()
|
||||
assert opened == [8169]
|
||||
assert center.pending == []
|
||||
|
||||
Reference in New Issue
Block a user