diff --git a/packages/network_info_plus_watchos/CHANGELOG.md b/packages/network_info_plus_watchos/CHANGELOG.md index 4f9bd90..c2be30a 100644 --- a/packages/network_info_plus_watchos/CHANGELOG.md +++ b/packages/network_info_plus_watchos/CHANGELOG.md @@ -10,7 +10,9 @@ * Example: the start test checks a start without an error, and then the network info, which waits for the location prompt: it is skipped on a fresh install with no one to answer the prompt, unless the run passes - `--dart-define=NIP_PROMPT=true`. + `--dart-define=NIP_PROMPT=true`. The wait for the network info is timed + apart from the 3-second startup check, so it keeps its full 10 seconds + (a minute while someone answers the prompt). ## 0.1.0 diff --git a/packages/network_info_plus_watchos/example/integration_test/watchos_example_start_test.dart b/packages/network_info_plus_watchos/example/integration_test/watchos_example_start_test.dart index f6dc18a..29976c6 100644 --- a/packages/network_info_plus_watchos/example/integration_test/watchos_example_start_test.dart +++ b/packages/network_info_plus_watchos/example/integration_test/watchos_example_start_test.dart @@ -42,8 +42,8 @@ void main() { await Permission.locationWhenInUse.status != PermissionStatus.denied; app.main(); - final Stopwatch elapsed = Stopwatch()..start(); - while (elapsed.elapsed < const Duration(seconds: 3)) { + final Stopwatch startup = Stopwatch()..start(); + while (startup.elapsed < const Duration(seconds: 3)) { await tester.pump(const Duration(milliseconds: 100)); } expect(tester.takeException(), isNull); @@ -55,11 +55,13 @@ void main() { return; } - // The info arrives after the answer and seven native reads. + // The info arrives after the answer and seven native reads. The wait is + // timed on its own, so the startup pump above does not shorten it. final Duration limit = answered ? const Duration(seconds: 10) : const Duration(seconds: 60); final Finder info = find.textContaining('Wifi IPv4:'); - while (info.evaluate().isEmpty && elapsed.elapsed < limit) { + final Stopwatch waited = Stopwatch()..start(); + while (info.evaluate().isEmpty && waited.elapsed < limit) { await tester.pump(const Duration(milliseconds: 100)); }