Files
doormile_milderapp/test/trip_empty_state_test.dart
Thiru-tenext d7348e253f Miler rider app: surface system, visible design language, backend lifecycle
Design system
- MilerSurface ladder (canvas → working → raised → floating) with MilerPanel
  as layer 1; canvas moved to #DEE3EA so white separates at 1.290:1.
- Visible vocabulary applied across Home, Deliveries, Activity, Account and
  the sheets: hero heads (tabular numeral + small caption, clamped at 1.3x),
  canvas wells for anything that opens, small filled tags for shelf labels,
  demoted placeholders. Recorded in DESIGN_SYSTEM.md §6.
- One icon family: 222 Material glyphs migrated to Lucide; none left outside
  lib/xpress.
- Colour semantics corrected: amber only for what is genuinely owed, brand red
  reserved for the live stop, disabled primaries go neutral rather than pale.

Data and lifecycle
- lib/data/lifecycle.dart reads mutations for what they prove; route_order.dart
  makes admin sequence the single ordering authority; service_day.dart, and
  stop_area.dart rewritten against live Coimbatore addresses (digit-token
  stripping, city stoplist, street suffixes, stammer collapse).
- countLabel states the load once, in bags.

Testing
- 1440 tests passing; golden shot harnesses for Home, Deliveries, Activity,
  sheets and verify, with test/failures/ now gitignored (diff debris).
- New pins: home_gutter_test, stop_area_test, plus updated structural bounds.

Note: this commit also carries pre-existing working-tree deletions that were
present before this work (API_SPEC.md, README.md, demo test fixtures).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-22 05:40:35 +05:30

89 lines
3.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:miler/views/Dashboard/home/trip_empty_state.dart';
/// An unfilled trip tab used to render a bordered white card with a grey
/// glyph in it — a piece of content that had arrived empty. It is the page
/// itself now, so the assertion that matters is that no card comes back: a
/// `Container` with a `Border` around the whole state is the thing being
/// removed, and a redesign that quietly reintroduces one should fail here.
void main() {
Future<void> pump(
WidgetTester tester, {
required bool offline,
VoidCallback? onGoOnDuty,
}) async {
tester.view.physicalSize = const Size(1170, 2532);
tester.view.devicePixelRatio = 3.0;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(
ScreenUtilInit(
designSize: const Size(390, 844),
builder: (_, _) => MaterialApp(
home: Scaffold(
body: TripEmptyState(
tripLabel: 'Trip 2',
offline: offline,
onGoOnDuty: onGoOnDuty,
),
),
),
),
);
await tester.pumpAndSettle();
}
/// Any decoration carrying a border, anywhere in the state.
Finder borderedBoxes() => find.byWidgetPredicate((w) {
if (w is! Container) return false;
final d = w.decoration;
return d is BoxDecoration && d.border != null;
});
testWidgets('one line and the artwork, and no card', (tester) async {
await pump(tester, offline: false);
// ── The line is fixed copy now, not the tab's name ──
//
// It read `${'$'}{tripLabel} not assigned yet` — "Trip 2 not assigned yet" —
// so each tab named itself. The user asked for one line, `Trip not
// assigned yet`, on every tab; the tab bar directly above already says
// which trip is selected, which is where that answer now lives alone.
expect(find.text('Trip not assigned yet'), findsOneWidget);
expect(borderedBoxes(), findsNothing);
});
testWidgets('the artwork carries the wait — no paragraph, no chip', (
tester,
) async {
await pump(tester, offline: false);
// The illustration says "waiting for work" in one look, so the two
// sentences and the `● Waiting for your hub` pill under it are gone.
// Anything that reintroduces prose here should fail this.
expect(find.byType(Image), findsOneWidget);
expect(find.text('Waiting for your hub'), findsNothing);
expect(find.textContaining('Your hub assigns trips'), findsNothing);
});
testWidgets(
'off duty is a different sentence with the action that fixes it',
(tester) async {
var tapped = false;
await pump(tester, offline: true, onGoOnDuty: () => tapped = true);
expect(find.text('You are off duty'), findsOneWidget);
// Nothing is coming until he goes on duty, so the wait is not claimed.
expect(find.text('Waiting for your hub'), findsNothing);
await tester.tap(find.text('Go on duty'));
await tester.pump();
expect(tapped, isTrue);
},
);
}