Unverified Commit 39948720 authored by Kaushik Iska's avatar Kaushik Iska Committed by GitHub

Sample driver test working on Fuchsia (#45652)

* [flutter_driver] [fuchsia] Validate existance of cmx for driver tests

Also added an example driver test that can run on Fuchsia devices.

Fixes: https://github.com/flutter/flutter/issues/45624

* update packages for stock example

* fix licenses
parent 02bca134
......@@ -35,6 +35,7 @@ class StockRow extends StatelessWidget {
if (stock.percentChange > 0)
changeInPrice = '+' + changeInPrice;
return InkWell(
key: ValueKey<String>(stock.symbol),
onTap: _getHandler(onPressed),
onDoubleTap: _getHandler(onDoubleTap),
onLongPress: _getHandler(onLongPressed),
......
......@@ -30,6 +30,7 @@ class _StockSymbolView extends StatelessWidget {
children: <Widget>[
Text(
'${stock.symbol}',
key: ValueKey<String>('${stock.symbol}_symbol_name'),
style: Theme.of(context).textTheme.display2,
),
arrow,
......
......@@ -50,17 +50,35 @@ dev_dependencies:
sdk: flutter
flutter_driver:
sdk: flutter
test: 1.9.4
archive: 2.0.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
coverage: 0.13.3+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
file: 5.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http_multi_server: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
image: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
io: 0.3.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
json_rpc_2: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
logging: 0.11.3+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
mime: 0.9.6+3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
multi_server_socket: 1.0.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
node_preamble: 1.4.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
package_resolver: 1.0.10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
pool: 1.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
quiver: 2.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf: 0.7.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf_packages_handler: 1.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf_static: 0.2.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
shelf_web_socket: 0.2.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_map_stack_trace: 1.1.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_maps: 0.10.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_core: 0.2.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service_client: 0.2.6+2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
web_socket_channel: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
xml: 3.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
......@@ -68,4 +86,4 @@ dev_dependencies:
flutter:
uses-material-design: true
# PUBSPEC CHECKSUM: 4d8f
# PUBSPEC CHECKSUM: e110
......@@ -5,8 +5,7 @@
import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
// ignore: deprecated_member_use
import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('scrolling performance test', () {
......
// Copyright 2014 The Flutter 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:stocks/main.dart' as app;
void main() {
enableFlutterDriverExtension();
app.main();
}
// Copyright 2014 The Flutter 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_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('basic stock view test', () {
FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
if (driver != null)
driver.close();
});
test('open AAPL stock', () async {
final SerializableFinder stockList = find.byValueKey('stock-list');
expect(stockList, isNotNull);
final SerializableFinder aaplStockRow = find.byValueKey('AAPL');
await driver.scrollUntilVisible(stockList, aaplStockRow);
await driver.tap(aaplStockRow);
await Future<void>.delayed(const Duration(milliseconds: 500));
final SerializableFinder stockOption = find.byValueKey('AAPL_symbol_name');
final String symbol = await driver.getText(stockOption, timeout: const Duration(milliseconds: 500));
expect(symbol, 'AAPL');
});
});
}
......@@ -5,7 +5,6 @@
import 'dart:async';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/platform.dart';
import '../build_info.dart';
import '../cache.dart';
......@@ -63,13 +62,6 @@ class BuildFuchsiaCommand extends BuildSubCommand {
if (!flutterProject.fuchsia.existsSync()) {
throwToolExit('No Fuchsia project is configured.');
}
final String appName = flutterProject.fuchsia.project.manifest.appName;
final String cmxPath = fs.path.join(
flutterProject.fuchsia.meta.path, '$appName.cmx');
final File cmxFile = fs.file(cmxPath);
if (!cmxFile.existsSync()) {
throwToolExit('The Fuchsia build requires a .cmx file at $cmxPath for the app.');
}
await buildFuchsia(
fuchsiaProject: flutterProject.fuchsia,
target: targetFile,
......
......@@ -32,6 +32,15 @@ Future<void> _timedBuildStep(String name, Future<void> Function() action) async
flutterUsage.sendTiming('build', name, Duration(milliseconds: sw.elapsedMilliseconds));
}
Future<void> _validateCmxFile(FuchsiaProject fuchsiaProject) async {
final String appName = fuchsiaProject.project.manifest.appName;
final String cmxPath = fs.path.join(fuchsiaProject.meta.path, '$appName.cmx');
final File cmxFile = fs.file(cmxPath);
if (!await cmxFile.exists()) {
throwToolExit('The Fuchsia build requires a .cmx file at $cmxPath for the app: $appName.');
}
}
// Building a Fuchsia package has a few steps:
// 1. Do the custom kernel compile using the kernel compiler from the Fuchsia
// SDK. This produces .dilp files (among others) and a manifest file.
......@@ -45,6 +54,7 @@ Future<void> buildFuchsia({
BuildInfo buildInfo = BuildInfo.debug,
String runnerPackageSource = FuchsiaPackageServer.toolHost,
}) async {
await _validateCmxFile(fuchsiaProject);
final Directory outDir = fs.directory(getFuchsiaBuildDirectory());
if (!outDir.existsSync()) {
outDir.createSync(recursive: true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment