@@ -165,9 +165,13 @@ void main() {
165165 await tester.tap (networkDropdown);
166166 await tester.pumpAndSettle ();
167167
168- // Should show all network options
168+ // Should show all network options in dropdown menu
169169 for (final network in SVMNetwork .values) {
170- expect (find.text (network.value.toUpperCase ()), findsOneWidget);
170+ // Look for dropdown menu items specifically, not the selected value
171+ expect (find.descendant (
172+ of: find.byType (DropdownMenuItem <SVMNetwork >),
173+ matching: find.text (network.value.toUpperCase ()),
174+ ), findsOneWidget);
171175 }
172176
173177 // Select a different network
@@ -324,30 +328,25 @@ void main() {
324328 });
325329
326330 testWidgets ('PaymentButton should show error snackbar on failure' , (tester) async {
327- // Create a mock SVMPay that always fails
328- final mockSvmPay = SVMPay (
329- config: const SVMPayConfig (debug: false ),
330- );
331-
332331 await tester.pumpWidget (
333332 MaterialApp (
334333 home: Scaffold (
335334 body: PaymentButton (
336- recipient: 'invalid-address ' , // This will cause failure
335+ recipient: '' , // Empty address will cause validation failure
337336 amount: '1.0' ,
338- svmPay: mockSvmPay,
339337 ),
340338 ),
341339 ),
342340 );
343341
344342 // Tap the button
345343 await tester.tap (find.byType (PaymentButton ));
346- await tester.pumpAndSettle (const Duration (seconds: 3 ));
347-
344+ await tester.pump (); // Initial pump to trigger the async operation
345+ await tester.pump (const Duration (milliseconds: 100 )); // Wait for setState
346+
348347 // Should show error snackbar
349348 expect (find.byType (SnackBar ), findsOneWidget);
350- expect (find.textContaining ('Payment error' ), findsOneWidget);
349+ expect (find.text ('Payment error: Invalid recipient address ' ), findsOneWidget);
351350 });
352351
353352 testWidgets ('Widgets should handle loading states correctly' , (tester) async {
0 commit comments