test(e2e): match the activity calendar on data attributes, not wording

The card carries data-period and each goal row and goal field a
data-goal-key, so the spec no longer depends on the English labels.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 22:51:06 +02:00
1 parent 89b30ebdee
commit e696d6e526
4 files changed
+28 -14

No files matched your search

@@ -140,6 +140,13 @@ describe("ActivityCalendarCard", () => {
state.data = calendar();
const html = render();
expect(html).toContain("Steps per month");
// Stable hooks for the end-to-end spec, independent of the wording.
expect(html).toContain(
'data-slot="activity-calendar-goal" data-goal-key="stepsPerMonth"',
);
expect(html).toMatch(
/data-slot="activity-calendar"[^>]*data-period="month"/,
);
expect(html).toContain(
'data-slot="activity-calendar-week-goal" data-met="true"',
);
@@ -173,6 +173,7 @@ export function ActivityCalendarCard() {
<Card
id="activity-calendar"
data-slot="activity-calendar"
data-period={period}
className="scroll-mt-28"
>
<CardHeader>
@@ -483,7 +484,12 @@ export function ActivityCalendarCard() {
<div className="space-y-2" data-slot="activity-calendar-goals">
{data.goalProgress.map((g) => (
<div key={g.key} className="space-y-1">
<div
key={g.key}
className="space-y-1"
data-slot="activity-calendar-goal"
data-goal-key={g.key}
>
<div className="flex items-center justify-between gap-3 text-sm">
<span className="inline-flex items-center gap-1.5">
<Target
@@ -115,6 +115,7 @@ export function ActivityGoalsSheet({
<Label htmlFor={id}>{t(`activityCalendar.goal.${key}`)}</Label>
<Input
id={id}
data-goal-key={key}
inputMode="numeric"
autoComplete="off"
value={draft[key]}