natintosh / intl_phone_number_input

MIT License
164 stars 496 forks source link

Number field can't be selected by integration test #367

Open Navil opened 1 year ago

Navil commented 1 year ago

Describe the bug Within my integration tests, I can not manage to find the input field of the phone field. I ran following code:

var phoneInput = find.byKey(const Key("intl_text_input_key"));
await tester.pumpUntilFound(tester, phoneInput);
await tester.tap(phoneInput);

Future<void> pumpUntilFound(
    WidgetTester tester,
    Finder finder, {
    Duration timeout = const Duration(seconds: 20),
  }) async {
    final end = DateTime.now().add(timeout);

    do {
      if (DateTime.now().isAfter(end)) {
        throw Exception('Timed out waiting for $finder');
      }

      await tester.pumpAndSettle();
      await Future.delayed(const Duration(milliseconds: 100));
    } while (finder.evaluate().isEmpty);
  }

The documention is sadly still using flutter_driver and is thus outdated.

Package version 0.7.1

Flutter version 3.3.10

To Reproduce Steps to reproduce the behavior:

  1. Run integration test
  2. Navigate to screen with text input
  3. Widget will not be found by key

Expected behavior The input field should be selected correctly.

Targeted platforms (please complete the following information):