From 66d5a30de7ab6b185428aac785d24f508a3e2556 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 4 Feb 2021 11:11:03 -0800 Subject: [PATCH] Reland "Migrate driver tests in example/ to NNBD (#75022)" (#75264) --- .../hello_world/test_driver/smoke_web_engine_test.dart | 3 +-- .../platform_channel/test_driver/button_tap_test.dart | 10 +++------- .../test_driver/button_tap_test.dart | 10 +++------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/examples/hello_world/test_driver/smoke_web_engine_test.dart b/examples/hello_world/test_driver/smoke_web_engine_test.dart index 3fdc36746b..2ca900c064 100644 --- a/examples/hello_world/test_driver/smoke_web_engine_test.dart +++ b/examples/hello_world/test_driver/smoke_web_engine_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 import 'dart:async'; import 'package:flutter_driver/flutter_driver.dart'; @@ -15,7 +14,7 @@ void main() { group('Hello World App', () { final SerializableFinder titleFinder = find.byValueKey('title'); - FlutterDriver driver; + late FlutterDriver driver; // Connect to the Flutter driver before running any tests. setUpAll(() async { diff --git a/examples/platform_channel/test_driver/button_tap_test.dart b/examples/platform_channel/test_driver/button_tap_test.dart index e8c200e0f1..53d4c997d1 100644 --- a/examples/platform_channel/test_driver/button_tap_test.dart +++ b/examples/platform_channel/test_driver/button_tap_test.dart @@ -2,23 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(goderbauer): migrate this file to null-safety when flutter_driver is null-safe. -// @dart = 2.9 - import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; void main() { group('button tap test', () { - FlutterDriver driver; + late FlutterDriver driver; setUpAll(() async { driver = await FlutterDriver.connect(); }); tearDownAll(() async { - if (driver != null) - driver.close(); + driver.close(); }); test('tap on the button, verify result', () async { @@ -30,7 +26,7 @@ void main() { await driver.waitFor(button); await driver.tap(button); - String batteryLevel; + String? batteryLevel; while (batteryLevel == null || batteryLevel.contains('unknown')) { batteryLevel = await driver.getText(batteryLevelLabel); } diff --git a/examples/platform_channel_swift/test_driver/button_tap_test.dart b/examples/platform_channel_swift/test_driver/button_tap_test.dart index e8c200e0f1..53d4c997d1 100644 --- a/examples/platform_channel_swift/test_driver/button_tap_test.dart +++ b/examples/platform_channel_swift/test_driver/button_tap_test.dart @@ -2,23 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(goderbauer): migrate this file to null-safety when flutter_driver is null-safe. -// @dart = 2.9 - import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart' hide TypeMatcher, isInstanceOf; void main() { group('button tap test', () { - FlutterDriver driver; + late FlutterDriver driver; setUpAll(() async { driver = await FlutterDriver.connect(); }); tearDownAll(() async { - if (driver != null) - driver.close(); + driver.close(); }); test('tap on the button, verify result', () async { @@ -30,7 +26,7 @@ void main() { await driver.waitFor(button); await driver.tap(button); - String batteryLevel; + String? batteryLevel; while (batteryLevel == null || batteryLevel.contains('unknown')) { batteryLevel = await driver.getText(batteryLevelLabel); }