F4RUKYLDRM commited on
Commit
72c0d0b
·
1 Parent(s): 31376a7

Redesign workbench dashboard shell

Browse files
.gitignore CHANGED
@@ -5,3 +5,4 @@ __pycache__/
5
  *.zip
6
  *.csv
7
  !tests/fixtures/*.csv
 
 
5
  *.zip
6
  *.csv
7
  !tests/fixtures/*.csv
8
+ design_handoff_workbench_redesign/
app.py CHANGED
The diff for this file is too large to render. See raw diff
 
biolmnet/ui/__init__.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ """Pure-presentation UI helpers for the BioLM-NET Workbench.
2
+
3
+ Nothing in this package touches the scientific core (``biolmnet.model``,
4
+ ``biolmnet.data``, ``biolmnet.training``, ``biolmnet.artifacts``). It only
5
+ builds the CSS and HTML fragments ``app.py`` renders around that logic.
6
+ """
7
+
8
+ from . import components # noqa: F401
9
+ from .styles import CSS # noqa: F401
biolmnet/ui/components.py ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """HTML builders for the Workbench shell.
2
+
3
+ Every function here returns a plain HTML string for a ``gr.HTML`` component.
4
+ They only format data already produced by ``biolmnet.data`` /
5
+ ``biolmnet.training`` / ``biolmnet.artifacts`` — none of them compute
6
+ anything scientific.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import html
12
+ from typing import Iterable, Sequence
13
+
14
+ esc = html.escape
15
+
16
+ CORNER_MARKS = (
17
+ '<i class="corner tl"></i><i class="corner tr"></i>'
18
+ '<i class="corner bl"></i><i class="corner br"></i>'
19
+ )
20
+
21
+
22
+ def blueprint_div(inner_html: str, *, extra_class: str = "", style: str = "") -> str:
23
+ """Wrap ``inner_html`` in a blueprint frame (hairline border + corner marks)."""
24
+ cls = f"blueprint {extra_class}".strip()
25
+ style_attr = f' style="{style}"' if style else ""
26
+ return f'<div class="{cls}"{style_attr}>{CORNER_MARKS}{inner_html}</div>'
27
+
28
+
29
+ # ── rail ─────────────────────────────────────────────────────────────────
30
+
31
+ def brand_block_html() -> str:
32
+ return (
33
+ '<div class="rail-brand"><span class="name">BioLM-NET</span>'
34
+ '<div class="mono" style="margin-top:5px">Workbench</div></div>'
35
+ '<div class="mono rail-kicker">Workflow</div>'
36
+ )
37
+
38
+
39
+ def rail_row_html(number: int, label: str, state: str, status_word: str) -> str:
40
+ """One workflow rail row. ``state`` is one of done/on/next/off."""
41
+ return (
42
+ f'<div class="rr {state}">'
43
+ f'<span class="rn">{number:02d}</span>'
44
+ f'<span class="lb">{esc(label)}</span>'
45
+ f'<span class="st">{esc(status_word)}</span>'
46
+ f"</div>"
47
+ )
48
+
49
+
50
+ def kv_row(key: str, value: str, tone: str | None = None) -> str:
51
+ cls = f"num {tone}" if tone else "num"
52
+ return f'<div class="kv"><span>{esc(key)}</span><span class="{cls}">{esc(value)}</span></div>'
53
+
54
+
55
+ def run_state_plate(rows: Sequence[tuple[str, str, str | None]]) -> str:
56
+ """``rows``: (key, value, tone) where tone is None/accent/error/muted."""
57
+ inner = "".join(kv_row(k, v, tone) for k, v, tone in rows)
58
+ return blueprint_div(inner, extra_class="plate")
59
+
60
+
61
+ def kv_plain_row(key: str, value: str, *, last: bool = False) -> str:
62
+ cls = "kv-plain last" if last else "kv-plain"
63
+ return f'<div class="{cls}"><span>{esc(key)}</span><span class="num">{esc(value)}</span></div>'
64
+
65
+
66
+ def footnote_html(line1: str, line2: str) -> str:
67
+ return f'<div class="rail-footnote">{esc(line1)}<br>{esc(line2)}</div>'
68
+
69
+
70
+ # ── topbar / page head ──────────────────────────────────────────────────
71
+
72
+ def topbar_html(stage_no: int, total: int, stage_name: str, session_id: str, right_text: str) -> str:
73
+ # Only the left "STAGE 0n / 05" label is uppercase; the session/device
74
+ # note on the right stays mixed-case (a lowercase-hex session id reading
75
+ # upper-cased is just noise).
76
+ return (
77
+ '<div class="topbar">'
78
+ f'<div class="mono">Stage {stage_no:02d} / {total:02d} — {esc(stage_name)}</div>'
79
+ f'<div class="num" style="font-size:9.5px;letter-spacing:.04em;color:var(--color-muted-2)">'
80
+ f"Session {esc(session_id)} · {esc(right_text)}</div>"
81
+ "</div>"
82
+ )
83
+
84
+
85
+ def title_block_html(title: str, description: str) -> str:
86
+ return f"<h2>{esc(title)}</h2>" f'<div class="desc">{esc(description)}</div>'
87
+
88
+
89
+ def mono_meta_html(lines: Iterable[str], *, align_right: bool = True) -> str:
90
+ align = "text-align:right;" if align_right else ""
91
+ body = "<br>".join(esc(line) for line in lines)
92
+ return f'<div class="mono" style="{align}font-size:9.5px;line-height:1.7">{body}</div>'
93
+
94
+
95
+ # ── stat plates ──────────────────────────────────────────────────────────
96
+
97
+ def stat_plate(value: str, label: str, *, label_first: bool = False) -> str:
98
+ if label_first:
99
+ inner = f'<div class="k">{esc(label)}</div><div class="v">{esc(value)}</div>'
100
+ else:
101
+ inner = f'<div class="v">{esc(value)}</div><div class="k">{esc(label)}</div>'
102
+ return blueprint_div(inner, extra_class="stat")
103
+
104
+
105
+ def mini_stat_html(value: str, label: str) -> str:
106
+ """A label+value pair with no frame of its own (used inside a shared blueprint panel)."""
107
+ return (
108
+ f'<div><div class="mono" style="font-size:9px">{esc(label)}</div>'
109
+ f'<div style="font:600 26px/1.1 var(--font-heading)">{esc(value)}</div></div>'
110
+ )
111
+
112
+
113
+ # ── bars ─────────────────────────────────────────────────────────────────
114
+
115
+ def bar_cell(pct: float, *, height: int = 8) -> str:
116
+ pct = max(0.0, min(100.0, pct))
117
+ return f'<div class="bar" style="height:{height}px"><i style="width:{pct:.1f}%"></i></div>'
118
+
119
+
120
+ def labeled_bar_row(
121
+ label: str, pct: float, value_text: str, *, label_width: int = 78, bar_height: int = 12, value_width: int = 52
122
+ ) -> str:
123
+ return (
124
+ '<div style="display:flex;align-items:center;gap:10px">'
125
+ f'<span style="width:{label_width}px;font-size:12px">{esc(label)}</span>'
126
+ f"{bar_cell(pct, height=bar_height)}"
127
+ f'<span class="num" style="width:{value_width}px;text-align:right">{esc(value_text)}</span>'
128
+ "</div>"
129
+ )
130
+
131
+
132
+ # ── tables ───────────────────────────────────────────────────────────────
133
+
134
+ def table_html(
135
+ headers: Sequence[str],
136
+ rows: Sequence[Sequence[str]],
137
+ *,
138
+ aligns: Sequence[str] | None = None,
139
+ numeric_cols: Sequence[bool] | None = None,
140
+ widths: Sequence[str | None] | None = None,
141
+ ) -> str:
142
+ """Build a ``.tbl`` table. Cell values are raw HTML — escape plain text
143
+ with :data:`esc` before passing it in."""
144
+ n_cols = len(headers)
145
+ aligns = list(aligns) if aligns else ["left"] * n_cols
146
+ numeric_cols = list(numeric_cols) if numeric_cols else [False] * n_cols
147
+ widths = list(widths) if widths else [None] * n_cols
148
+
149
+ head_cells = []
150
+ for header, align, width in zip(headers, aligns, widths):
151
+ style_parts = []
152
+ if width:
153
+ style_parts.append(f"width:{width}")
154
+ if align == "right":
155
+ style_parts.append("text-align:right")
156
+ attr = f' style="{";".join(style_parts)}"' if style_parts else ""
157
+ head_cells.append(f"<th{attr}>{esc(header)}</th>")
158
+
159
+ body_rows = []
160
+ for row in rows:
161
+ cells = []
162
+ for value, align, numeric in zip(row, aligns, numeric_cols):
163
+ cls_attr = ' class="n"' if numeric else ""
164
+ style_attr = ' style="text-align:right"' if align == "right" else ""
165
+ cells.append(f"<td{cls_attr}{style_attr}>{value}</td>")
166
+ body_rows.append(f"<tr>{''.join(cells)}</tr>")
167
+
168
+ return (
169
+ '<table class="tbl"><thead><tr>'
170
+ + "".join(head_cells)
171
+ + "</tr></thead><tbody>"
172
+ + "".join(body_rows)
173
+ + "</tbody></table>"
174
+ )
175
+
176
+
177
+ def confusion_matrix_html(matrix, labels: Sequence[str]) -> str:
178
+ """A tinted CSS grid confusion matrix (rows true, columns predicted)."""
179
+ n = len(labels)
180
+ row_totals = [max(sum(row), 1) for row in matrix]
181
+
182
+ def cell_style(row_index: int, count: float) -> str:
183
+ ratio = count / row_totals[row_index]
184
+ if ratio >= 0.7:
185
+ return "background:var(--color-accent-800);color:#f2f2f3"
186
+ if ratio >= 0.4:
187
+ return "background:var(--color-accent-700);color:#f2f2f3"
188
+ if ratio >= 0.15:
189
+ return "background:var(--color-accent-200)"
190
+ return "background:var(--color-accent-100)"
191
+
192
+ header_cells = "".join(
193
+ f'<div class="mono" style="font-size:8.5px;text-align:center">{esc(label)}</div>' for label in labels
194
+ )
195
+ row_label_cells = "".join(
196
+ f'<div class="mono" style="font-size:8.5px;display:grid;align-items:center">{esc(label)}</div>'
197
+ for label in labels
198
+ )
199
+ body_cells = "".join(
200
+ f'<div style="{cell_style(i, matrix[i][j])}">{int(matrix[i][j])}</div>'
201
+ for i in range(n)
202
+ for j in range(n)
203
+ )
204
+ return (
205
+ '<div style="display:grid;grid-template-columns:56px 1fr;gap:8px">'
206
+ "<div></div>"
207
+ f'<div style="display:grid;grid-template-columns:repeat({n},1fr);gap:2px">{header_cells}</div>'
208
+ f'<div style="display:grid;gap:2px">{row_label_cells}</div>'
209
+ f'<div class="cm" style="--cm-n:{n}">{body_cells}</div>'
210
+ "</div>"
211
+ )
212
+
213
+
214
+ # ── status / validation strips ───────────────────────────────────────────
215
+
216
+ def simple_status_html(message_html: str, *, error: bool = False) -> str:
217
+ cls = "error" if error else "status"
218
+ return f'<div class="strip {cls}"><div class="strip-body" style="flex:1">{message_html}</div></div>'
219
+
220
+
221
+ def strip_text_html(kicker: str, message: str) -> str:
222
+ """The text half of a bordered strip; pair with a real ``gr.Button`` in the
223
+ same ``elem_classes=["strip", ...]`` row for the ghost action."""
224
+ return f'<div class="strip-kicker">{esc(kicker)}</div><div class="strip-body">{esc(message)}</div>'
225
+
226
+
227
+ def empty_note_html(message: str) -> str:
228
+ return f'<div class="empty-note">{esc(message)}</div>'
229
+
230
+
231
+ # ── misc ─────────────────────────────────────────────────────────────────
232
+
233
+ def human_bytes(n: float) -> str:
234
+ n = float(n)
235
+ for unit in ("B", "KB", "MB"):
236
+ if n < 1024 or unit == "MB":
237
+ return f"{int(n)} {unit}" if unit == "B" else f"{n:.1f} {unit}"
238
+ n /= 1024
239
+ return f"{n / 1024:.1f} GB"
biolmnet/ui/styles.py ADDED
@@ -0,0 +1,540 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CSS for the BioLM-NET Workbench, translating the "Industry" design system
2
+ (``_ds/industry-…/styles.css`` in the design handoff bundle) onto Gradio's
3
+ Blocks DOM. Tokens, spacing and component shapes are taken from the design
4
+ system; selectors are written against Gradio's real markup (native inputs,
5
+ the ``primary``/``secondary`` button variant classes, ``:has()`` on real
6
+ ``<label>``/``<input>`` pairs) rather than any custom component.
7
+ """
8
+
9
+ CSS = """
10
+ @import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
11
+
12
+ :root {
13
+ --color-bg: #f2f2f3;
14
+ --color-surface: #e9e9ea;
15
+ --color-text: #1d1f20;
16
+ --color-accent: #5980a6;
17
+ --color-accent-100: #eef6ff;
18
+ --color-accent-200: #d6ebff;
19
+ --color-accent-600: #597ea3;
20
+ --color-accent-700: #416180;
21
+ --color-accent-800: #2c455d;
22
+ --color-accent-900: #1d2d3d;
23
+ --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);
24
+ --color-row-rule: color-mix(in srgb, #1d1f20 10%, transparent);
25
+ --color-muted: color-mix(in srgb, #1d1f20 62%, transparent);
26
+ --color-muted-2: color-mix(in srgb, #1d1f20 52%, transparent);
27
+ --color-error: oklch(0.52 0.14 27);
28
+ --color-error-fill: color-mix(in srgb, oklch(0.52 0.14 27) 6%, transparent);
29
+
30
+ --font-heading: "Barlow Condensed", system-ui, sans-serif;
31
+ --font-body: "Barlow", system-ui, sans-serif;
32
+ --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
33
+
34
+ --space-1: 3.4px;
35
+ --space-2: 6.8px;
36
+ --space-3: 10.2px;
37
+ --space-4: 13.6px;
38
+ --space-6: 20.4px;
39
+ --space-8: 27.2px;
40
+ --radius-sm: 2px;
41
+ --radius-md: 4px;
42
+ }
43
+
44
+ /* ── neutralize Gradio's own theme ────────────────────────────────────────
45
+ Gradio's Base theme ships its own light AND dark variable sets (the dark
46
+ ones activated by a `.dark` class Gradio's frontend adds on
47
+ `prefers-color-scheme: dark` or `?__theme=dark`), and every unstyled
48
+ component — blocks, panels, tables, checkboxes, the primary button — reads
49
+ colors from those variables, not from ours. Selector-by-selector overrides
50
+ below only reach the elements we thought to target; this instead
51
+ overwrites Gradio's variables directly, for both plain and `.dark`-classed
52
+ roots, so nothing can fall back to Gradio's blue/dark palette. `!important`
53
+ is required: CSS custom properties still cascade normally, and Gradio's
54
+ `.dark` rule is otherwise free to out-order this one depending on where
55
+ the frontend happens to inject each stylesheet. */
56
+ :root, .dark, :root .dark {
57
+ --body-background-fill: #f2f2f3 !important;
58
+ --body-text-color: #1d1f20 !important;
59
+ --body-text-color-subdued: color-mix(in srgb, #1d1f20 55%, transparent) !important;
60
+ --background-fill-primary: #f2f2f3 !important;
61
+ --background-fill-secondary: #e9e9ea !important;
62
+ --border-color-primary: color-mix(in srgb, #1d1f20 16%, transparent) !important;
63
+ --border-color-accent: #5980a6 !important;
64
+ --border-color-accent-subdued: #5980a6 !important;
65
+ --color-accent: #5980a6 !important;
66
+ --color-accent-soft: #eef6ff !important;
67
+ --link-text-color: #416180 !important;
68
+ --link-text-color-hover: #2c455d !important;
69
+ --link-text-color-active: #2c455d !important;
70
+ --link-text-color-visited: #416180 !important;
71
+
72
+ --block-background-fill: transparent !important;
73
+ --block-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
74
+ --block-label-background-fill: transparent !important;
75
+ --block-label-border-color: transparent !important;
76
+ --block-label-text-color: #1d1f20 !important;
77
+ --block-title-text-color: #1d1f20 !important;
78
+ --block-info-text-color: color-mix(in srgb, #1d1f20 62%, transparent) !important;
79
+ --panel-background-fill: transparent !important;
80
+ --panel-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
81
+ --code-background-fill: #e9e9ea !important;
82
+
83
+ --input-background-fill: #ffffff !important;
84
+ --input-background-fill-hover: #ffffff !important;
85
+ --input-background-fill-focus: #ffffff !important;
86
+ --input-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
87
+ --input-border-color-hover: #5980a6 !important;
88
+ --input-border-color-focus: #5980a6 !important;
89
+ --input-placeholder-color: color-mix(in srgb, #1d1f20 40%, transparent) !important;
90
+
91
+ --checkbox-background-color: #ffffff !important;
92
+ --checkbox-background-color-hover: #ffffff !important;
93
+ --checkbox-background-color-focus: #ffffff !important;
94
+ --checkbox-background-color-selected: #5980a6 !important;
95
+ --checkbox-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
96
+ --checkbox-border-color-hover: #5980a6 !important;
97
+ --checkbox-border-color-focus: #5980a6 !important;
98
+ --checkbox-border-color-selected: #5980a6 !important;
99
+ --checkbox-border-radius: 2px !important;
100
+ --checkbox-label-background-fill: transparent !important;
101
+ --checkbox-label-background-fill-hover: transparent !important;
102
+ --checkbox-label-background-fill-selected: transparent !important;
103
+ --checkbox-label-border-color: transparent !important;
104
+ --checkbox-label-border-color-hover: transparent !important;
105
+ --checkbox-label-border-color-selected: transparent !important;
106
+ --checkbox-label-text-color: #1d1f20 !important;
107
+ --checkbox-label-text-color-selected: #1d1f20 !important;
108
+
109
+ --error-background-fill: color-mix(in srgb, oklch(0.52 0.14 27) 6%, transparent) !important;
110
+ --error-border-color: oklch(0.52 0.14 27) !important;
111
+ --error-text-color: oklch(0.52 0.14 27) !important;
112
+ --error-icon-color: oklch(0.52 0.14 27) !important;
113
+
114
+ --table-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
115
+ --table-even-background-fill: transparent !important;
116
+ --table-odd-background-fill: transparent !important;
117
+ --table-row-focus: color-mix(in srgb, #5980a6 10%, transparent) !important;
118
+ --table-text-color: #1d1f20 !important;
119
+
120
+ --button-primary-background-fill: #5980a6 !important;
121
+ --button-primary-background-fill-hover: #597ea3 !important;
122
+ --button-primary-border-color: #5980a6 !important;
123
+ --button-primary-border-color-hover: #597ea3 !important;
124
+ --button-primary-text-color: #f2f2f3 !important;
125
+ --button-primary-text-color-hover: #f2f2f3 !important;
126
+ --button-secondary-background-fill: transparent !important;
127
+ --button-secondary-background-fill-hover: color-mix(in srgb, #1d1f20 7%, transparent) !important;
128
+ --button-secondary-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
129
+ --button-secondary-border-color-hover: color-mix(in srgb, #1d1f20 30%, transparent) !important;
130
+ --button-secondary-text-color: #1d1f20 !important;
131
+ --button-secondary-text-color-hover: #1d1f20 !important;
132
+ --button-cancel-background-fill: transparent !important;
133
+ --button-cancel-background-fill-hover: color-mix(in srgb, #1d1f20 7%, transparent) !important;
134
+ --button-cancel-border-color: color-mix(in srgb, #1d1f20 16%, transparent) !important;
135
+ --button-cancel-text-color: #1d1f20 !important;
136
+
137
+ --slider-color: #5980a6 !important;
138
+ --loader-color: #5980a6 !important;
139
+ --accordion-text-color: #1d1f20 !important;
140
+ --shadow-drop: none !important;
141
+ --shadow-drop-lg: none !important;
142
+ }
143
+
144
+ /* ── base ─────────────────────────────────────────────────────────────── */
145
+ body, .gradio-container {
146
+ background: var(--color-bg) !important;
147
+ color: var(--color-text) !important;
148
+ font-family: var(--font-body) !important;
149
+ }
150
+ .gradio-container {
151
+ max-width: none !important;
152
+ min-height: 100vh;
153
+ padding: 0 !important;
154
+ }
155
+ .gradio-container footer,
156
+ .gradio-container .footer,
157
+ .gradio-container .built-with {
158
+ display: none !important;
159
+ }
160
+ .gradio-container * { box-sizing: border-box; }
161
+ .gradio-container h1, .gradio-container h2, .gradio-container h3, .gradio-container h4 {
162
+ font-family: var(--font-heading);
163
+ font-weight: 600;
164
+ letter-spacing: -0.01em;
165
+ margin: 0;
166
+ }
167
+ .gradio-container label, .gradio-container .label-wrap span { color: var(--color-text) !important; }
168
+ .gradio-container .info, .gradio-container .prose, .gradio-container p { color: var(--color-muted) !important; }
169
+ .mono {
170
+ font: 500 10.5px/1.3 var(--font-mono);
171
+ letter-spacing: .1em;
172
+ text-transform: uppercase;
173
+ color: var(--color-muted-2);
174
+ }
175
+ .num { font: 500 12px/1 var(--font-mono); color: var(--color-text); }
176
+
177
+ /* ── blueprint frame (registration-marked wireframe objects) ────────────── */
178
+ .blueprint { position: relative; border: 1px solid var(--color-divider); }
179
+ .blueprint > .corner { position: absolute; width: 11px; height: 11px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
180
+ .blueprint > .corner::before, .blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
181
+ .blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
182
+ .blueprint > .corner::after { top: 5px; left: 0; width: 100%; height: 1px; }
183
+ .blueprint > .corner.tl { top: -6px; left: -6px; }
184
+ .blueprint > .corner.tr { top: -6px; right: -6px; }
185
+ .blueprint > .corner.bl { bottom: -6px; left: -6px; }
186
+ .blueprint > .corner.br { bottom: -6px; right: -6px; }
187
+ .corner-overlay { position: absolute; inset: 0; pointer-events: none; }
188
+
189
+ /* ── shell: rail + workspace ─────────────────────────────────────────── */
190
+ .app-shell {
191
+ align-items: stretch !important;
192
+ display: flex !important;
193
+ flex-wrap: nowrap !important;
194
+ gap: 0 !important;
195
+ width: 100% !important;
196
+ min-height: 100vh !important;
197
+ }
198
+ .rail-col {
199
+ min-width: 236px !important;
200
+ max-width: 236px !important;
201
+ width: 236px !important;
202
+ flex: 0 0 236px !important;
203
+ align-self: flex-start !important;
204
+ }
205
+ .rail {
206
+ height: 100vh;
207
+ min-height: 100vh;
208
+ padding: 22px 0 18px;
209
+ border-right: 1px solid var(--color-divider);
210
+ display: flex;
211
+ flex-direction: column;
212
+ position: sticky;
213
+ top: 0;
214
+ }
215
+ .rail-brand { padding: 0 20px; }
216
+ .rail-brand .name { font: 600 25px/1 var(--font-heading); color: var(--color-text); }
217
+ .rail-kicker { padding: 0 20px 9px; margin-top: 34px; }
218
+ .rail-nav { display: flex; flex-direction: column; }
219
+ .rail-nav > *,
220
+ .rail-row-wrap {
221
+ flex: 0 0 auto !important;
222
+ }
223
+ .rail-spacer { margin-top: auto; }
224
+ .rail-plate-wrap { padding: 0 20px; }
225
+ .rail-footnote {
226
+ margin-top: 14px;
227
+ font: 500 9px/1.6 var(--font-mono);
228
+ letter-spacing: .06em;
229
+ color: color-mix(in srgb, var(--color-text) 42%, transparent);
230
+ }
231
+
232
+ .workspace-col {
233
+ min-width: 0 !important;
234
+ max-width: none !important;
235
+ padding: 0 !important;
236
+ flex: 1 1 auto !important;
237
+ width: calc(100% - 236px) !important;
238
+ }
239
+
240
+ /* rail row (overlay: visible .rr under an invisible full-size button) */
241
+ .rail-row-wrap { position: relative; }
242
+ .rail-row-wrap .rail-row-click {
243
+ position: absolute !important; inset: 0 !important; z-index: 2;
244
+ min-height: 0 !important; height: 100% !important; width: 100% !important;
245
+ padding: 0 !important; margin: 0 !important; border: 0 !important;
246
+ background: transparent !important; box-shadow: none !important;
247
+ opacity: 0 !important; cursor: pointer;
248
+ }
249
+ .rail-row-wrap .rail-row-click:disabled { cursor: default; }
250
+ .rr { display: flex; align-items: center; gap: 11px; padding: 9px 20px 9px 17px; border-left: 3px solid transparent; font-size: 13.5px; }
251
+ .rr .rn { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 1px solid var(--color-divider); font: 500 10.5px/1 var(--font-mono); }
252
+ .rr .lb { flex: 1; }
253
+ .rr .st { font: 500 9px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); }
254
+ .rr.done .rn { border-color: var(--color-accent); color: var(--color-accent-700); }
255
+ .rr.done .st { color: var(--color-accent-700); }
256
+ .rr.on { border-left-color: var(--color-accent); background: var(--color-accent-100); }
257
+ .rr.on .lb { font-weight: 600; }
258
+ .rr.on .rn { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
259
+ .rr.on .st { color: var(--color-accent-700); }
260
+ .rr.next { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
261
+ .rr.next .rn { border-color: var(--color-accent); color: var(--color-accent-700); }
262
+ .rr.next .st { color: var(--color-accent-700); }
263
+ .rr.off { opacity: .42; }
264
+
265
+ /* run-state plate */
266
+ .plate { padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; }
267
+ .kv { display: flex; justify-content: space-between; gap: 10px; }
268
+ .kv span:first-child { font: 500 9.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); }
269
+ .kv .accent { color: var(--color-accent-700) !important; }
270
+ .kv .error { color: var(--color-error) !important; }
271
+ .kv .muted { color: var(--color-muted) !important; }
272
+ /* plain-text-key kv row (paper-faithful defaults, etc. — no mono kicker) */
273
+ .kv-plain { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--color-row-rule); font-size: 12.5px; }
274
+ .kv-plain.last { border-bottom: none; }
275
+
276
+ /* ── topbar / page head / action bar ─────────────────────────────────── */
277
+ .topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 30px; border-bottom: 1px solid var(--color-divider); }
278
+ .pghd { padding: 26px 30px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
279
+ .pghd h2 { font-size: 34px; line-height: 1; color: var(--color-text); }
280
+ .pghd .desc { margin-top: 5px; max-width: 640px; color: var(--color-muted); font-size: 13.5px; line-height: 1.5; }
281
+ .pghd .meta-right { text-align: right; font: 500 9.5px/1.7 var(--font-mono); color: var(--color-muted-2); white-space: nowrap; }
282
+
283
+ .stage-grid { padding: 24px 30px 0 !important; gap: 26px !important; align-items: flex-start !important; }
284
+ .stat-grid { padding: 22px 30px 0 !important; gap: 12px !important; }
285
+ .results-stat-row { padding: 22px 30px 0 !important; }
286
+ .metric-strip {
287
+ display: grid;
288
+ grid-template-columns: repeat(4, minmax(0, 1fr));
289
+ gap: 12px;
290
+ width: 100%;
291
+ }
292
+ .results-grid { padding: 26px 30px 0 !important; gap: 26px !important; align-items: flex-start !important; }
293
+
294
+ .sect { margin: 0 0 9px; padding-bottom: 8px; border-bottom: 1px solid var(--color-text); }
295
+ .sect-spaced { margin-top: 26px !important; }
296
+
297
+ .actbar-row { margin-top: auto !important; align-items: center !important; justify-content: space-between !important; flex-wrap: nowrap !important; gap: 20px !important; padding: 16px 30px !important; border-top: 1px solid var(--color-divider) !important; background: color-mix(in srgb, var(--color-text) 3%, transparent) !important; }
298
+ .actbar-note { font: 500 10px/1.4 var(--font-mono); color: var(--color-muted-2); }
299
+ .actbar-note.error { color: var(--color-error); }
300
+ .actbar-buttons {
301
+ align-items: center !important;
302
+ justify-content: flex-end !important;
303
+ flex-wrap: nowrap !important;
304
+ gap: 10px !important;
305
+ flex: 0 0 auto !important;
306
+ width: auto !important;
307
+ }
308
+ .actbar-buttons > *,
309
+ .actbar-buttons .form,
310
+ .actbar-buttons .block {
311
+ flex: 0 0 auto !important;
312
+ width: auto !important;
313
+ min-width: 0 !important;
314
+ }
315
+ .actbar-buttons button {
316
+ width: auto !important;
317
+ min-height: 36px !important;
318
+ padding: 0 16px !important;
319
+ white-space: nowrap !important;
320
+ }
321
+ .actbar-secondary-btn button { min-width: 108px !important; }
322
+ .actbar-primary-btn { position: relative; }
323
+ .actbar-primary-btn button { min-width: 170px !important; }
324
+ .actbar-primary-btn::before,
325
+ .actbar-primary-btn::after {
326
+ content: "";
327
+ position: absolute;
328
+ top: -5px;
329
+ bottom: -5px;
330
+ width: 11px;
331
+ pointer-events: none;
332
+ border-color: color-mix(in srgb, var(--color-text) 58%, transparent);
333
+ }
334
+ .actbar-primary-btn::before {
335
+ left: -5px;
336
+ border-left: 1px solid;
337
+ border-top: 1px solid;
338
+ border-bottom: 1px solid;
339
+ }
340
+ .actbar-primary-btn::after {
341
+ right: -5px;
342
+ border-right: 1px solid;
343
+ border-top: 1px solid;
344
+ border-bottom: 1px solid;
345
+ }
346
+
347
+ /* ── spec rows ────────────────────────────────────────────────────────── */
348
+ .srow-label { font-size: 12.5px; color: color-mix(in srgb, var(--color-text) 72%, transparent); padding: 10px 0; }
349
+ .srow-label .sub { display: block; font: 500 9px/1.4 var(--font-mono); text-transform: none; letter-spacing: 0; color: var(--color-muted-2); margin-top: 2px; }
350
+ .srow-control { padding: 3px 0 !important; }
351
+ .srow-row { border-top: 1px solid var(--color-row-rule) !important; align-items: center !important; }
352
+ .srow-row.first { border-top: none !important; }
353
+ .srow-row.last { border-bottom: 1px solid var(--color-row-rule) !important; }
354
+ .srow-value-row { justify-content: space-between !important; align-items: center !important; gap: 10px !important; flex-wrap: nowrap !important; }
355
+ .srow-value-row > *:first-child { flex: 1 1 auto !important; min-width: 0 !important; overflow: hidden !important; }
356
+ .srow-value-row > *:first-child .num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
357
+ .srow-value-row > *:last-child { flex: none !important; }
358
+ .section-heading-row { align-items: baseline !important; justify-content: space-between !important; gap: 8px !important; margin-bottom: 11px !important; }
359
+ .field-pair { gap: 14px !important; align-items: flex-start !important; }
360
+ .field-pair > * { max-width: none !important; }
361
+ .field-label {
362
+ margin-bottom: 6px;
363
+ color: var(--color-muted);
364
+ font-size: 12.5px;
365
+ line-height: 1.2;
366
+ }
367
+ .static-field {
368
+ min-height: 34px;
369
+ display: flex;
370
+ align-items: center;
371
+ padding: 0 11px;
372
+ background: #fff;
373
+ border: 1px solid var(--color-divider);
374
+ border-radius: var(--radius-md);
375
+ font-size: 14px;
376
+ color: var(--color-text);
377
+ }
378
+
379
+ /* ── stat / metric plates ─────────────────────────────────────────────── */
380
+ .stat { padding: 13px 14px; }
381
+ .stat .v { font-family: var(--font-heading); font-weight: 600; font-size: 30px; line-height: 1; }
382
+ .stat .k { font: 500 8.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--color-muted-2); margin-top: 6px; }
383
+
384
+ /* ── bars, plots, confusion matrix ───────────────────────────────────── */
385
+ .bar { flex: 1; height: 3px; background: color-mix(in srgb, var(--color-text) 15%, transparent); position: relative; }
386
+ .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--color-accent); }
387
+ .plot-slot { position: relative; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--color-accent) 13%, transparent) 6px 7px); border: 1px solid var(--color-divider); display: flex; align-items: center; justify-content: center; }
388
+ .plot-slot span { font: 500 9px/1 var(--font-mono); background: var(--color-bg); padding: 3px 6px; text-transform: uppercase; letter-spacing: .1em; color: var(--color-muted-2); }
389
+ .cm { display: grid; grid-template-columns: repeat(var(--cm-n, 4), 1fr); gap: 2px; }
390
+ .cm > div { aspect-ratio: 1.6; display: grid; place-items: center; font: 500 11.5px/1 var(--font-mono); }
391
+
392
+ /* ── HTML tables (.tbl) ───────────────────────────────────────────────── */
393
+ .tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
394
+ .tbl th, .tbl td { border: 0 !important; }
395
+ .tbl th { font: 500 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; text-align: left; color: var(--color-muted-2); padding: 0 10px 6px 0; border-bottom: 1px solid var(--color-divider) !important; background: transparent !important; }
396
+ .tbl td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--color-row-rule) !important; vertical-align: baseline; }
397
+ .tbl td.n { font: 400 12px/1 var(--font-mono); }
398
+ .tbl .accent { color: var(--color-accent-700); }
399
+ .tbl .error { color: var(--color-error); }
400
+
401
+ /* ── status / error strips ───────────────────────────────────────────── */
402
+ .strip { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; }
403
+ .strip.status { border: 1px solid var(--color-divider); }
404
+ .strip.error { border: 1px solid var(--color-error); border-left-width: 3px; background: var(--color-error-fill); }
405
+ .strip .strip-kicker { font: 500 9.5px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
406
+ .strip.error .strip-kicker { color: var(--color-error); }
407
+ .strip .strip-body { margin-top: 4px; font-size: 12.5px; line-height: 1.5; }
408
+ .empty-note { padding: 14px 0; color: var(--color-muted); font-size: 13px; }
409
+
410
+ /* ── slots (one-line gr.File) ─────────────────────────────────────────── */
411
+ .file-slot .file-preview { border: 1px solid var(--color-divider) !important; border-radius: var(--radius-md); background: #fff; font-size: 12.5px !important; }
412
+ .file-slot .file-preview td, .file-slot .file-preview th { color: var(--color-text) !important; }
413
+ .file-slot.err .file-preview { border-color: var(--color-error) !important; }
414
+ .file-slot:has(.file-preview) label.float,
415
+ .file-slot:has(.file-preview) .icon-wrap,
416
+ .file-slot:has(.file-preview) .wrap:not(.file-preview-holder) { display: none !important; }
417
+ .file-slot .empty.large { min-height: 44px !important; padding: 8px !important; }
418
+ .file-slot .empty.large .icon { width: 20px !important; height: 20px !important; opacity: .5; }
419
+
420
+ /* ── buttons ──────────────────────────────────────────────────────────── */
421
+ .gradio-container button.primary, .gradio-container button.secondary {
422
+ border-radius: 0 !important;
423
+ font-family: var(--font-heading) !important;
424
+ font-weight: 600 !important;
425
+ box-shadow: none !important;
426
+ text-transform: none;
427
+ }
428
+ .gradio-container button.secondary {
429
+ background: transparent !important;
430
+ border: 1px solid var(--color-divider) !important;
431
+ color: var(--color-text) !important;
432
+ }
433
+ .gradio-container button.secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent) !important; }
434
+ .gradio-container button.primary {
435
+ background: var(--color-accent) !important;
436
+ border: 1px solid var(--color-accent) !important;
437
+ color: var(--color-bg) !important;
438
+ }
439
+ .gradio-container button.primary:hover { background: var(--color-accent-600) !important; }
440
+ .gradio-container button.primary:active { background: var(--color-accent-700) !important; }
441
+ .gradio-container button:disabled { opacity: .45 !important; cursor: not-allowed !important; }
442
+ .btn-ghost { min-width: 0 !important; flex: none !important; }
443
+ .btn-ghost button {
444
+ background: transparent !important; border-color: transparent !important;
445
+ color: var(--color-accent-700) !important; font-weight: 500 !important;
446
+ font-family: var(--font-body) !important; box-shadow: none !important;
447
+ min-width: 0 !important; width: auto !important; padding: 4px 8px !important;
448
+ white-space: nowrap;
449
+ }
450
+ .btn-ghost button:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent) !important; }
451
+ .btn-block button { width: 100%; }
452
+ .btn-primary-frame { position: relative; }
453
+
454
+ /* ── segmented control (gr.Radio restyled) ───────────────────────────── */
455
+ .seg-radio { border: 1px solid var(--color-divider); overflow: hidden; }
456
+ .seg-radio label { border: 0 !important; background: transparent !important; margin: 0 !important; padding: 7px 12px !important; font-size: 13px !important; flex: 1; justify-content: center !important; }
457
+ .seg-radio label + label { border-left: 1px solid var(--color-divider) !important; }
458
+ .seg-radio label:has(input:checked) { background: var(--color-accent) !important; color: var(--color-bg) !important; }
459
+ .seg-radio label:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent) !important; }
460
+ .seg-radio input[type="radio"] { display: none !important; }
461
+
462
+ /* ── native form controls ─────────────────────────────────────────────── */
463
+ .gradio-container input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
464
+ .gradio-container textarea, .gradio-container select {
465
+ background: #fff !important;
466
+ color: var(--color-text) !important;
467
+ border: 1px solid var(--color-divider) !important;
468
+ border-radius: var(--radius-md) !important;
469
+ font-size: 14px !important;
470
+ text-overflow: ellipsis;
471
+ }
472
+ .gradio-container label:has(> input[type="checkbox"]),
473
+ .gradio-container label:has(> span > input[type="checkbox"]) {
474
+ border: none !important;
475
+ background: transparent !important;
476
+ box-shadow: none !important;
477
+ padding: 4px 0 !important;
478
+ min-height: 0 !important;
479
+ }
480
+ .gradio-container .block:has(> label.checkbox-container) {
481
+ border: none !important;
482
+ background: transparent !important;
483
+ box-shadow: none !important;
484
+ padding: 0 !important;
485
+ }
486
+ .gradio-container input[type="checkbox"] {
487
+ appearance: none; width: 14px; height: 14px; flex: none;
488
+ border: 1px solid var(--color-divider); background: #fff; position: relative;
489
+ border-radius: 0;
490
+ }
491
+ .gradio-container input[type="checkbox"]:checked {
492
+ background: var(--color-accent); border-color: var(--color-accent);
493
+ }
494
+ .gradio-container input[type="checkbox"]:checked::after {
495
+ content: ""; position: absolute; left: 3px; top: 6px; width: 4px; height: 1.5px;
496
+ background: #fff; transform: rotate(45deg);
497
+ }
498
+ .gradio-container input[type="checkbox"]:checked::before {
499
+ content: ""; position: absolute; left: 5px; top: 7px; width: 7px; height: 1.5px;
500
+ background: #fff; transform: rotate(-50deg);
501
+ }
502
+ .gradio-container input[type="radio"] {
503
+ appearance: none; width: 15px; height: 15px; flex: none; border-radius: 50%;
504
+ border: 1.5px solid var(--color-divider); background: #fff;
505
+ }
506
+ .gradio-container input[type="radio"]:checked {
507
+ border-color: var(--color-accent);
508
+ background: radial-gradient(circle, var(--color-accent) 0 40%, #fff 42% 100%);
509
+ }
510
+ .gradio-container input[type="range"] { accent-color: var(--color-accent); height: 3px; }
511
+ .gradio-container :focus-visible { outline: 2px solid var(--color-accent) !important; outline-offset: 2px; }
512
+
513
+ /* dataframes (.tbl-like) */
514
+ .gradio-container table { color: var(--color-text) !important; font-size: 12.5px !important; }
515
+ .gradio-container thead th {
516
+ font: 500 10px/1 var(--font-mono) !important; letter-spacing: .1em; text-transform: uppercase;
517
+ color: var(--color-muted-2) !important; background: transparent !important;
518
+ border-bottom: 1px solid var(--color-divider) !important;
519
+ }
520
+ .gradio-container tbody td { border-bottom: 1px solid var(--color-row-rule) !important; }
521
+ .gradio-container .table-wrap .toolbar-container,
522
+ .gradio-container .table-wrap .cell-menu-button,
523
+ .gradio-container .table-wrap button.cell-menu,
524
+ .gradio-container .table-wrap .icon-button-wrapper { display: none !important; }
525
+
526
+ /* accordion */
527
+ .gradio-container .label-wrap { color: var(--color-text) !important; }
528
+
529
+ /* ── responsive ───────────────────────────────────────────────────────── */
530
+ @media (max-width: 1000px) {
531
+ .app-shell { display: block !important; }
532
+ .rail-col { min-width: 100% !important; max-width: 100% !important; }
533
+ .rail { position: relative; min-height: auto; border-right: 0; border-bottom: 1px solid var(--color-divider); }
534
+ .stage-grid, .results-grid { grid-template-columns: 1fr !important; }
535
+ }
536
+ @media (max-width: 620px) {
537
+ .pghd h2 { font-size: 26px; }
538
+ .stat-grid, .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
539
+ }
540
+ """
e2e-tests/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ target/
2
+ .mvn/apache-maven-*/
3
+ .mvn/apache-maven-*.zip
e2e-tests/.mvn/wrapper/maven-wrapper.properties ADDED
@@ -0,0 +1 @@
 
 
1
+ distributionUrl=https://archive.apache.org/dist/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.zip
e2e-tests/mvnw ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ BASE_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
5
+ MAVEN_VERSION="3.9.11"
6
+ MAVEN_DIR="$BASE_DIR/.mvn/apache-maven-$MAVEN_VERSION"
7
+ MAVEN_ZIP="$BASE_DIR/.mvn/apache-maven-$MAVEN_VERSION-bin.zip"
8
+ MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.zip"
9
+
10
+ if [ ! -x "$MAVEN_DIR/bin/mvn" ]; then
11
+ mkdir -p "$BASE_DIR/.mvn"
12
+ if [ ! -f "$MAVEN_ZIP" ]; then
13
+ curl -fsSL "$MAVEN_URL" -o "$MAVEN_ZIP"
14
+ fi
15
+ (cd "$BASE_DIR/.mvn" && unzip -q -o "$MAVEN_ZIP")
16
+ fi
17
+
18
+ exec "$MAVEN_DIR/bin/mvn" "$@"
e2e-tests/pom.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+ <modelVersion>4.0.0</modelVersion>
6
+
7
+ <groupId>org.biolmnet</groupId>
8
+ <artifactId>biolmnet-workbench-e2e</artifactId>
9
+ <version>0.1.0-SNAPSHOT</version>
10
+ <packaging>jar</packaging>
11
+
12
+ <properties>
13
+ <maven.compiler.release>17</maven.compiler.release>
14
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15
+ <cucumber.version>7.30.0</cucumber.version>
16
+ <junit.platform.version>1.14.1</junit.platform.version>
17
+ <selenium.version>4.39.0</selenium.version>
18
+ </properties>
19
+
20
+ <dependencies>
21
+ <dependency>
22
+ <groupId>io.cucumber</groupId>
23
+ <artifactId>cucumber-java</artifactId>
24
+ <version>${cucumber.version}</version>
25
+ <scope>test</scope>
26
+ </dependency>
27
+ <dependency>
28
+ <groupId>io.cucumber</groupId>
29
+ <artifactId>cucumber-junit-platform-engine</artifactId>
30
+ <version>${cucumber.version}</version>
31
+ <scope>test</scope>
32
+ </dependency>
33
+ <dependency>
34
+ <groupId>org.junit.platform</groupId>
35
+ <artifactId>junit-platform-suite</artifactId>
36
+ <version>${junit.platform.version}</version>
37
+ <scope>test</scope>
38
+ </dependency>
39
+ <dependency>
40
+ <groupId>org.junit.jupiter</groupId>
41
+ <artifactId>junit-jupiter-api</artifactId>
42
+ <version>5.14.1</version>
43
+ <scope>test</scope>
44
+ </dependency>
45
+ <dependency>
46
+ <groupId>org.seleniumhq.selenium</groupId>
47
+ <artifactId>selenium-java</artifactId>
48
+ <version>${selenium.version}</version>
49
+ <scope>test</scope>
50
+ </dependency>
51
+ </dependencies>
52
+
53
+ <build>
54
+ <plugins>
55
+ <plugin>
56
+ <groupId>org.apache.maven.plugins</groupId>
57
+ <artifactId>maven-surefire-plugin</artifactId>
58
+ <version>3.5.4</version>
59
+ <configuration>
60
+ <includes>
61
+ <include>**/*Test.java</include>
62
+ </includes>
63
+ <systemPropertyVariables>
64
+ <cucumber.plugin>pretty, html:target/cucumber-report.html, json:target/cucumber-report.json</cucumber.plugin>
65
+ <cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
66
+ </systemPropertyVariables>
67
+ </configuration>
68
+ </plugin>
69
+ </plugins>
70
+ </build>
71
+ </project>
e2e-tests/src/test/java/org/biolmnet/e2e/RunCucumberTest.java ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e;
2
+
3
+ import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
4
+ import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
5
+
6
+ import org.junit.platform.suite.api.ConfigurationParameter;
7
+ import org.junit.platform.suite.api.IncludeEngines;
8
+ import org.junit.platform.suite.api.SelectClasspathResource;
9
+ import org.junit.platform.suite.api.Suite;
10
+
11
+ @Suite
12
+ @IncludeEngines("cucumber")
13
+ @SelectClasspathResource("features")
14
+ @ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "org.biolmnet.e2e")
15
+ @ConfigurationParameter(
16
+ key = PLUGIN_PROPERTY_NAME,
17
+ value = "pretty, html:target/cucumber-report.html, json:target/cucumber-report.json")
18
+ public class RunCucumberTest {
19
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/config/TestConfig.java ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.config;
2
+
3
+ public final class TestConfig {
4
+ private TestConfig() {
5
+ }
6
+
7
+ public static String baseUrl() {
8
+ return System.getProperty("baseUrl", "http://127.0.0.1:7860");
9
+ }
10
+
11
+ public static boolean headless() {
12
+ return Boolean.parseBoolean(System.getProperty("headless", "false"));
13
+ }
14
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/driver/DriverFactory.java ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.driver;
2
+
3
+ import org.biolmnet.e2e.config.TestConfig;
4
+ import org.openqa.selenium.WebDriver;
5
+ import org.openqa.selenium.chrome.ChromeDriver;
6
+ import org.openqa.selenium.chrome.ChromeOptions;
7
+
8
+ public final class DriverFactory {
9
+ private static final ThreadLocal<WebDriver> DRIVER = new ThreadLocal<>();
10
+
11
+ private DriverFactory() {
12
+ }
13
+
14
+ public static WebDriver getDriver() {
15
+ WebDriver driver = DRIVER.get();
16
+ if (driver == null) {
17
+ ChromeOptions options = new ChromeOptions();
18
+ options.addArguments("--window-size=1440,1100");
19
+ if (TestConfig.headless()) {
20
+ options.addArguments("--headless=new");
21
+ }
22
+ driver = new ChromeDriver(options);
23
+ DRIVER.set(driver);
24
+ }
25
+ return driver;
26
+ }
27
+
28
+ public static void quitDriver() {
29
+ WebDriver driver = DRIVER.get();
30
+ if (driver != null) {
31
+ driver.quit();
32
+ DRIVER.remove();
33
+ }
34
+ }
35
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/pages/BasePage.java ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.pages;
2
+
3
+ import java.time.Duration;
4
+
5
+ import org.openqa.selenium.By;
6
+ import org.openqa.selenium.WebDriver;
7
+ import org.openqa.selenium.WebElement;
8
+ import org.openqa.selenium.support.ui.ExpectedConditions;
9
+ import org.openqa.selenium.support.ui.WebDriverWait;
10
+
11
+ public class BasePage {
12
+ protected final WebDriver driver;
13
+ protected final WebDriverWait wait;
14
+
15
+ public BasePage(WebDriver driver) {
16
+ this.driver = driver;
17
+ this.wait = new WebDriverWait(driver, Duration.ofSeconds(20));
18
+ }
19
+
20
+ protected WebElement visible(By locator) {
21
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
22
+ }
23
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/pages/WorkbenchPage.java ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.pages;
2
+
3
+ import org.openqa.selenium.By;
4
+ import org.openqa.selenium.WebDriver;
5
+ import org.openqa.selenium.WebElement;
6
+
7
+ public class WorkbenchPage extends BasePage {
8
+ private static final By APP_HEADER = By.cssSelector("#app-header");
9
+ private static final By NAV_DATA = By.cssSelector("#nav-data");
10
+ private static final By NAV_TRAIN = By.cssSelector("#nav-train");
11
+ private static final By NAV_EXPORT = By.cssSelector("#nav-export");
12
+ private static final By NAV_PREDICT = By.cssSelector("#nav-predict");
13
+ private static final By NAV_RESULTS = By.cssSelector("#nav-results");
14
+ private static final By PAGE_DATA = By.cssSelector("#page-data");
15
+ private static final By PAGE_TRAIN = By.cssSelector("#page-train");
16
+ private static final By PAGE_EXPORT = By.cssSelector("#page-export");
17
+ private static final By PAGE_PREDICT = By.cssSelector("#page-predict");
18
+ private static final By PAGE_RESULTS = By.cssSelector("#page-results");
19
+
20
+ public WorkbenchPage(WebDriver driver) {
21
+ super(driver);
22
+ }
23
+
24
+ public void open(String baseUrl) {
25
+ driver.get(baseUrl);
26
+ }
27
+
28
+ public boolean headerIsVisible() {
29
+ return visible(APP_HEADER).isDisplayed();
30
+ }
31
+
32
+ public boolean sidebarWorkflowIsVisible() {
33
+ return visible(NAV_DATA).isDisplayed()
34
+ && visible(NAV_TRAIN).isDisplayed()
35
+ && visible(NAV_EXPORT).isDisplayed()
36
+ && visible(NAV_PREDICT).isDisplayed()
37
+ && visible(NAV_RESULTS).isDisplayed();
38
+ }
39
+
40
+ public boolean onlyDataPageIsVisible() {
41
+ visible(PAGE_DATA);
42
+ return isDisplayed(PAGE_DATA)
43
+ && !isDisplayed(PAGE_TRAIN)
44
+ && !isDisplayed(PAGE_EXPORT)
45
+ && !isDisplayed(PAGE_PREDICT)
46
+ && !isDisplayed(PAGE_RESULTS);
47
+ }
48
+
49
+ private boolean isDisplayed(By locator) {
50
+ return driver.findElements(locator).stream().anyMatch(WebElement::isDisplayed);
51
+ }
52
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/steps/ApplicationLaunchSteps.java ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.steps;
2
+
3
+ import static org.junit.jupiter.api.Assertions.assertTrue;
4
+
5
+ import io.cucumber.java.en.Given;
6
+ import io.cucumber.java.en.Then;
7
+ import io.cucumber.java.en.When;
8
+ import org.biolmnet.e2e.config.TestConfig;
9
+ import org.biolmnet.e2e.driver.DriverFactory;
10
+ import org.biolmnet.e2e.pages.WorkbenchPage;
11
+
12
+ public class ApplicationLaunchSteps {
13
+ private WorkbenchPage workbenchPage;
14
+
15
+ @Given("the BioLM-NET Workbench app is running")
16
+ public void theWorkbenchAppIsRunning() {
17
+ workbenchPage = new WorkbenchPage(DriverFactory.getDriver());
18
+ }
19
+
20
+ @When("I open the BioLM-NET Workbench")
21
+ public void iOpenTheWorkbench() {
22
+ workbenchPage.open(TestConfig.baseUrl());
23
+ }
24
+
25
+ @Then("the application header is visible")
26
+ public void theApplicationHeaderIsVisible() {
27
+ assertTrue(workbenchPage.headerIsVisible(), "Expected the BioLM-NET Workbench header to be visible.");
28
+ }
29
+
30
+ @Then("the workflow sidebar is visible")
31
+ public void theWorkflowSidebarIsVisible() {
32
+ assertTrue(workbenchPage.sidebarWorkflowIsVisible(), "Expected all workflow navigation buttons to be visible.");
33
+ }
34
+
35
+ @Then("only the Data & Priors workspace is visible")
36
+ public void onlyTheDataAndPriorsWorkspaceIsVisible() {
37
+ assertTrue(workbenchPage.onlyDataPageIsVisible(), "Expected only the Data & Priors workspace to be visible.");
38
+ }
39
+ }
e2e-tests/src/test/java/org/biolmnet/e2e/support/Hooks.java ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package org.biolmnet.e2e.support;
2
+
3
+ import io.cucumber.java.After;
4
+ import io.cucumber.java.Scenario;
5
+ import java.io.IOException;
6
+ import java.nio.file.Files;
7
+ import java.nio.file.Path;
8
+ import org.biolmnet.e2e.driver.DriverFactory;
9
+ import org.openqa.selenium.OutputType;
10
+ import org.openqa.selenium.TakesScreenshot;
11
+ import org.openqa.selenium.WebDriver;
12
+
13
+ public class Hooks {
14
+ @After
15
+ public void afterScenario(Scenario scenario) throws IOException {
16
+ WebDriver driver = DriverFactory.getDriver();
17
+ if (scenario.isFailed() && driver instanceof TakesScreenshot screenshotDriver) {
18
+ Path screenshotDir = Path.of("target", "screenshots");
19
+ Files.createDirectories(screenshotDir);
20
+ byte[] screenshot = screenshotDriver.getScreenshotAs(OutputType.BYTES);
21
+ Path screenshotPath = screenshotDir.resolve(scenario.getName().replaceAll("[^A-Za-z0-9]+", "-") + ".png");
22
+ Files.write(screenshotPath, screenshot);
23
+ scenario.attach(screenshot, "image/png", screenshotPath.toString());
24
+ }
25
+ DriverFactory.quitDriver();
26
+ }
27
+ }
e2e-tests/src/test/resources/features/application_launch.feature ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @smoke
2
+ Feature: Application launch
3
+
4
+ @E2E-001
5
+ Scenario: Workbench launches
6
+ Given the BioLM-NET Workbench app is running
7
+ When I open the BioLM-NET Workbench
8
+ Then the application header is visible
9
+ And the workflow sidebar is visible
10
+
11
+ @E2E-002
12
+ Scenario: Data and Priors workspace is visible by default
13
+ Given the BioLM-NET Workbench app is running
14
+ When I open the BioLM-NET Workbench
15
+ Then only the Data & Priors workspace is visible