Add a devicelab task that generates sample app screenshots, etc (#10303)

This commit is contained in:
Hans Muller
2017-05-25 11:47:36 -07:00
committed by GitHub
parent 9452a3448c
commit b4e41ff7d3
8 changed files with 95 additions and 8 deletions

View File

@@ -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) {

View File

@@ -1,5 +1,9 @@
@(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)).

View File

@@ -36,5 +36,6 @@ class SampleScreenshotsState extends State<SampleScreenshots> {
void main() {
enableFlutterDriverExtension();
WidgetsApp.debugAllowBannerOverride = false; // No "slow mode" banner.
runApp(new SampleScreenshots());
}

View File

@@ -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)
];