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
ac9dc574
Unverified
Commit
ac9dc574
authored
Oct 01, 2018
by
xster
Committed by
GitHub
Oct 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for material agnostic driver navigation (#22461)
parent
2a8e35cc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
cupertino_activity_indicator_demo.dart
...lib/demo/cupertino/cupertino_activity_indicator_demo.dart
+1
-1
transitions_perf_test.dart
...es/flutter_gallery/test_driver/transitions_perf_test.dart
+3
-5
find.dart
packages/flutter_driver/lib/src/common/find.dart
+12
-0
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+3
-0
extension.dart
packages/flutter_driver/lib/src/extension/extension.dart
+13
-0
No files found.
examples/flutter_gallery/lib/demo/cupertino/cupertino_activity_indicator_demo.dart
View file @
ac9dc574
...
...
@@ -13,7 +13,7 @@ class CupertinoProgressIndicatorDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
previousPageTitle:
'
Cupertino
'
,
previousPageTitle:
'
Back
'
,
middle:
const
Text
(
'Cupertino Activity Indicator'
),
trailing:
CupertinoDemoDocumentationButton
(
routeName
),
),
...
...
examples/flutter_gallery/test_driver/transitions_perf_test.dart
View file @
ac9dc574
...
...
@@ -45,9 +45,7 @@ const List<String> kUnsynchronizedDemos = <String>[
'Video@Media'
,
];
const
List
<
String
>
kSkippedDemos
=
<
String
>[
'Pull to refresh@Cupertino'
,
// The back button lacks a tooltip.
];
const
List
<
String
>
kSkippedDemos
=
<
String
>[];
// All of the gallery demos, identified as "title@category".
//
...
...
@@ -157,10 +155,10 @@ Future<Null> runDemos(List<String> demos, FlutterDriver driver) async {
if
(
kUnsynchronizedDemos
.
contains
(
demo
))
{
await
driver
.
runUnsynchronized
<
void
>(()
async
{
await
driver
.
tap
(
find
.
byTooltip
(
'Back'
));
await
driver
.
tap
(
find
.
pageBack
(
));
});
}
else
{
await
driver
.
tap
(
find
.
byTooltip
(
'Back'
));
await
driver
.
tap
(
find
.
pageBack
(
));
}
}
...
...
packages/flutter_driver/lib/src/common/find.dart
View file @
ac9dc574
...
...
@@ -136,6 +136,7 @@ abstract class SerializableFinder {
case
'ByValueKey'
:
return
ByValueKey
.
deserialize
(
json
);
case
'ByTooltipMessage'
:
return
ByTooltipMessage
.
deserialize
(
json
);
case
'ByText'
:
return
ByText
.
deserialize
(
json
);
case
'PageBack'
:
return
PageBack
();
}
throw
DriverError
(
'Unsupported search specification type
$finderType
'
);
}
...
...
@@ -253,6 +254,17 @@ class ByType extends SerializableFinder {
}
}
/// A Flutter Driver finder that finds the back button on the page's Material
/// or Cupertino scaffold.
///
/// See also:
///
/// * [WidgetTester.pageBack], for a similar functionality in widget tests.
class
PageBack
extends
SerializableFinder
{
@override
String
get
finderType
=>
'PageBack'
;
}
/// A Flutter driver command that retrieves a semantics id using a specified finder.
///
/// This command requires assertions to be enabled on the device.
...
...
packages/flutter_driver/lib/src/driver/driver.dart
View file @
ac9dc574
...
...
@@ -854,4 +854,7 @@ class CommonFinders {
/// Finds widgets whose class name matches the given string.
SerializableFinder
byType
(
String
type
)
=>
ByType
(
type
);
/// Finds the back button on a Material or Cupertino page's scaffold.
SerializableFinder
pageBack
()
=>
PageBack
();
}
packages/flutter_driver/lib/src/extension/extension.dart
View file @
ac9dc574
...
...
@@ -7,6 +7,7 @@ import 'dart:async';
import
'package:flutter/semantics.dart'
;
import
'package:meta/meta.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -138,6 +139,7 @@ class FlutterDriverExtension {
'ByTooltipMessage'
:
(
SerializableFinder
finder
)
=>
_createByTooltipMessageFinder
(
finder
),
'ByValueKey'
:
(
SerializableFinder
finder
)
=>
_createByValueKeyFinder
(
finder
),
'ByType'
:
(
SerializableFinder
finder
)
=>
_createByTypeFinder
(
finder
),
'PageBack'
:
(
SerializableFinder
finder
)
=>
_createPageBackFinder
(),
});
}
...
...
@@ -274,6 +276,17 @@ class FlutterDriverExtension {
},
description:
'widget with runtimeType "
${arguments.type}
"'
);
}
Finder
_createPageBackFinder
()
{
return
find
.
byElementPredicate
((
Element
element
)
{
final
Widget
widget
=
element
.
widget
;
if
(
widget
is
Tooltip
)
return
widget
.
message
==
'Back'
;
if
(
widget
is
CupertinoNavigationBarBackButton
)
return
true
;
return
false
;
},
description:
'Material or Cupertino back button'
);
}
Finder
_createFinder
(
SerializableFinder
finder
)
{
final
FinderConstructor
constructor
=
_finders
[
finder
.
finderType
];
...
...
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