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
1912f7de
Unverified
Commit
1912f7de
authored
Apr 14, 2021
by
Kaleb Hermes
Committed by
GitHub
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_driver] Add waitForTappable to flutter_driver (#79581)
parent
6b06943c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
0 deletions
+68
-0
deserialization_factory.dart
...lutter_driver/lib/src/common/deserialization_factory.dart
+1
-0
find.dart
packages/flutter_driver/lib/src/common/find.dart
+18
-0
handler_factory.dart
packages/flutter_driver/lib/src/common/handler_factory.dart
+9
-0
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+5
-0
extension_test.dart
...es/flutter_driver/test/src/real_tests/extension_test.dart
+35
-0
No files found.
packages/flutter_driver/lib/src/common/deserialization_factory.dart
View file @
1912f7de
...
...
@@ -56,6 +56,7 @@ mixin DeserializeCommandFactory {
case
'tap'
:
return
Tap
.
deserialize
(
params
,
finderFactory
);
case
'waitFor'
:
return
WaitFor
.
deserialize
(
params
,
finderFactory
);
case
'waitForAbsent'
:
return
WaitForAbsent
.
deserialize
(
params
,
finderFactory
);
case
'waitForTappable'
:
return
WaitForTappable
.
deserialize
(
params
,
finderFactory
);
case
'waitForCondition'
:
return
WaitForCondition
.
deserialize
(
params
);
case
'waitUntilNoTransientCallbacks'
:
return
WaitForCondition
.
deserialize
(
params
);
case
'waitUntilNoPendingFrame'
:
return
WaitForCondition
.
deserialize
(
params
);
...
...
packages/flutter_driver/lib/src/common/find.dart
View file @
1912f7de
...
...
@@ -80,6 +80,24 @@ class WaitForAbsent extends CommandWithTarget {
String
get
kind
=>
'waitForAbsent'
;
}
/// A Flutter Driver command that waits until [finder] can be tapped.
class
WaitForTappable
extends
CommandWithTarget
{
/// Creates a command that waits for the widget identified by [finder] to
/// be tappable within the [timeout] amiount of time.
///
/// If [timeout] is not specified, the command defuts to no timeout.
WaitForTappable
(
SerializableFinder
finder
,
{
Duration
?
timeout
})
:
super
(
finder
,
timeout:
timeout
);
/// Deserialized this command from the value generated by [serialize].
WaitForTappable
.
deserialize
(
Map
<
String
,
String
>
json
,
DeserializeFinderFactory
finderFactory
)
:
super
.
deserialize
(
json
,
finderFactory
);
@override
String
get
kind
=>
'waitForTappable'
;
}
/// Base class for Flutter Driver finders, objects that describe how the driver
/// should search for elements.
abstract
class
SerializableFinder
{
...
...
packages/flutter_driver/lib/src/common/handler_factory.dart
View file @
1912f7de
...
...
@@ -169,6 +169,7 @@ mixin CommandHandlerFactory {
case
'tap'
:
return
_tap
(
command
,
prober
,
finderFactory
);
case
'waitFor'
:
return
_waitFor
(
command
,
finderFactory
);
case
'waitForAbsent'
:
return
_waitForAbsent
(
command
,
finderFactory
);
case
'waitForTappable'
:
return
_waitForTappable
(
command
,
finderFactory
);
case
'waitForCondition'
:
return
_waitForCondition
(
command
);
case
'waitUntilNoTransientCallbacks'
:
return
_waitUntilNoTransientCallbacks
(
command
);
case
'waitUntilNoPendingFrame'
:
return
_waitUntilNoPendingFrame
(
command
);
...
...
@@ -236,6 +237,14 @@ mixin CommandHandlerFactory {
return
Result
.
empty
;
}
Future
<
Result
>
_waitForTappable
(
Command
command
,
CreateFinderFactory
finderFactory
)
async
{
final
WaitForTappable
waitForTappableCommand
=
command
as
WaitForTappable
;
await
waitForElement
(
finderFactory
.
createFinder
(
waitForTappableCommand
.
finder
).
hitTestable
(),
);
return
Result
.
empty
;
}
Future
<
Result
>
_waitForCondition
(
Command
command
)
async
{
assert
(
command
!=
null
);
final
WaitForCondition
waitForConditionCommand
=
command
as
WaitForCondition
;
...
...
packages/flutter_driver/lib/src/driver/driver.dart
View file @
1912f7de
...
...
@@ -220,6 +220,11 @@ abstract class FlutterDriver {
await
sendCommand
(
WaitForAbsent
(
finder
,
timeout:
timeout
));
}
/// Waits until [finder] is tappable.
Future
<
void
>
waitForTappable
(
SerializableFinder
finder
,
{
Duration
?
timeout
})
async
{
await
sendCommand
(
WaitForTappable
(
finder
,
timeout:
timeout
));
}
/// Waits until the given [waitCondition] is satisfied.
Future
<
void
>
waitForCondition
(
SerializableWaitCondition
waitCondition
,
{
Duration
?
timeout
})
async
{
await
sendCommand
(
WaitForCondition
(
waitCondition
,
timeout:
timeout
));
...
...
packages/flutter_driver/test/src/real_tests/extension_test.dart
View file @
1912f7de
...
...
@@ -1130,6 +1130,41 @@ void main() {
});
});
group
(
'waitForTappable'
,
()
{
late
FlutterDriverExtension
driverExtension
;
Future
<
Map
<
String
,
dynamic
>>
waitForTappable
()
async
{
final
SerializableFinder
finder
=
ByValueKey
(
'widgetOne'
);
final
Map
<
String
,
String
>
arguments
=
WaitForTappable
(
finder
).
serialize
();
final
Map
<
String
,
dynamic
>
result
=
await
driverExtension
.
call
(
arguments
);
return
result
;
}
final
Widget
testWidget
=
MaterialApp
(
home:
Material
(
child:
Column
(
children:
const
<
Widget
>
[
Text
(
'Hello '
,
key:
Key
(
'widgetOne'
)),
SizedBox
(
height:
0
,
width:
0
,
child:
Text
(
'World!'
,
key:
Key
(
'widgetTwo'
)),
)
],
),
),
);
testWidgets
(
'returns true when widget is tappable'
,
(
WidgetTester
tester
)
async
{
driverExtension
=
FlutterDriverExtension
((
String
?
arg
)
async
=>
''
,
true
,
false
);
await
tester
.
pumpWidget
(
testWidget
);
final
Map
<
String
,
dynamic
>
waitForTappableResult
=
await
waitForTappable
();
expect
(
waitForTappableResult
[
'isError'
],
isFalse
);
});
});
group
(
'waitUntilFrameSync'
,
()
{
late
FlutterDriverExtension
driverExtension
;
Map
<
String
,
dynamic
>?
result
;
...
...
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