[testing_app] Fix failing integration tests (#756)

pull/760/head
Abdullah Deshmukh 5 years ago committed by GitHub
parent 5adf66ba65
commit 59b50ec010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,7 +80,7 @@ void main() {
// Tap on the remove icon. // Tap on the remove icon.
await tester.tap(find.byKey(ValueKey('remove_icon_5'))); await tester.tap(find.byKey(ValueKey('remove_icon_5')));
await tester.pumpAndSettle(); await tester.pumpAndSettle(Duration(seconds: 1));
// Verify if it disappears. // Verify if it disappears.
expect(find.text('Item 5'), findsNothing); expect(find.text('Item 5'), findsNothing);

@ -4,20 +4,4 @@
import 'package:integration_test/integration_test_driver.dart'; import 'package:integration_test/integration_test_driver.dart';
Future<void> main() { Future<void> main() => integrationDriver();
return integrationDriver(
responseDataCallback: (data) async {
// If the tests reported any data, save it to the disk.
if (data != null) {
for (var entry in data.entries) {
print('Writing ${entry.key} to the disk.');
// Default storage destination is the 'build' directory.
await writeResponseData(
entry.value as Map<String, dynamic>,
testOutputFilename: entry.key,
);
}
}
},
);
}

@ -23,96 +23,78 @@ void main() {
final listFinder = find.byType(ListView); final listFinder = find.byType(ListView);
final scroller = tester.widget<ListView>(listFinder).controller; final scroller = tester.widget<ListView>(listFinder).controller;
// Record the performance timeline of the following operations. // Record the performance summary as the app scrolls through
await binding.traceAction( // the list of items.
await binding.watchPerformance(
() async { () async {
// Record the performance summary as the app scrolls through // Quickly scroll all the way down.
// the list of items. await scroller.animateTo(
await binding.watchPerformance( 7000,
() async { duration: const Duration(seconds: 1),
// Quickly scroll all the way down. curve: Curves.linear,
await scroller.animateTo( );
7000, await tester.pumpAndSettle();
duration: const Duration(seconds: 1),
curve: Curves.linear,
);
await tester.pumpAndSettle();
// Quickly scroll back up all the way. // Quickly scroll back up all the way.
await scroller.animateTo( await scroller.animateTo(
-7000, -7000,
duration: const Duration(seconds: 1), duration: const Duration(seconds: 1),
curve: Curves.linear, curve: Curves.linear,
);
await tester.pumpAndSettle();
},
// Send the performance summary to the driver.
reportKey: 'scrolling_summary',
); );
await tester.pumpAndSettle();
}, },
// Send the timeline data to the driver. // Send the performance summary to the driver.
// This timeline can be opened in the Chrome browser's tracing tools reportKey: 'scrolling_summary',
// by navigating to chrome://tracing.
reportKey: 'scrolling_timeline',
); );
}); });
testWidgets('Favorites operations test', (tester) async { testWidgets('Favorites operations test', (tester) async {
await tester.pumpWidget(TestingApp()); await tester.pumpWidget(TestingApp());
// Record the performance timeline of the following operations. // Record the performance summary as operations are performed
await binding.traceAction( // on the favorites list.
await binding.watchPerformance(
() async { () async {
// Record the performance summary as operations are performed // Create a list of icon keys.
// on the favorites list. final iconKeys = [
await binding.watchPerformance( 'icon_0',
() async { 'icon_1',
// Create a list of icon keys. 'icon_2',
final iconKeys = [ ];
'icon_0',
'icon_1',
'icon_2',
];
// Add first three items to favorites. // Add first three items to favorites.
for (var icon in iconKeys) { for (var icon in iconKeys) {
// Tap onto the icon. // Tap onto the icon.
await tester.tap(find.byKey(ValueKey(icon))); await tester.tap(find.byKey(ValueKey(icon)));
await tester.pumpAndSettle(); await tester.pumpAndSettle(Duration(seconds: 1));
// Verify if appropriate message appears. // Verify if appropriate message appears.
expect(find.text('Added to favorites.'), findsOneWidget); expect(find.text('Added to favorites.'), findsOneWidget);
} }
// Tap onto the favorites button on the AppBar. // Tap onto the favorites button on the AppBar.
// The Favorites List should appear. // The Favorites List should appear.
await tester.tap(find.text('Favorites')); await tester.tap(find.text('Favorites'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final removeIconKeys = [ final removeIconKeys = [
'remove_icon_0', 'remove_icon_0',
'remove_icon_1', 'remove_icon_1',
'remove_icon_2', 'remove_icon_2',
]; ];
// Remove all the items from favorites. // Remove all the items from favorites.
for (final iconKey in removeIconKeys) { for (final iconKey in removeIconKeys) {
// Tap onto the remove icon. // Tap onto the remove icon.
await tester.tap(find.byKey(ValueKey(iconKey))); await tester.tap(find.byKey(ValueKey(iconKey)));
await tester.pumpAndSettle(); await tester.pumpAndSettle(Duration(seconds: 1));
// Verify if appropriate message appears. // Verify if appropriate message appears.
expect(find.text('Removed from favorites.'), findsOneWidget); expect(find.text('Removed from favorites.'), findsOneWidget);
} }
},
// Send the performance summary to the driver.
reportKey: 'favorites_operations_summary',
);
}, },
// Send the timeline data to the driver. // Send the performance summary to the driver.
// This timeline can be opened in the Chrome browser's tracing tools reportKey: 'favorites_operations_summary',
// by navigating to chrome://tracing.
reportKey: 'favorites_operations_timeline',
); );
}); });
}); });

@ -35,28 +35,28 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.3" version: "2.5.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.5" version: "1.1.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.3" version: "1.2.0"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
@ -70,14 +70,14 @@ packages:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.5" version: "1.15.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
@ -112,14 +112,14 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.3" version: "1.2.0"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.0-nullsafety.4" version: "6.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -195,14 +195,14 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety.3" version: "0.12.10"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.6" version: "1.3.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -251,7 +251,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.3" version: "1.8.0"
pedantic: pedantic:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -265,21 +265,21 @@ packages:
name: platform name: platform
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0-nullsafety.4" version: "3.0.0"
pool: pool:
dependency: transitive dependency: transitive
description: description:
name: pool name: pool
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.0-nullsafety.3" version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
name: process name: process
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0-nullsafety.4" version: "4.0.0"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
@ -333,42 +333,42 @@ packages:
name: source_map_stack_trace name: source_map_stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.4" version: "2.1.0"
source_maps: source_maps:
dependency: transitive dependency: transitive
description: description:
name: source_maps name: source_maps
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.10-nullsafety.3" version: "0.10.10"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.4" version: "1.8.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.6" version: "1.10.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0"
sync_http: sync_http:
dependency: transitive dependency: transitive
description: description:
@ -382,42 +382,42 @@ packages:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.3" version: "1.2.0"
test: test:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: test name: test
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0-nullsafety.17" version: "1.16.0-nullsafety.19"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety.6" version: "0.2.19"
test_core: test_core:
dependency: transitive dependency: transitive
description: description:
name: test_core name: test_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.12-nullsafety.15" version: "0.3.12-nullsafety.17"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.5" version: "1.3.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.5" version: "2.1.0"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save