[testing_app] Fix failing integration tests ()

pull/760/head
Abdullah Deshmukh 4 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.
await tester.tap(find.byKey(ValueKey('remove_icon_5')));
await tester.pumpAndSettle();
await tester.pumpAndSettle(Duration(seconds: 1));
// Verify if it disappears.
expect(find.text('Item 5'), findsNothing);

@ -4,20 +4,4 @@
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() {
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,
);
}
}
},
);
}
Future<void> main() => integrationDriver();

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

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

Loading…
Cancel
Save