mirror of
https://github.com/flutter/flutter
synced 2024-09-13 21:32:11 +00:00
Remove our extra timeout logic. (#89952)
This commit is contained in:
parent
5d9afaa0f7
commit
2420718389
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('flutter_test timeout logic - addTime - negative', (WidgetTester tester) async {
|
|
||||||
await tester.runAsync(() async {
|
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 3500)); // must be more than 1000ms more than the initial timeout
|
|
||||||
}, additionalTime: const Duration(milliseconds: 200));
|
|
||||||
}, initialTimeout: const Duration(milliseconds: 2000));
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
|
||||||
// found in the LICENSE file.
|
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('flutter_test timeout logic - addTime - positive', (WidgetTester tester) async {
|
|
||||||
await tester.runAsync(() async {
|
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 2500)); // must be longer than initial timeout below.
|
|
||||||
}, additionalTime: const Duration(milliseconds: 2000)); // initial timeout is 2s, so this makes it 4s.
|
|
||||||
}, initialTimeout: const Duration(milliseconds: 2000));
|
|
||||||
}
|
|
|
@ -568,9 +568,9 @@ Future<void> verifyIntegrationTestTimeouts(String workingDirectory) async {
|
||||||
if (errors.isNotEmpty) {
|
if (errors.isNotEmpty) {
|
||||||
exitWithError(<String>[
|
exitWithError(<String>[
|
||||||
if (errors.length == 1)
|
if (errors.length == 1)
|
||||||
'${bold}An error was detected when looking at import dependencies within the flutter_tools package:$reset'
|
'${bold}An error was detected when looking at integration test timeouts:$reset'
|
||||||
else
|
else
|
||||||
'${bold}Multiple errors were detected when looking at import dependencies within the flutter_tools package:$reset',
|
'${bold}Multiple errors were detected when looking at integration test timeouts:$reset',
|
||||||
...errors.map((String paragraph) => '$paragraph\n'),
|
...errors.map((String paragraph) => '$paragraph\n'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,83 +190,65 @@ Future<void> _runSmokeTests() async {
|
||||||
// Verify that the tests actually return failure on failure and success on
|
// Verify that the tests actually return failure on failure and success on
|
||||||
// success.
|
// success.
|
||||||
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
|
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
|
||||||
// We run the "pass" and "fail" smoke tests first, and alone, because those
|
|
||||||
// are particularly critical and sensitive. If one of these fails, there's no
|
// We want to run the smoketests in parallel, because they each take some time
|
||||||
// point even trying the others.
|
// to run (e.g. compiling), so we don't want to run them in series, especially
|
||||||
|
// on 20-core machines. However, we have a race condition, so for now...
|
||||||
|
// Race condition issue: https://github.com/flutter/flutter/issues/90026
|
||||||
final List<ShardRunner> tests = <ShardRunner>[
|
final List<ShardRunner> tests = <ShardRunner>[
|
||||||
() => _runFlutterTest(
|
() => _runFlutterTest(
|
||||||
automatedTests,
|
automatedTests,
|
||||||
script: path.join('test_smoke_test', 'pass_test.dart'),
|
script: path.join('test_smoke_test', 'pass_test.dart'),
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
),
|
),
|
||||||
() => _runFlutterTest(
|
() => _runFlutterTest(
|
||||||
automatedTests,
|
automatedTests,
|
||||||
script: path.join('test_smoke_test', 'fail_test.dart'),
|
script: path.join('test_smoke_test', 'fail_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
),
|
),
|
||||||
// We run the timeout tests individually because they are timing-sensitive.
|
|
||||||
() => _runFlutterTest(
|
() => _runFlutterTest(
|
||||||
automatedTests,
|
automatedTests,
|
||||||
script: path.join('test_smoke_test', 'timeout_pass_test.dart'),
|
script: path.join('test_smoke_test', 'pending_timer_fail_test.dart'),
|
||||||
expectFailure: false,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
),
|
outputChecker: (CommandResult result) {
|
||||||
|
return result.flattenedStdout!.contains('failingPendingTimerTest')
|
||||||
|
? null
|
||||||
|
: 'Failed to find the stack trace for the pending Timer.\n\n'
|
||||||
|
'stdout:\n${result.flattenedStdout}\n\n'
|
||||||
|
'stderr:\n${result.flattenedStderr}';
|
||||||
|
}),
|
||||||
() => _runFlutterTest(
|
() => _runFlutterTest(
|
||||||
automatedTests,
|
automatedTests,
|
||||||
script: path.join('test_smoke_test', 'timeout_fail_test.dart'),
|
script: path.join('test_smoke_test', 'crash1_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false,
|
printOutput: false,
|
||||||
),
|
),
|
||||||
() => _runFlutterTest(automatedTests,
|
() => _runFlutterTest(
|
||||||
script:
|
automatedTests,
|
||||||
path.join('test_smoke_test', 'pending_timer_fail_test.dart'),
|
script: path.join('test_smoke_test', 'crash2_test.dart'),
|
||||||
expectFailure: true,
|
expectFailure: true,
|
||||||
printOutput: false, outputChecker: (CommandResult result) {
|
printOutput: false,
|
||||||
return result.flattenedStdout!.contains('failingPendingTimerTest')
|
),
|
||||||
? null
|
() => _runFlutterTest(
|
||||||
: 'Failed to find the stack trace for the pending Timer.';
|
automatedTests,
|
||||||
}),
|
script: path.join('test_smoke_test', 'syntax_error_test.broken_dart'),
|
||||||
// We run the remaining smoketests in parallel, because they each take some
|
expectFailure: true,
|
||||||
// time to run (e.g. compiling), so we don't want to run them in series,
|
printOutput: false,
|
||||||
// especially on 20-core machines...
|
),
|
||||||
() => Future.wait<void>(
|
() => _runFlutterTest(
|
||||||
<Future<void>>[
|
automatedTests,
|
||||||
_runFlutterTest(
|
script: path.join('test_smoke_test', 'missing_import_test.broken_dart'),
|
||||||
automatedTests,
|
expectFailure: true,
|
||||||
script: path.join('test_smoke_test', 'crash1_test.dart'),
|
printOutput: false,
|
||||||
expectFailure: true,
|
),
|
||||||
printOutput: false,
|
() => _runFlutterTest(
|
||||||
),
|
automatedTests,
|
||||||
_runFlutterTest(
|
script: path.join('test_smoke_test', 'disallow_error_reporter_modification_test.dart'),
|
||||||
automatedTests,
|
expectFailure: true,
|
||||||
script: path.join('test_smoke_test', 'crash2_test.dart'),
|
printOutput: false,
|
||||||
expectFailure: true,
|
),
|
||||||
printOutput: false,
|
|
||||||
),
|
|
||||||
_runFlutterTest(
|
|
||||||
automatedTests,
|
|
||||||
script:
|
|
||||||
path.join('test_smoke_test', 'syntax_error_test.broken_dart'),
|
|
||||||
expectFailure: true,
|
|
||||||
printOutput: false,
|
|
||||||
),
|
|
||||||
_runFlutterTest(
|
|
||||||
automatedTests,
|
|
||||||
script: path.join(
|
|
||||||
'test_smoke_test', 'missing_import_test.broken_dart'),
|
|
||||||
expectFailure: true,
|
|
||||||
printOutput: false,
|
|
||||||
),
|
|
||||||
_runFlutterTest(
|
|
||||||
automatedTests,
|
|
||||||
script: path.join('test_smoke_test',
|
|
||||||
'disallow_error_reporter_modification_test.dart'),
|
|
||||||
expectFailure: true,
|
|
||||||
printOutput: false,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
List<ShardRunner> testsToRun;
|
List<ShardRunner> testsToRun;
|
||||||
|
@ -785,8 +767,9 @@ Future<void> _runFrameworkTests() async {
|
||||||
outputChecker: (CommandResult result) {
|
outputChecker: (CommandResult result) {
|
||||||
final Iterable<Match> matches = httpClientWarning.allMatches(result.flattenedStdout!);
|
final Iterable<Match> matches = httpClientWarning.allMatches(result.flattenedStdout!);
|
||||||
if (matches == null || matches.isEmpty || matches.length > 1) {
|
if (matches == null || matches.isEmpty || matches.length > 1) {
|
||||||
return 'Failed to print warning about HttpClientUsage, or printed it too many times.\n'
|
return 'Failed to print warning about HttpClientUsage, or printed it too many times.\n\n'
|
||||||
'stdout:\n${result.flattenedStdout}';
|
'stdout:\n${result.flattenedStdout}\n\n'
|
||||||
|
'stderr:\n${result.flattenedStderr}';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
@ -1773,9 +1756,9 @@ List<T> _selectIndexOfTotalSubshard<T>(List<T> tests, {String subshardKey = kSub
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int testsPerShard = tests.length ~/ total;
|
final int testsPerShard = (tests.length / total).ceil();
|
||||||
final int start = (index - 1) * testsPerShard;
|
final int start = (index - 1) * testsPerShard;
|
||||||
final int end = index * testsPerShard;
|
final int end = math.min(index * testsPerShard, tests.length);
|
||||||
|
|
||||||
print('Selecting subshard $index of $total (range ${start + 1}-$end of ${tests.length})');
|
print('Selecting subshard $index of $total (range ${start + 1}-$end of ${tests.length})');
|
||||||
return tests.sublist(start, end);
|
return tests.sublist(start, end);
|
||||||
|
|
|
@ -109,19 +109,19 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
test('subshards tests correctly', () async {
|
test('subshards tests correctly', () async {
|
||||||
|
// When updating this test, try to pick shard numbers that ensure we're checking
|
||||||
|
// that unequal test distributions don't miss tests.
|
||||||
ProcessResult result = await runScript(
|
ProcessResult result = await runScript(
|
||||||
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '1_3'},
|
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '1_3'},
|
||||||
);
|
);
|
||||||
expectExitCode(result, 0);
|
expectExitCode(result, 0);
|
||||||
// There are currently 6 smoke tests. This shard should contain test 1 and 2.
|
expect(result.stdout, contains('Selecting subshard 1 of 3 (range 1-3 of 8)'));
|
||||||
expect(result.stdout, contains('Selecting subshard 1 of 3 (range 1-2 of 6)'));
|
|
||||||
|
|
||||||
result = await runScript(
|
result = await runScript(
|
||||||
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '5_6'},
|
<String, String>{'SHARD': 'smoke_tests', 'SUBSHARD': '3_3'},
|
||||||
);
|
);
|
||||||
expectExitCode(result, 0);
|
expectExitCode(result, 0);
|
||||||
// This shard should contain only test 5.
|
expect(result.stdout, contains('Selecting subshard 3 of 3 (range 7-8 of 8)'));
|
||||||
expect(result.stdout, contains('Selecting subshard 5 of 6 (range 5-5 of 6)'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('exits with code 1 when SUBSHARD index greater than total', () async {
|
test('exits with code 1 when SUBSHARD index greater than total', () async {
|
||||||
|
|
|
@ -491,7 +491,6 @@ void main() {
|
||||||
final String themeName = themeNames[themeIndex];
|
final String themeName = themeNames[themeIndex];
|
||||||
|
|
||||||
testWidgets('backdrop_demo $themeName', (WidgetTester tester) async {
|
testWidgets('backdrop_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const BackdropDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const BackdropDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -499,7 +498,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('bottom_app_bar_demo $themeName', (WidgetTester tester) async {
|
testWidgets('bottom_app_bar_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomAppBarDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomAppBarDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -507,7 +505,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async {
|
testWidgets('bottom_navigation_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomNavigationDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const BottomNavigationDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -515,7 +512,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('buttons_demo $themeName', (WidgetTester tester) async {
|
testWidgets('buttons_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ButtonsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ButtonsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -523,7 +519,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('cards_demo $themeName', (WidgetTester tester) async {
|
testWidgets('cards_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const CardsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const CardsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -531,7 +526,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('chip_demo $themeName', (WidgetTester tester) async {
|
testWidgets('chip_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ChipDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ChipDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -539,7 +533,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('data_table_demo $themeName', (WidgetTester tester) async {
|
testWidgets('data_table_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const DataTableDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const DataTableDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -547,7 +540,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('date_and_time_picker_demo $themeName', (WidgetTester tester) async {
|
testWidgets('date_and_time_picker_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const DateAndTimePickerDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const DateAndTimePickerDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -555,7 +547,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('dialog_demo $themeName', (WidgetTester tester) async {
|
testWidgets('dialog_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const DialogDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const DialogDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -563,7 +554,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('drawer_demo $themeName', (WidgetTester tester) async {
|
testWidgets('drawer_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const DrawerDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const DrawerDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -571,7 +561,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('elevation_demo $themeName', (WidgetTester tester) async {
|
testWidgets('elevation_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ElevationDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ElevationDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -579,7 +568,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('expansion_panels_demo $themeName', (WidgetTester tester) async {
|
testWidgets('expansion_panels_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionPanelsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionPanelsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -587,7 +575,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('grid_list_demo $themeName', (WidgetTester tester) async {
|
testWidgets('grid_list_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const GridListDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const GridListDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -595,7 +582,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('icons_demo $themeName', (WidgetTester tester) async {
|
testWidgets('icons_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const IconsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const IconsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -603,7 +589,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('leave_behind_demo $themeName', (WidgetTester tester) async {
|
testWidgets('leave_behind_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const LeaveBehindDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const LeaveBehindDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -611,7 +596,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('list_demo $themeName', (WidgetTester tester) async {
|
testWidgets('list_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ListDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ListDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -619,7 +603,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('menu_demo $themeName', (WidgetTester tester) async {
|
testWidgets('menu_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const MenuDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const MenuDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -627,7 +610,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('modal_bottom_sheet_demo $themeName', (WidgetTester tester) async {
|
testWidgets('modal_bottom_sheet_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: theme, home: const ModalBottomSheetDemo())
|
MaterialApp(theme: theme, home: const ModalBottomSheetDemo())
|
||||||
|
@ -637,7 +619,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('overscroll_demo', (WidgetTester tester) async {
|
testWidgets('overscroll_demo', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
|
await tester.pumpWidget(const MaterialApp(home: OverscrollDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -645,7 +626,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('page_selector_demo $themeName', (WidgetTester tester) async {
|
testWidgets('page_selector_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const PageSelectorDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const PageSelectorDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -653,7 +633,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('persistent_bottom_sheet_demo $themeName', (WidgetTester tester) async {
|
testWidgets('persistent_bottom_sheet_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: theme, home: const PersistentBottomSheetDemo())
|
MaterialApp(theme: theme, home: const PersistentBottomSheetDemo())
|
||||||
|
@ -663,7 +642,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('progress_indicator_demo $themeName', (WidgetTester tester) async {
|
testWidgets('progress_indicator_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ProgressIndicatorDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ProgressIndicatorDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -671,7 +649,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('reorderable_list_demo $themeName', (WidgetTester tester) async {
|
testWidgets('reorderable_list_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ReorderableListDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ReorderableListDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -679,7 +656,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('scrollable_tabs_demo $themeName', (WidgetTester tester) async {
|
testWidgets('scrollable_tabs_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ScrollableTabsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ScrollableTabsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -687,7 +663,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('search_demo $themeName', (WidgetTester tester) async {
|
testWidgets('search_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const SearchDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const SearchDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -695,7 +670,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('selection_controls_demo $themeName', (WidgetTester tester) async {
|
testWidgets('selection_controls_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const SelectionControlsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const SelectionControlsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -703,7 +677,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('slider_demo $themeName', (WidgetTester tester) async {
|
testWidgets('slider_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const SliderDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const SliderDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -711,7 +684,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('snack_bar_demo $themeName', (WidgetTester tester) async {
|
testWidgets('snack_bar_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(theme: theme, home: const SnackBarDemo())
|
MaterialApp(theme: theme, home: const SnackBarDemo())
|
||||||
|
@ -721,7 +693,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('tabs_demo $themeName', (WidgetTester tester) async {
|
testWidgets('tabs_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -729,7 +700,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('tabs_fab_demo $themeName', (WidgetTester tester) async {
|
testWidgets('tabs_fab_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsFabDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const TabsFabDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -737,7 +707,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('text_form_field_demo $themeName', (WidgetTester tester) async {
|
testWidgets('text_form_field_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const TextFormFieldDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const TextFormFieldDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -745,7 +714,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('tooltip_demo $themeName', (WidgetTester tester) async {
|
testWidgets('tooltip_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const TooltipDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const TooltipDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
@ -753,7 +721,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('expansion_tile_list_demo $themeName', (WidgetTester tester) async {
|
testWidgets('expansion_tile_list_demo $themeName', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 3));
|
|
||||||
final SemanticsHandle handle = tester.ensureSemantics();
|
final SemanticsHandle handle = tester.ensureSemantics();
|
||||||
await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionTileListDemo()));
|
await tester.pumpWidget(MaterialApp(theme: theme, home: const ExpansionTileListDemo()));
|
||||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <url_launcher_windows/url_launcher_plugin.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
UrlLauncherPluginRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherPlugin"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets("BackdropFilter's cull rect does not shrink", (WidgetTester tester) async {
|
testWidgets("BackdropFilter's cull rect does not shrink", (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 15));
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
|
@ -51,7 +50,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('BackdropFilter blendMode on saveLayer', (WidgetTester tester) async {
|
testWidgets('BackdropFilter blendMode on saveLayer', (WidgetTester tester) async {
|
||||||
tester.binding.addTime(const Duration(seconds: 15));
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
|
|
|
@ -2522,7 +2522,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
|
||||||
final ui.Codec codec = await ui.instantiateImageCodec(base64.decode(base64Screenshot));
|
final ui.Codec codec = await ui.instantiateImageCodec(base64.decode(base64Screenshot));
|
||||||
final ui.FrameInfo frame = await codec.getNextFrame();
|
final ui.FrameInfo frame = await codec.getNextFrame();
|
||||||
return frame.image;
|
return frame.image;
|
||||||
}, additionalTime: const Duration(seconds: 11)))!;
|
}))!;
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
screenshotImage,
|
screenshotImage,
|
||||||
|
|
|
@ -238,45 +238,28 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
@protected
|
@protected
|
||||||
bool get registerTestTextInput => true;
|
bool get registerTestTextInput => true;
|
||||||
|
|
||||||
/// Increase the timeout for the current test by the given duration.
|
/// This method has no effect.
|
||||||
///
|
///
|
||||||
/// This only matters if the test has an `initialTimeout` set on
|
/// This method was previously used to change the timeout of the test. However,
|
||||||
/// [testWidgets], and the test is running via `flutter test`. By default,
|
/// in practice having short timeouts was found to be nothing but trouble,
|
||||||
/// tests do not have such a timeout. Tests run using `flutter run` never time
|
/// primarily being a cause flakes rather than helping debug tests.
|
||||||
/// out even if one is specified.
|
|
||||||
///
|
///
|
||||||
/// This method has no effect on the timeout specified via `timeout` on
|
/// For this reason, this method has been deprecated.
|
||||||
/// [testWidgets]. That timeout is implemented by the `test` package.
|
@Deprecated(
|
||||||
///
|
'This method has no effect. '
|
||||||
/// By default, each [pump] and [WidgetTester.pumpWidget] call increases the
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
/// timeout by a hundred milliseconds, and each [matchesGoldenFile]
|
)
|
||||||
/// expectation increases it by a minute. If there is no timeout in the first
|
void addTime(Duration duration) { }
|
||||||
/// place, this has no effect.
|
|
||||||
///
|
|
||||||
/// The granularity of timeouts is coarse: the time is checked once per
|
|
||||||
/// second, and only when the test is not executing. It is therefore possible
|
|
||||||
/// for a timeout to be exceeded by hundreds of milliseconds and for the test
|
|
||||||
/// to still succeed. If precise timing is required, it should be implemented
|
|
||||||
/// as a part of the test rather than relying on this mechanism.
|
|
||||||
///
|
|
||||||
/// See also:
|
|
||||||
///
|
|
||||||
/// * [testWidgets], on which a timeout can be set using the `timeout`
|
|
||||||
/// argument.
|
|
||||||
/// * [defaultTestTimeout], the maximum that the timeout can reach.
|
|
||||||
/// (That timeout is implemented by the `test` package.)
|
|
||||||
// See AutomatedTestWidgetsFlutterBinding.addTime for an actual implementation.
|
|
||||||
void addTime(Duration duration);
|
|
||||||
|
|
||||||
/// Delay for `duration` of time.
|
/// Delay for `duration` of time.
|
||||||
///
|
///
|
||||||
/// In the automated test environment ([AutomatedTestWidgetsFlutterBinding],
|
/// In the automated test environment ([AutomatedTestWidgetsFlutterBinding],
|
||||||
/// typically used in `flutter test`), this advances the fake [clock] for the
|
/// typically used in `flutter test`), this advances the fake [clock] for the
|
||||||
/// period and also increases timeout (see [addTime]).
|
/// period.
|
||||||
///
|
///
|
||||||
/// In the live test environment ([LiveTestWidgetsFlutterBinding], typically
|
/// In the live test environment ([LiveTestWidgetsFlutterBinding], typically
|
||||||
/// used for `flutter run` and for [e2e](https://pub.dev/packages/e2e)), it is
|
/// used for `flutter run` and for [e2e](https://pub.dev/packages/e2e)), it is
|
||||||
/// equivalent as [Future.delayed].
|
/// equivalent to [Future.delayed].
|
||||||
Future<void> delayed(Duration duration);
|
Future<void> delayed(Duration duration);
|
||||||
|
|
||||||
/// Creates and initializes the binding. This function is
|
/// Creates and initializes the binding. This function is
|
||||||
|
@ -324,15 +307,12 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
/// The number of outstanding microtasks in the queue.
|
/// The number of outstanding microtasks in the queue.
|
||||||
int get microtaskCount;
|
int get microtaskCount;
|
||||||
|
|
||||||
/// The default maximum test timeout for tests when using this binding.
|
/// The default test timeout for tests when using this binding.
|
||||||
///
|
///
|
||||||
/// This controls the default for the `timeout` argument on `testWidgets`. It
|
/// This controls the default for the `timeout` argument on [testWidgets]. It
|
||||||
/// is 10 minutes for [AutomatedTestWidgetsFlutterBinding] (tests running
|
/// is 10 minutes for [AutomatedTestWidgetsFlutterBinding] (tests running
|
||||||
/// using `flutter test`), and unlimited for tests using
|
/// using `flutter test`), and unlimited for tests using
|
||||||
/// [LiveTestWidgetsFlutterBinding] (tests running using `flutter run`).
|
/// [LiveTestWidgetsFlutterBinding] (tests running using `flutter run`).
|
||||||
///
|
|
||||||
/// This is the maximum that the timeout controlled by `initialTimeout` on
|
|
||||||
/// [testWidgets] can reach when augmented using [addTime].
|
|
||||||
test_package.Timeout get defaultTestTimeout;
|
test_package.Timeout get defaultTestTimeout;
|
||||||
|
|
||||||
/// The current time.
|
/// The current time.
|
||||||
|
@ -379,12 +359,14 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
/// this method again. Attempts to do otherwise will result in a
|
/// this method again. Attempts to do otherwise will result in a
|
||||||
/// [TestFailure] error being thrown.
|
/// [TestFailure] error being thrown.
|
||||||
///
|
///
|
||||||
/// The `additionalTime` argument is used by the
|
/// The `additionalTime` argument was previously used with
|
||||||
/// [AutomatedTestWidgetsFlutterBinding] implementation to increase the
|
/// [AutomatedTestWidgetsFlutterBinding.addTime] but now has no effect.
|
||||||
/// current timeout, if any. See [AutomatedTestWidgetsFlutterBinding.addTime]
|
|
||||||
/// for details.
|
|
||||||
Future<T?> runAsync<T>(
|
Future<T?> runAsync<T>(
|
||||||
Future<T> Function() callback, {
|
Future<T> Function() callback, {
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -621,10 +603,16 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
/// The `description` is used by the [LiveTestWidgetsFlutterBinding] to
|
/// The `description` is used by the [LiveTestWidgetsFlutterBinding] to
|
||||||
/// show a label on the screen during the test. The description comes from
|
/// show a label on the screen during the test. The description comes from
|
||||||
/// the value passed to [testWidgets]. It must not be null.
|
/// the value passed to [testWidgets]. It must not be null.
|
||||||
///
|
Future<void> runTest(
|
||||||
/// The `timeout` argument sets the initial timeout, if any. It can
|
Future<void> Function() testBody,
|
||||||
/// be increased with [addTime]. By default there is no timeout.
|
VoidCallback invariantTester, {
|
||||||
Future<void> runTest(Future<void> Function() testBody, VoidCallback invariantTester, { String description = '', Duration? timeout });
|
String description = '',
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
|
Duration? timeout,
|
||||||
|
});
|
||||||
|
|
||||||
/// This is called during test execution before and after the body has been
|
/// This is called during test execution before and after the body has been
|
||||||
/// executed.
|
/// executed.
|
||||||
|
@ -667,9 +655,8 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
Future<void> _runTest(
|
Future<void> _runTest(
|
||||||
Future<void> Function() testBody,
|
Future<void> Function() testBody,
|
||||||
VoidCallback invariantTester,
|
VoidCallback invariantTester,
|
||||||
String description, {
|
String description,
|
||||||
Future<void>? timeout,
|
) {
|
||||||
}) {
|
|
||||||
assert(description != null);
|
assert(description != null);
|
||||||
assert(inTest);
|
assert(inTest);
|
||||||
_oldExceptionHandler = FlutterError.onError;
|
_oldExceptionHandler = FlutterError.onError;
|
||||||
|
@ -794,7 +781,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||||
final Zone testZone = _parentZone!.fork(specification: errorHandlingZoneSpecification);
|
final Zone testZone = _parentZone!.fork(specification: errorHandlingZoneSpecification);
|
||||||
testZone.runBinary<Future<void>, Future<void> Function(), VoidCallback>(_runTestBody, testBody, invariantTester)
|
testZone.runBinary<Future<void>, Future<void> Function(), VoidCallback>(_runTestBody, testBody, invariantTester)
|
||||||
.whenComplete(testCompletionHandler);
|
.whenComplete(testCompletionHandler);
|
||||||
timeout?.catchError(handleUncaughtError);
|
|
||||||
return testCompleter.future;
|
return testCompleter.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,9 +962,9 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
@override
|
@override
|
||||||
bool get disableShadows => true;
|
bool get disableShadows => true;
|
||||||
|
|
||||||
/// The value of [defaultTestTimeout] can be set to `None` to enable debugging flutter tests where
|
/// The value of [defaultTestTimeout] can be set to `None` to enable debugging
|
||||||
/// we would not want to timeout the test. This is expected to be used by test tooling which
|
/// flutter tests where we would not want to timeout the test. This is
|
||||||
/// can detect debug mode.
|
/// expected to be used by test tooling which can detect debug mode.
|
||||||
@override
|
@override
|
||||||
test_package.Timeout defaultTestTimeout = const test_package.Timeout(Duration(minutes: 10));
|
test_package.Timeout defaultTestTimeout = const test_package.Timeout(Duration(minutes: 10));
|
||||||
|
|
||||||
|
@ -1162,37 +1148,9 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration? _timeout;
|
|
||||||
Stopwatch? _timeoutStopwatch;
|
|
||||||
Timer? _timeoutTimer;
|
|
||||||
Completer<void>? _timeoutCompleter;
|
|
||||||
|
|
||||||
void _checkTimeout(Timer timer) {
|
|
||||||
assert(_timeoutTimer == timer);
|
|
||||||
assert(_timeout != null);
|
|
||||||
assert(_timeoutCompleter != null);
|
|
||||||
assert(_timeoutStopwatch != null);
|
|
||||||
if (_timeoutStopwatch!.elapsed > _timeout!) {
|
|
||||||
_timeoutCompleter!.completeError(
|
|
||||||
TimeoutException(
|
|
||||||
'The test exceeded the timeout. It may have hung.\n'
|
|
||||||
'Consider using "tester.binding.addTime" to increase the timeout before expensive operations.',
|
|
||||||
_timeout,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void addTime(Duration duration) {
|
|
||||||
if (_timeout != null)
|
|
||||||
_timeout = _timeout! + duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> delayed(Duration duration) {
|
Future<void> delayed(Duration duration) {
|
||||||
assert(_currentFakeAsync != null);
|
assert(_currentFakeAsync != null);
|
||||||
addTime(duration);
|
|
||||||
_currentFakeAsync!.elapse(duration);
|
_currentFakeAsync!.elapse(duration);
|
||||||
return Future<void>.value();
|
return Future<void>.value();
|
||||||
}
|
}
|
||||||
|
@ -1202,6 +1160,10 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
Future<void> Function() testBody,
|
Future<void> Function() testBody,
|
||||||
VoidCallback invariantTester, {
|
VoidCallback invariantTester, {
|
||||||
String description = '',
|
String description = '',
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
}) {
|
}) {
|
||||||
assert(description != null);
|
assert(description != null);
|
||||||
|
@ -1209,13 +1171,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
assert(_currentFakeAsync == null);
|
assert(_currentFakeAsync == null);
|
||||||
assert(_clock == null);
|
assert(_clock == null);
|
||||||
|
|
||||||
_timeout = timeout;
|
|
||||||
if (_timeout != null) {
|
|
||||||
_timeoutStopwatch = Stopwatch()..start();
|
|
||||||
_timeoutTimer = Timer.periodic(const Duration(seconds: 1), _checkTimeout);
|
|
||||||
_timeoutCompleter = Completer<void>();
|
|
||||||
}
|
|
||||||
|
|
||||||
final FakeAsync fakeAsync = FakeAsync();
|
final FakeAsync fakeAsync = FakeAsync();
|
||||||
_currentFakeAsync = fakeAsync; // reset in postTest
|
_currentFakeAsync = fakeAsync; // reset in postTest
|
||||||
_clock = fakeAsync.getClock(DateTime.utc(2015, 1, 1));
|
_clock = fakeAsync.getClock(DateTime.utc(2015, 1, 1));
|
||||||
|
@ -1223,7 +1178,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
fakeAsync.run((FakeAsync localFakeAsync) {
|
fakeAsync.run((FakeAsync localFakeAsync) {
|
||||||
assert(fakeAsync == _currentFakeAsync);
|
assert(fakeAsync == _currentFakeAsync);
|
||||||
assert(fakeAsync == localFakeAsync);
|
assert(fakeAsync == localFakeAsync);
|
||||||
testBodyResult = _runTest(testBody, invariantTester, description, timeout: _timeoutCompleter?.future);
|
testBodyResult = _runTest(testBody, invariantTester, description);
|
||||||
assert(inTest);
|
assert(inTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1286,11 +1241,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
assert(_clock != null);
|
assert(_clock != null);
|
||||||
_clock = null;
|
_clock = null;
|
||||||
_currentFakeAsync = null;
|
_currentFakeAsync = null;
|
||||||
_timeoutCompleter = null;
|
|
||||||
_timeoutTimer?.cancel();
|
|
||||||
_timeoutTimer = null;
|
|
||||||
_timeoutStopwatch = null;
|
|
||||||
_timeout = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1454,12 +1404,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
/// See [LiveTestWidgetsFlutterBindingFramePolicy].
|
/// See [LiveTestWidgetsFlutterBindingFramePolicy].
|
||||||
LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers;
|
LiveTestWidgetsFlutterBindingFramePolicy framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fadePointers;
|
||||||
|
|
||||||
@override
|
|
||||||
void addTime(Duration duration) {
|
|
||||||
// We don't support timeouts on the LiveTestWidgetsFlutterBinding.
|
|
||||||
// See runTest().
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> delayed(Duration duration) {
|
Future<void> delayed(Duration duration) {
|
||||||
return Future<void>.delayed(duration);
|
return Future<void>.delayed(duration);
|
||||||
|
@ -1637,8 +1581,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
);
|
);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
addTime(additionalTime); // doesn't do anything since we don't actually track the timeout, but just for correctness...
|
|
||||||
|
|
||||||
_runningAsyncTasks = true;
|
_runningAsyncTasks = true;
|
||||||
try {
|
try {
|
||||||
return await callback();
|
return await callback();
|
||||||
|
@ -1656,15 +1598,20 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> runTest(Future<void> Function() testBody, VoidCallback invariantTester, { String description = '', Duration? timeout }) async {
|
Future<void> runTest(
|
||||||
|
Future<void> Function() testBody,
|
||||||
|
VoidCallback invariantTester, {
|
||||||
|
String description = '',
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
|
Duration? timeout,
|
||||||
|
}) {
|
||||||
assert(description != null);
|
assert(description != null);
|
||||||
assert(!inTest);
|
assert(!inTest);
|
||||||
_inTest = true;
|
_inTest = true;
|
||||||
_liveTestRenderView._setDescription(description);
|
_liveTestRenderView._setDescription(description);
|
||||||
// We drop the timeout on the floor in `flutter run` mode.
|
|
||||||
// We could support it, but we'd have to automatically add the entire duration of pumps
|
|
||||||
// and timers and so on, since those operate in real time when using this binding, but
|
|
||||||
// the timeouts expect them to happen near-instantaneously.
|
|
||||||
return _runTest(testBody, invariantTester, description);
|
return _runTest(testBody, invariantTester, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,23 +82,13 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
|
||||||
/// The callback can be asynchronous (using `async`/`await` or
|
/// The callback can be asynchronous (using `async`/`await` or
|
||||||
/// using explicit [Future]s).
|
/// using explicit [Future]s).
|
||||||
///
|
///
|
||||||
/// There are two kinds of timeouts that can be specified. The `timeout`
|
/// The `timeout` argument specifies the backstop timeout implemented by the
|
||||||
/// argument specifies the backstop timeout implemented by the `test` package.
|
/// `test` package. If set, it should be relatively large (minutes). It defaults
|
||||||
/// If set, it should be relatively large (minutes). It defaults to ten minutes
|
/// to ten minutes for tests run by `flutter test`, and is unlimited for tests
|
||||||
/// for tests run by `flutter test`, and is unlimited for tests run by `flutter
|
/// run by `flutter run`; specifically, it defaults to
|
||||||
/// run`; specifically, it defaults to
|
/// [TestWidgetsFlutterBinding.defaultTestTimeout]. (The `initialTimeout`
|
||||||
/// [TestWidgetsFlutterBinding.defaultTestTimeout].
|
/// parameter has no effect. It was previously used with
|
||||||
///
|
/// [TestWidgetsFlutterBinding.addTime] but that feature was removed.)
|
||||||
/// The `initialTimeout` argument specifies the timeout implemented by the
|
|
||||||
/// `flutter_test` package itself. If set, it may be relatively small (seconds),
|
|
||||||
/// as it is automatically increased for some expensive operations, and can also
|
|
||||||
/// be manually increased by calling
|
|
||||||
/// [AutomatedTestWidgetsFlutterBinding.addTime]. The effective maximum value of
|
|
||||||
/// this timeout (even after calling `addTime`) is the one specified by the
|
|
||||||
/// `timeout` argument.
|
|
||||||
///
|
|
||||||
/// In general, timeouts are race conditions and cause flakes, so best practice
|
|
||||||
/// is to avoid the use of timeouts in tests.
|
|
||||||
///
|
///
|
||||||
/// If the `semanticsEnabled` parameter is set to `true`,
|
/// If the `semanticsEnabled` parameter is set to `true`,
|
||||||
/// [WidgetTester.ensureSemantics] will have been called before the tester is
|
/// [WidgetTester.ensureSemantics] will have been called before the tester is
|
||||||
|
@ -138,6 +128,10 @@ void testWidgets(
|
||||||
WidgetTesterCallback callback, {
|
WidgetTesterCallback callback, {
|
||||||
bool? skip,
|
bool? skip,
|
||||||
test_package.Timeout? timeout,
|
test_package.Timeout? timeout,
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. Use `timeout` instead. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
Duration? initialTimeout,
|
Duration? initialTimeout,
|
||||||
bool semanticsEnabled = true,
|
bool semanticsEnabled = true,
|
||||||
TestVariant<Object?> variant = const DefaultTestVariant(),
|
TestVariant<Object?> variant = const DefaultTestVariant(),
|
||||||
|
|
|
@ -214,13 +214,16 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
|
||||||
Future<void> Function() testBody,
|
Future<void> Function() testBody,
|
||||||
VoidCallback invariantTester, {
|
VoidCallback invariantTester, {
|
||||||
String description = '',
|
String description = '',
|
||||||
|
@Deprecated(
|
||||||
|
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
|
||||||
|
'This feature was deprecated after v2.6.0-1.0.pre.'
|
||||||
|
)
|
||||||
Duration? timeout,
|
Duration? timeout,
|
||||||
}) async {
|
}) async {
|
||||||
await super.runTest(
|
await super.runTest(
|
||||||
testBody,
|
testBody,
|
||||||
invariantTester,
|
invariantTester,
|
||||||
description: description,
|
description: description,
|
||||||
timeout: timeout,
|
|
||||||
);
|
);
|
||||||
results[description] ??= _success;
|
results[description] ??= _success;
|
||||||
}
|
}
|
||||||
|
@ -411,13 +414,7 @@ https://flutter.dev/docs/testing/integration-tests#testing-on-firebase-test-lab
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Timeout get defaultTestTimeout => _defaultTestTimeout ?? super.defaultTestTimeout;
|
Timeout defaultTestTimeout = Timeout.none;
|
||||||
|
|
||||||
/// Configures the default timeout for [testWidgets].
|
|
||||||
///
|
|
||||||
/// See [TestWidgetsFlutterBinding.defaultTestTimeout] for more details.
|
|
||||||
set defaultTestTimeout(Timeout timeout) => _defaultTestTimeout = timeout;
|
|
||||||
Timeout? _defaultTestTimeout;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void attachRootWidget(Widget rootWidget) {
|
void attachRootWidget(Widget rootWidget) {
|
||||||
|
|
Loading…
Reference in a new issue