Skip to content

Commit 5c31d1d

Browse files
Copilotfderuiter
andauthored
Refine setup wizard UX spec rendering and tests
Co-authored-by: fderuiter <127706008+fderuiter@users.noreply.github.com>
1 parent 4f0d3fb commit 5c31d1d

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

packages/plugins-streamlit/src/imednet_streamlit/pages/setup_wizard.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"Export / Save",
2828
)
2929

30-
_STATE_TRANSITION_DIAGRAM = """```text
31-
[Step 1: Scan & Profile]
30+
_STATE_TRANSITION_DIAGRAM = """[Step 1: Scan & Profile]
3231
├─ Scan button → discovered_schema, validation_report=None
3332
└─ Next (enabled when forms discovered) → Step 2
3433
@@ -57,7 +56,7 @@
5756
Global transitions:
5857
- Numbered nav buttons jump to any step (1..5)
5958
- wizard_step is clamped to range 1..5 on every transition
60-
```"""
59+
"""
6160

6261
_SESSION_STATE_WIREFRAME = "\n".join(
6362
[
@@ -119,7 +118,7 @@
119118
def _render_design_specification() -> None:
120119
st.markdown("### Wizard UX design specification")
121120
st.markdown("#### Flowchart / state transitions")
122-
st.markdown(_STATE_TRANSITION_DIAGRAM)
121+
st.code(_STATE_TRANSITION_DIAGRAM, language="text")
123122
st.markdown("#### Wireframe mapped to session state")
124123
st.markdown(_SESSION_STATE_WIREFRAME)
125124
st.markdown("#### UX review: Streamlit multi-page alignment")
@@ -555,7 +554,8 @@ def _step_export(study_key: str) -> None:
555554

556555
def render_page() -> None:
557556
st.title("🧭 Study Setup Wizard")
558-
_render_design_specification()
557+
with st.expander("UX Design Specification", expanded=False):
558+
_render_design_specification()
559559

560560
if not st.session_state.get("_imednet_connected"):
561561
st.info("Please connect from the sidebar to configure and publish a study mapping.")

tests/unit/streamlit/test_pages_setup_wizard.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ def metric(self, label: str, value: Any, **kwargs: Any) -> None:
2929
self._parent.metric(label, value, **kwargs)
3030

3131

32+
class _FakeContextManager:
33+
def __enter__(self) -> "_FakeContextManager":
34+
return self
35+
36+
def __exit__(self, exc_type: Any, exc: Any, tb: Any) -> None:
37+
return None
38+
39+
3240
class _FakeStreamlit:
3341
def __init__(self) -> None:
3442
self.session_state: dict[str, Any] = {
@@ -48,6 +56,8 @@ def __init__(self) -> None:
4856
self.error_calls: list[str] = []
4957
self.titles: list[str] = []
5058
self.markdown_calls: list[str] = []
59+
self.code_calls: list[str] = []
60+
self.expander_calls: list[tuple[str, bool]] = []
5161

5262
def title(self, value: str) -> None:
5363
self.titles.append(value)
@@ -61,6 +71,13 @@ def markdown(self, value: str) -> None:
6171
def caption(self, value: str) -> None:
6272
return None
6373

74+
def expander(self, label: str, *, expanded: bool = False) -> _FakeContextManager:
75+
self.expander_calls.append((label, expanded))
76+
return _FakeContextManager()
77+
78+
def code(self, body: str, *, language: str = "") -> None:
79+
self.code_calls.append(body)
80+
6481
def progress(self, value: float) -> None:
6582
return None
6683

@@ -143,6 +160,8 @@ def _run_setup_wizard(
143160
"subheader",
144161
"markdown",
145162
"caption",
163+
"expander",
164+
"code",
146165
"progress",
147166
"success",
148167
"warning",
@@ -267,6 +286,8 @@ def test_setup_wizard_renders_design_specification_sections() -> None:
267286
_run_setup_wizard(fake_st)
268287

269288
joined_markdown = "\n".join(fake_st.markdown_calls)
289+
assert ("UX Design Specification", False) in fake_st.expander_calls
290+
assert any("Step 1: Scan & Profile" in body for body in fake_st.code_calls)
270291
assert "Flowchart / state transitions" in joined_markdown
271292
assert "Wireframe mapped to session state" in joined_markdown
272293
assert "UX review: Streamlit multi-page alignment" in joined_markdown

0 commit comments

Comments
 (0)