intl_phone_number_input icon indicating copy to clipboard operation
intl_phone_number_input copied to clipboard

Number field can't be selected by integration test

Open Navil opened this issue 2 years ago • 0 comments

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):

  • Android

Navil avatar Jan 18 '23 17:01 Navil