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
b4e41ff7
Commit
b4e41ff7
authored
May 25, 2017
by
Hans Muller
Committed by
GitHub
May 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a devicelab task that generates sample app screenshots, etc (#10303)
parent
9452a344
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
8 deletions
+95
-8
android_sample_catalog_generator.dart
...devicelab/bin/tasks/android_sample_catalog_generator.dart
+14
-0
ios_sample_catalog_generator.dart
dev/devicelab/bin/tasks/ios_sample_catalog_generator.dart
+14
-0
sample_catalog_generator.dart
dev/devicelab/lib/tasks/sample_catalog_generator.dart
+38
-0
manifest.yaml
dev/devicelab/manifest.yaml
+14
-0
sample_page.dart
examples/catalog/bin/sample_page.dart
+4
-4
sample_page.md.template
examples/catalog/bin/sample_page.md.template
+8
-3
screenshot.dart.template
examples/catalog/bin/screenshot.dart.template
+1
-0
screenshot_test.dart.template
examples/catalog/bin/screenshot_test.dart.template
+2
-1
No files found.
dev/devicelab/bin/tasks/android_sample_catalog_generator.dart
0 → 100644
View file @
b4e41ff7
// 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/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/tasks/sample_catalog_generator.dart'
;
Future
<
Null
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
samplePageCatalogGenerator
);
}
dev/devicelab/bin/tasks/ios_sample_catalog_generator.dart
0 → 100644
View file @
b4e41ff7
// 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/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/tasks/sample_catalog_generator.dart'
;
Future
<
Null
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
ios
;
await
task
(
samplePageCatalogGenerator
);
}
dev/devicelab/lib/tasks/sample_catalog_generator.dart
0 → 100644
View file @
b4e41ff7
// 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
'dart:io'
;
import
'../framework/adb.dart'
;
import
'../framework/framework.dart'
;
import
'../framework/ios.dart'
;
import
'../framework/utils.dart'
;
Future
<
TaskResult
>
samplePageCatalogGenerator
()
async
{
final
Device
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
final
String
deviceId
=
device
.
deviceId
;
final
Directory
catalogDirectory
=
dir
(
'
${flutterDirectory.path}
/examples/catalog'
);
await
inDirectory
(
catalogDirectory
,
()
async
{
await
flutter
(
'packages'
,
options:
<
String
>[
'get'
]);
if
(
deviceOperatingSystem
==
DeviceOperatingSystem
.
ios
)
{
await
prepareProvisioningCertificates
(
catalogDirectory
.
path
);
// This causes an Xcode project to be created.
await
flutter
(
'build'
,
options:
<
String
>[
'ios'
,
'--profile'
]);
}
await
dart
(<
String
>[
'bin/sample_page.dart'
]);
await
flutter
(
'drive'
,
options:
<
String
>[
'test_driver/screenshot.dart'
,
'-d'
,
deviceId
,
]);
});
return
new
TaskResult
.
success
(
null
);
}
dev/devicelab/manifest.yaml
View file @
b4e41ff7
...
...
@@ -171,6 +171,13 @@ tasks:
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
android_sample_catalog_generator
:
description
:
>
Builds sample catalog markdown pages and Android screenshots
stage
:
devicelab
required_agent_capabilities
:
[
"
has-android-device"
]
flaky
:
true
# iOS on-device tests
channels_integration_test_ios
:
...
...
@@ -240,6 +247,13 @@ tasks:
stage
:
devicelab_ios
required_agent_capabilities
:
[
"
has-ios-device"
]
ios_sample_catalog_generator
:
description
:
>
Builds sample catalog markdown pages and iOS screenshots
stage
:
devicelab_ios
required_agent_capabilities
:
[
"
has-ios-device"
]
flaky
:
true
# Tests running on Windows host
channels_integration_test_win
:
...
...
examples/catalog/bin/sample_page.dart
View file @
b4e41ff7
...
...
@@ -135,6 +135,8 @@ class SampleGenerator {
);
commentValues
[
keyword
.
toLowerCase
()]
=
value
.
trim
();
}
commentValues
[
'name'
]
=
sourceName
;
commentValues
[
'path'
]
=
'examples/catalog/
${sourceFile.path}
'
;
commentValues
[
'source'
]
=
sourceCode
.
trim
();
return
true
;
...
...
@@ -177,14 +179,12 @@ void generate() {
screenshotDriverTemplate
,
<
String
,
String
>{
'paths'
:
samples
.
map
((
SampleGenerator
sample
)
{
return
"'
${outputFile(sample.sourceName + '.png').path}
'"
;
return
"'
${outputFile(
'\${prefix}
' +
sample.sourceName + '.png').path}'"
;
}).
toList
().
join
(
',
\n
'
),
},
);
final
List
<
String
>
flutterDriveArgs
=
<
String
>[
'drive'
,
'test_driver/screenshot.dart'
];
logMessage
(
'Generating screenshots with: flutter
${flutterDriveArgs.join(" ")}
'
);
Process
.
runSync
(
'flutter'
,
flutterDriveArgs
);
// To generate the screenshots: flutter drive test_driver/screenshot.dart
}
void
main
(
List
<
String
>
args
)
{
...
...
examples/catalog/bin/sample_page.md.template
View file @
b4e41ff7
@(title)
=============
---
catalog: @(name)
title: "@(title)"
permalink: /catalog/@(name)/
---
@(summary)
...
...
@@ -8,6 +12,7 @@
See also:
@(see also)
```
```
dart
@(source)
```
The source code is based on [@(path)](https://github.com/flutter/flutter/blob/master/@(path)).
examples/catalog/bin/screenshot.dart.template
View file @
b4e41ff7
...
...
@@ -36,5 +36,6 @@ class SampleScreenshotsState extends State<SampleScreenshots> {
void main() {
enableFlutterDriverExtension();
WidgetsApp.debugAllowBannerOverride = false; // No "slow mode" banner.
runApp(new SampleScreenshots());
}
examples/catalog/bin/screenshot_test.dart.template
View file @
b4e41ff7
...
...
@@ -7,7 +7,7 @@ import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
void main() {
group('sample screenshots', ()
async
{
group('sample screenshots', () {
FlutterDriver driver;
setUpAll(() async {
...
...
@@ -19,6 +19,7 @@ void main() {
});
test('take sample screenshots', () async {
String prefix = Platform.isMacOS ? 'ios_' : "";
final List<String> paths = <String>[
@(paths)
];
...
...
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