import 'package:doormile_cx/data/location_service.dart'; import 'package:doormile_cx/main.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; /// Walks the app the way a customer does — sign in, Orders, Completed, open an /// order — then holds on the receipt so it can be captured from the simulator. void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); testWidgets('Orders ▸ Completed ▸ order details', (tester) async { // Deterministic pin: the walkthrough must never stop on an OS permission // dialog, and the receipt it captures should look the same every run. LocationService.instance = FixedLocationService(); await tester.pumpWidget(const DoormileApp()); await tester.pumpAndSettle(const Duration(milliseconds: 400)); Future hold([int ms = 900]) async { await tester.pump(); await tester.pump(Duration(milliseconds: ms)); await tester.pump(const Duration(milliseconds: 400)); } await tester.enterText(find.byType(TextField).first, '9876543210'); await hold(300); await tester.tap(find.text('Continue')); await hold(); final boxes = find.byType(TextField); for (var i = 0; i < 4; i++) { await tester.enterText(boxes.at(i), '1'); await tester.pump(); } await hold(1200); await tester.tap(find.text('Orders')); await hold(); await tester.tap(find.text('Completed')); await hold(); await tester.tap(find.text('Salem, Tamil Nadu')); await hold(1200); expect(find.text('Collected at your door'), findsOneWidget); // Hold the screen so it can be photographed from outside the test. for (var i = 0; i < 40; i++) { await tester.pump(const Duration(milliseconds: 500)); } }); }