Files
doormile_milderapp/test/verify_shots_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

146 lines
4.3 KiB
Dart

@Tags(['shots'])
library;
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_test/flutter_test.dart';
import 'support/golden_fonts.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:miler/data/service_profile.dart';
import 'package:miler/views/Dashboard/pickups/shipment_capture.dart';
import 'package:miler/views/Dashboard/pickups/stop_verify.dart';
import 'package:miler/views/helpers/constants/Font_constant.dart';
/// Reference shots of the logistics verification flow.
///
/// This screen is the longest form in the app and the only one a rider fills
/// in standing at somebody's gate. It is also the one that had never been
/// looked at as a picture — every change to it was reasoned about in code and
/// verified by a layout assertion, which catches an overflow and says nothing
/// at all about whether the thing reads.
void main() {
setUpAll(() async {
await loadGoldenFonts();
const icons =
'/opt/homebrew/share/flutter/bin/cache/artifacts/material_fonts/'
'MaterialIcons-Regular.otf';
if (File(icons).existsSync()) {
final il = FontLoader('MaterialIcons')
..addFont(
File(icons).readAsBytes().then((b) => ByteData.view(b.buffer)),
);
await il.load();
}
});
setUp(() {
SharedPreferences.setMockInitialValues({'userid': 38});
ServiceProfile.setActive(ServiceProfile.parcel);
});
Future<void> page(WidgetTester tester, String name, Widget screen) async {
tester.view.physicalSize = const Size(390 * 3, 1500 * 3);
tester.view.devicePixelRatio = 3.0;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(
ScreenUtilInit(
designSize: const Size(390, 844),
builder: (_, _) =>
MaterialApp(debugShowCheckedModeBanner: false, home: screen),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
await expectLater(
find.byType(MaterialApp),
matchesGoldenFile('shots/verify_$name.png'),
);
}
Future<void> shot(
WidgetTester tester,
String name,
Map<String, dynamic> stop,
) async {
tester.view.physicalSize = const Size(390 * 3, 1500 * 3);
tester.view.devicePixelRatio = 3.0;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(
ScreenUtilInit(
designSize: const Size(390, 844),
builder: (_, _) => MaterialApp(
debugShowCheckedModeBanner: false,
home: StopVerificationPage(pickup: stop),
),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
await expectLater(
find.byType(MaterialApp),
matchesGoldenFile('shots/verify_$name.png'),
);
}
testWidgets('a logistics pickup, untouched', (tester) async {
await shot(tester, 'pickup', {
'orderid': 'DM-BK-501CB551',
'pickupid': 75,
'type': 'pickup',
'orderstatus': 'accepted',
'pickupcustomer': 'Rajesh Textiles',
'pickupaddress': '14 Cross Cut Road, Gandhipuram, Coimbatore 641012',
'pickupcontactno': '9787698259',
'parcels': [
{'parcelid': 1},
{'parcelid': 2},
],
'collectionamt': 2450,
});
});
testWidgets('the shipment desk, untouched', (tester) async {
await page(
tester,
'shipment',
const ShipmentCapturePage(
pickup: {
'orderid': 'DM-BK-501CB551',
'pickupid': 75,
'pickupcustomer': 'Rajesh Textiles',
'pickupaddress': '14 Cross Cut Road, Gandhipuram, Coimbatore',
'pickuppincode': '641012',
'dropaddress': '22 Race Course Road, Coimbatore',
'droppincode': '641018',
},
),
);
});
testWidgets('a delivery, untouched', (tester) async {
await shot(tester, 'delivery', {
'orderid': 'DM-BK-501CB552',
'pickupid': 76,
'type': 'delivery',
'orderstatus': 'outfordelivery',
'pickupcustomer': 'Meena Sundaram',
'dropaddress': '22 Race Course Road, Coimbatore 641018',
'pickupcontactno': '9787698260',
'parcels': [
{'parcelid': 1},
],
});
});
}