test(e2e): cover the blood-glucose journey across a unit switch

The glucose display unit had thirty-odd readers and, until recently, no
control to set it. Nothing in the browser suite walks the path a person
actually takes: capture a reading in mg/dL, switch the account to mmol/L,
capture a second one, and read both back — each converted, none of them
reinterpreted — in the list and on the dashboard strip.

The journey covers that end to end, plus the boundary: a value past the
plausible ceiling is refused by the server, the capture keeps what was typed,
and the list is exactly what it was.

One reading arrives with no meal-time context, the way a meter export or a
device sync delivers one. It reads back correctly in the list; the tile it
should paint does not exist yet (#943), so the tile assertion is skipped by
issue number rather than softened into something that passes.

Three supporting changes:

- The list rows carry what they hold — type and resolved display unit on the
  row, a slot on the value cell — so the journey pins "this reading now reads
  in mmol/L" structurally instead of matching translated copy that also paints
  through a different subtree on the card list. The meal-time options carry
  their enum for the same reason.
- The sharing-marker weight rows were seeded by handing a Date to a
  `timestamp without time zone` column, which stamps them in the host's zone.
  On a machine east of UTC that put them hours in the future, where every fold
  whose window ends "now" skips them, and the type stayed uncovered — which
  keeps the snapshot's thick phase cold and the whole tile strip short. Seed
  the instant as UTC, the shape the app's own writes use.
- The file mutates one shared account and reads global verdicts off it, so it
  runs in a single project alongside the visits and immunization journeys.
This commit is contained in:
Marc-André Bombeck committed 2026-09-10 01:01:11 +02:00
1 parent 1d372df3a0
commit 1de3681c81
6 files changed
+533 -4

No files matched your search

@@ -605,7 +605,14 @@ export function MeasurementForm({
</SelectTrigger>
<SelectContent>
{GLUCOSE_CONTEXTS.map((ctx) => (
<SelectItem key={ctx.value} value={ctx.value}>
<SelectItem
key={ctx.value}
value={ctx.value}
// The option carries its enum alongside the translated
// label, so an option can be chosen by which meal time it
// means rather than by the words the current locale prints.
data-glucose-context={ctx.value}
>
{t(ctx.labelKey)}
</SelectItem>
))}
@@ -1161,6 +1161,18 @@ export function MeasurementList({
<Fragment key={m.id}>
<TableRow
data-state={isSelected ? "selected" : undefined}
// A row is addressable by what it holds, not by
// the copy it paints: the type is an enum and the
// unit is a symbol, so a browser journey can pin
// "this glucose reading now reads in mmol/L"
// without matching translated text that also
// renders at a different size on the card list
// below.
data-testid="measurement-row"
data-measurement-type={m.type}
data-display-unit={
isGrouped ? m.unit : rowDisplay(m).unit
}
>
<TableCell className="pl-4">
{/* Grouped/synthetic rows aren't individually
@@ -1197,7 +1209,10 @@ export function MeasurementList({
</button>
</Badge>
</TableCell>
<TableCell className="font-semibold tabular-nums">
<TableCell
className="font-semibold tabular-nums"
data-slot="measurement-row-value"
>
{/* v1.4.39.3 — non-grouped rows render the
stored value with its native precision
(`fmt.number` honours up to 3 fraction
@@ -1358,6 +1373,12 @@ export function MeasurementList({
<ListRow
key={m.id}
data-state={isSelected ? "selected" : undefined}
// Same addressing contract as the desktop row above.
data-testid="measurement-row"
data-measurement-type={m.type}
data-display-unit={
isGrouped ? m.unit : rowDisplay(m).unit
}
className="bg-card border-border data-[state=selected]:border-primary/60 data-[state=selected]:bg-primary/5"
>
<div className="flex items-center justify-between">
@@ -1412,7 +1433,10 @@ export function MeasurementList({
{t(TYPE_LABEL_KEYS[m.type])}
</Badge>
)}
<span className="font-semibold tabular-nums">
<span
className="font-semibold tabular-nums"
data-slot="measurement-row-value"
>
{/* v1.4.39.3 — mirror the desktop table:
grouped daily aggregates stay integer,
non-grouped single readings render with