From 17931d75354607663614414fc4b568503268c313 Mon Sep 17 00:00:00 2001 From: Hakkyu Kim Date: Wed, 5 Jan 2022 11:35:13 +0900 Subject: [PATCH] Register and parse arguments for integration test --- tools/lib/src/integration_test_command.dart | 48 ++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/tools/lib/src/integration_test_command.dart b/tools/lib/src/integration_test_command.dart index a76fb441f..bccf9e70a 100644 --- a/tools/lib/src/integration_test_command.dart +++ b/tools/lib/src/integration_test_command.dart @@ -6,7 +6,53 @@ import 'package:flutter_plugin_tools/src/common/core.dart'; import 'package:flutter_plugin_tools/src/common/plugin_command.dart'; class IntegrationTestCommand extends PluginCommand { - IntegrationTestCommand(Directory packagesDir) : super(packagesDir); + IntegrationTestCommand(Directory packagesDir) : super(packagesDir) { + argParser.addFlag( + _generateEmulatorsArg, + help: 'Create and destroy emulators during test.\n\n' + 'Must provide either $_platformsArg or $_recipeArg option to specify which ' + 'platforms to create.', + ); + argParser.addOption( + _platformsArg, + help: 'Run integration test on all connected targets that satisfy ' + '- (ex: wearable-5.5, tv-6.0).\n\n' + 'The selected targets will be used for all plugins, ' + 'if you wish to run different targets for each plugin,\n' + 'use the $_recipeArg option instead.', + valueHelp: '-', + ); + argParser.addOption(_recipeArg, + help: + 'The recipe file path. A recipe refers to a yaml file that defines ' + 'a list of target platforms to test for each plugin.\n\n' + 'Pass this file if you want to select specific target platforms for different\n' + 'plugins. Every package listed in the recipe file will be recognized by the tool\n' + '(same as $_packagesArg option) and those that specify an empty list will be\n' + 'explicitly excluded (same as $_excludeArg option). If $_recipeArg is used,\n' + '$_packagesArg and $_excludeArg options will be ignored.\n\n' + 'plugins:\n' + ' a: [wearable-5.5, tv-6.0]\n' + ' b: [mobile-6.0]\n' + ' c: [wearable-4.0]\n' + ' d: [] # explicitly excluded\n', + valueHelp: 'recipe.yaml'); + argParser.addOption( + _timeoutArg, + help: 'Timeout limit of each integration test in seconds.', + valueHelp: 'seconds', + defaultsTo: '120', + ); + } + + // Copied from PluginCommand. + static const String _excludeArg = 'exclude'; + static const String _packagesArg = 'packages'; + + static const String _generateEmulatorsArg = 'generate-emulators'; + static const String _platformsArg = 'platforms'; + static const String _recipeArg = 'recipe'; + static const String _timeoutArg = 'timeout'; @override String get description =>