Skip to content

Commit

Permalink
Revert "Remove per-test timeouts from integration tests (flutter#85098)…
Browse files Browse the repository at this point in the history
…" (flutter#85133)

This reverts commit b96c3c2.
  • Loading branch information
dnfield authored Jun 23, 2021
1 parent b96c3c2 commit 69f2f8a
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:async';
import 'package:integration_test/integration_test_driver.dart' as driver;

Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic>? data) async {
await driver.writeResponseData(
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ Future<void> main() async {
kCullOpacityRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
timeout: const Duration(seconds: 45),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ void main() {
kMultiWidgetConstructionRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
timeout: const Duration(seconds: 45),
);
}
3 changes: 2 additions & 1 deletion dev/benchmarks/macrobenchmarks/test/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void macroPerfTestE2E(
String routeName, {
Duration pageDelay,
Duration duration = const Duration(seconds: 3),
Duration timeout = const Duration(seconds: 30),
ControlCallback body,
ControlCallback setup,
}) {
Expand Down Expand Up @@ -62,5 +63,5 @@ void macroPerfTestE2E(
}
await durationFuture;
});
}, semanticsEnabled: false);
}, semanticsEnabled: false, timeout: Timeout(timeout));
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ void main() {
kCullOpacityRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
timeout: const Duration(minutes: 2),
);
}
1 change: 1 addition & 0 deletions dev/benchmarks/macrobenchmarks/test_driver/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'package:integration_test/integration_test_driver.dart' as driver;

Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic> data) async {
await driver.writeResponseData(
data['performance'] as Map<String, dynamic>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:io';
import 'package:integration_test/integration_test_driver.dart' as driver;

Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 1),
responseDataCallback: (Map<String, dynamic> data) async {
final Map<String, dynamic> benchmarkLiveResult =
data['benchmarkLive'] as Map<String,dynamic>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ void main() {
kMultiWidgetConstructionRouteName,
pageDelay: const Duration(seconds: 1),
duration: const Duration(seconds: 10),
timeout: const Duration(seconds: 45),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void main() {
macroPerfTest(
'picture_cache_perf',
kPictureCacheRouteName,
timeout: const Duration(seconds: 60),
pageDelay: const Duration(seconds: 1),
driverOps: (FlutterDriver driver) async {
final SerializableFinder tabBarView = find.byValueKey('tabbar_view');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void main() {
await file.writeAsString(_encodeJson(<String, dynamic>{
'stack_size': stackSizeInBytes,
}));
});
}, timeout: const Timeout(kTimeout));
}

String _encodeJson(Map<String, dynamic> jsonObject) {
Expand Down
19 changes: 11 additions & 8 deletions dev/benchmarks/macrobenchmarks/test_driver/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:macrobenchmarks/common.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;

const Duration kTimeout = Duration(seconds: 30);

typedef DriverTestCallBack = Future<void> Function(FlutterDriver driver);

Future<void> runDriverTestForRoute(String routeName, DriverTestCallBack body) async {
Expand All @@ -32,13 +34,14 @@ Future<void> runDriverTestForRoute(String routeName, DriverTestCallBack body) as
}

void macroPerfTest(
String testName,
String routeName, {
Duration pageDelay,
Duration duration = const Duration(seconds: 3),
Future<void> Function(FlutterDriver driver) driverOps,
Future<void> Function(FlutterDriver driver) setupOps,
}) {
String testName,
String routeName,
{ Duration pageDelay,
Duration duration = const Duration(seconds: 3),
Duration timeout = kTimeout,
Future<void> Function(FlutterDriver driver) driverOps,
Future<void> Function(FlutterDriver driver) setupOps,
}) {
test(testName, () async {
Timeline timeline;
await runDriverTestForRoute(routeName, (FlutterDriver driver) async {
Expand All @@ -64,5 +67,5 @@ void macroPerfTest(

final TimelineSummary summary = TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(testName, pretty: true);
});
}, timeout: Timeout(timeout));
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ void main() {

final SerializableFinder stockOption =
find.byValueKey('AAPL_symbol_name');
final String symbol = await driver.getText(stockOption);
final String symbol = await driver.getText(stockOption,
timeout: const Duration(milliseconds: 500));

expect(symbol, 'AAPL');
}, skip: 'Needs to be fixed on Fuchsia.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Future<void> main() async {
await driver.tap(tapWindow);
final String windowClickCount = await driver.getText(
find.byValueKey('WindowClickCount'),
timeout: const Duration(seconds: 5),
);
expect(windowClickCount, 'Click count: 1');
});
Expand Down
2 changes: 1 addition & 1 deletion dev/integration_tests/channels/test_driver/main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
if (status != 'complete') {
fail('Failed at step $step with status $status');
}
});
}, timeout: const Timeout(Duration(minutes: 1)));

tearDownAll(() async {
driver.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void main([List<String> args = const <String>[]]) {
..removeAll(kProfiledDemos);
await runDemos(unprofiledDemos.toList(), tester);
},
timeout: const Timeout(Duration(minutes: 5)),
semanticsEnabled: withSemantics,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'package:integration_test/integration_test_driver.dart' as driver;

Future<void> main() => driver.integrationDriver(
timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic>? data) async {
await driver.writeResponseData(
data!['performance'] as Map<String, dynamic>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Future<void> runDemos(List<String> demos, FlutterDriver driver) async {
await driver.scrollUntilVisible(demoList, demoItem,
dyScroll: -48.0,
alignment: 0.5,
timeout: const Duration(seconds: 30),
);

for (int i = 0; i < 2; i += 1) {
Expand Down Expand Up @@ -217,6 +218,6 @@ void main([List<String> args = const <String>[]]) {
await runDemos(unprofiledDemos.toList(), driver);
}

});
}, timeout: const Timeout(Duration(minutes: 5)));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ void main() {

test('check that we are in normal mode', () async {
expect(await driver.requestData('status'), 'log: paint');
await driver.waitForAbsent(find.byType('PerformanceOverlay'));
await driver.waitForAbsent(find.byType('PerformanceOverlay'), timeout: Duration.zero);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ void main() {

test('check that we are showing the performance overlay', () async {
await driver.requestData('status'); // force a reassemble
await driver.waitFor(find.byType('PerformanceOverlay'));
await driver.waitFor(find.byType('PerformanceOverlay'), timeout: Duration.zero);
});
}
2 changes: 1 addition & 1 deletion dev/integration_tests/ui/test_driver/empty_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ void main() {
await driver.close();
});

test('empty', () async {});
test('empty', () async {}, timeout: const Timeout(Duration(minutes: 1)));
});
}
2 changes: 1 addition & 1 deletion dev/integration_tests/ui/test_driver/screenshot_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ void main() {

imageBefore = imageAfter;
}
});
}, timeout: const Timeout(Duration(minutes: 2)));
});
}
2 changes: 1 addition & 1 deletion packages/integration_test/lib/integration_test_driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Future<void> writeResponseData(
///
/// ```
Future<void> integrationDriver({
Duration timeout = const Duration(minutes: 20),
Duration timeout = const Duration(minutes: 1),
ResponseDataCallback? responseDataCallback = writeResponseData,
}) async {
final FlutterDriver driver = await FlutterDriver.connect();
Expand Down

0 comments on commit 69f2f8a

Please sign in to comment.