Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
8c67781f
Unverified
Commit
8c67781f
authored
Jul 07, 2020
by
Mehmet Fidanboylu
Committed by
GitHub
Jul 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments around hanging tests via runAsync. (#60136)
parent
cfc0082d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
binding.dart
packages/flutter_test/lib/src/binding.dart
+1
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+13
-1
No files found.
packages/flutter_test/lib/src/binding.dart
View file @
8c67781f
...
...
@@ -362,7 +362,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
///
/// If `callback` completes with an error, the error will be caught by the
/// Flutter framework and made available via [takeException], and this method
/// will return a future that completes wi
ll
`null`.
/// will return a future that completes wi
th
`null`.
///
/// Re-entrant calls to this method are not allowed; callers of this method
/// are required to wait for the returned future to complete before calling
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
8c67781f
...
...
@@ -603,12 +603,24 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
///
/// If [callback] completes with an error, the error will be caught by the
/// Flutter framework and made available via [takeException], and this method
/// will return a future that completes wi
ll
`null`.
/// will return a future that completes wi
th
`null`.
///
/// Re-entrant calls to this method are not allowed; callers of this method
/// are required to wait for the returned future to complete before calling
/// this method again. Attempts to do otherwise will result in a
/// [TestFailure] error being thrown.
///
/// If your widget test hangs and you are using [runAsync], chances are your
/// code depends on the result of a task that did not complete. Fake async
/// environment is unable to resolve a future that was created in [runAsync].
/// If you observe such behavior or flakiness, you have a number of options:
///
/// * Consider restructuring your code so you do not need [runAsync]. This is
/// the optimal solution as widget tests are designed to run in fake async
/// environment.
///
/// * Expose a [Future] in your application code that signals the readiness of
/// your widget tree, then await that future inside [callback].
Future
<
T
>
runAsync
<
T
>(
Future
<
T
>
callback
(),
{
Duration
additionalTime
=
const
Duration
(
milliseconds:
1000
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment