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
d1f73fd0
Commit
d1f73fd0
authored
Mar 20, 2017
by
Sarah Zakarias
Committed by
GitHub
Mar 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration test for the Platform Services app (#8826)
parent
142922de
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
132 additions
and
3 deletions
+132
-3
platform_services_test.dart
dev/devicelab/bin/tasks/platform_services_test.dart
+14
-0
platform_services_test_ios.dart
dev/devicelab/bin/tasks/platform_services_test_ios.dart
+14
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+41
-0
manifest.yaml
dev/devicelab/manifest.yaml
+12
-1
main.dart
examples/platform_services/lib/main.dart
+2
-2
pubspec.yaml
examples/platform_services/pubspec.yaml
+2
-0
button_tap.dart
examples/platform_services/test_driver/button_tap.dart
+11
-0
button_tap_test.dart
examples/platform_services/test_driver/button_tap_test.dart
+36
-0
No files found.
dev/devicelab/bin/tasks/platform_services_test.dart
0 → 100644
View file @
d1f73fd0
// Copyright 2017 The Chromium 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
'dart:async'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
Future
<
Null
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
createPlatformServiceDriverTest
());
}
dev/devicelab/bin/tasks/platform_services_test_ios.dart
0 → 100644
View file @
d1f73fd0
// Copyright 2017 The Chromium 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
'dart:async'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
Future
<
Null
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
await
task
(
createPlatformServiceDriverTest
());
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
d1f73fd0
...
...
@@ -9,6 +9,14 @@ import '../framework/adb.dart';
import
'../framework/framework.dart'
;
import
'../framework/utils.dart'
;
TaskFunction
createPlatformServiceDriverTest
(
)
{
return
new
DriverTest
(
'
${flutterDirectory.path}
/examples/platform_services'
,
'test_driver/button_tap.dart'
,
);
}
TaskFunction
createComplexLayoutScrollPerfTest
(
)
{
return
new
PerfTest
(
'
${flutterDirectory.path}
/dev/benchmarks/complex_layout'
,
...
...
@@ -152,6 +160,39 @@ class PerfTest {
}
}
class
DriverTest
{
DriverTest
(
this
.
testDirectory
,
this
.
testTarget
);
final
String
testDirectory
;
final
String
testTarget
;
Future
<
TaskResult
>
call
()
{
return
inDirectory
(
testDirectory
,
()
async
{
final
Device
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
final
String
deviceId
=
device
.
deviceId
;
await
flutter
(
'packages'
,
options:
<
String
>[
'get'
]);
if
(
deviceOperatingSystem
==
DeviceOperatingSystem
.
ios
)
{
// This causes an Xcode project to be created.
await
flutter
(
'build'
,
options:
<
String
>[
'ios'
,
'--profile'
]);
}
await
flutter
(
'drive'
,
options:
<
String
>[
'-v'
,
'-t'
,
testTarget
,
'-d'
,
deviceId
,
]);
return
new
TaskResult
.
success
(
null
);
});
}
}
class
BuildTest
{
BuildTest
(
this
.
testDirectory
);
...
...
dev/devicelab/manifest.yaml
View file @
d1f73fd0
...
...
@@ -83,6 +83,12 @@ tasks:
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
platform_services_test
:
description
:
>
Runs a driver test on the Platform Services sample app on Android.
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
flutter_gallery__start_up
:
description
:
>
Measures the startup time of the Flutter Gallery app on Android.
...
...
@@ -138,9 +144,14 @@ tasks:
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
# iOS on-device tests
platform_services_test_ios
:
description
:
>
Runs a driver test on the Platform Services sample app on iOS.
stage
:
devicelab_ios
required_agent_capabilities
:
[
"
has-ios-device"
]
complex_layout_scroll_perf_ios__timeline_summary
:
description
:
>
Measures the runtime performance of the Complex Layout sample app on
...
...
examples/platform_services/lib/main.dart
View file @
d1f73fd0
...
...
@@ -14,7 +14,7 @@ class PlatformServices extends StatefulWidget {
class
_PlatformServicesState
extends
State
<
PlatformServices
>
{
static
const
PlatformMethodChannel
platform
=
const
PlatformMethodChannel
(
'battery'
);
String
_batteryLevel
=
'
Unknown battery level.
'
;
String
_batteryLevel
=
''
;
Future
<
Null
>
_getBatteryLevel
()
async
{
String
batteryLevel
;
...
...
@@ -40,7 +40,7 @@ class _PlatformServicesState extends State<PlatformServices> {
child:
new
Text
(
'Get Battery Level'
),
onPressed:
_getBatteryLevel
,
),
new
Text
(
_batteryLevel
),
new
Text
(
_batteryLevel
,
key:
new
Key
(
'Battery level label'
)
),
],
),
),
...
...
examples/platform_services/pubspec.yaml
View file @
d1f73fd0
...
...
@@ -7,6 +7,8 @@ dependencies:
dev_dependencies
:
flutter_test
:
sdk
:
flutter
flutter_driver
:
path
:
../../packages/flutter_driver
flutter
:
uses-material-design
:
true
examples/platform_services/test_driver/button_tap.dart
0 → 100644
View file @
d1f73fd0
// Copyright 2017 The Chromium 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_driver/driver_extension.dart'
;
import
'package:platform_services/main.dart'
as
app
;
void
main
(
)
{
enableFlutterDriverExtension
();
app
.
main
();
}
examples/platform_services/test_driver/button_tap_test.dart
0 → 100644
View file @
d1f73fd0
// Copyright 2017 The Chromium 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_driver/flutter_driver.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
group
(
'button tap test'
,
()
{
FlutterDriver
driver
;
setUpAll
(()
async
{
driver
=
await
FlutterDriver
.
connect
();
});
tearDownAll
(()
async
{
if
(
driver
!=
null
)
driver
.
close
();
});
test
(
'tap on the button, verify result'
,
()
async
{
final
SerializableFinder
batteryLevelLabel
=
find
.
byValueKey
(
'Battery level label'
);
expect
(
batteryLevelLabel
,
isNotNull
);
final
SerializableFinder
button
=
find
.
text
(
'Get Battery Level'
);
await
driver
.
waitFor
(
button
);
await
driver
.
tap
(
button
);
String
batteryLevel
;
while
(
batteryLevel
==
null
||
batteryLevel
.
isEmpty
)
{
batteryLevel
=
await
driver
.
getText
(
batteryLevelLabel
);
}
expect
(
batteryLevel
,
isNotEmpty
);
});
});
}
\ No newline at end of file
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