Skip to content

Commit

Permalink
Add flag to not clear test steps
Browse files Browse the repository at this point in the history
  • Loading branch information
pdenert committed Nov 19, 2024
1 parent 53ed73c commit 09a8416
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/patrol/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies:
http: '^1.1.0'
json_annotation: ^4.8.1
meta: ^1.10.0
patrol_finders: ^2.3.0
patrol_log: ^0.0.1+2
patrol_finders: ^2.3.1
patrol_log: ^0.1.0
shelf: ^1.4.1
test_api: '^0.7.0'

Expand Down
2 changes: 2 additions & 0 deletions packages/patrol_cli/lib/src/android/android_test_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class AndroidTestBackend {
bool interruptible = false,
required bool showFlutterLogs,
required bool hideTestSteps,
required bool clearTestSteps,
}) async {
await _disposeScope.run((scope) async {
// Read patrol logs from logcat
Expand Down Expand Up @@ -220,6 +221,7 @@ class AndroidTestBackend {
reportPath: reportPath,
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
clearTestSteps: clearTestSteps,
)
..listen()
..startTimer();
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_cli/lib/src/base/constants.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/// Version of Patrol CLI. Must be kept in sync with pubspec.yaml.
/// If you update this, make sure that compatibility-table.mdx is updated (if needed)
const version = '3.4.0-dev.2';
const version = '3.4.0-dev.3';
5 changes: 5 additions & 0 deletions packages/patrol_cli/lib/src/commands/develop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class DevelopCommand extends PatrolCommand {
usesPortOptions();
usesTagsOption();
usesHideTestSteps();
usesClearTestSteps();

usesUninstallOption();

Expand Down Expand Up @@ -247,6 +248,7 @@ class DevelopCommand extends PatrolCommand {
openDevtools: boolArg('open-devtools'),
showFlutterLogs: false,
hideTestSteps: boolArg('hide-test-steps'),
clearTestSteps: boolArg('clear-test-steps'),
);

return 0; // for now, all exit codes are 0
Expand Down Expand Up @@ -324,6 +326,7 @@ class DevelopCommand extends PatrolCommand {
required bool openDevtools,
required bool showFlutterLogs,
required bool hideTestSteps,
required bool clearTestSteps,
}) async {
Future<void> Function() action;
Future<void> Function()? finalizer;
Expand All @@ -339,6 +342,7 @@ class DevelopCommand extends PatrolCommand {
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
flavor: flutterOpts.flavor,
clearTestSteps: clearTestSteps,
);
final package = android.packageName;
if (package != null && uninstall) {
Expand All @@ -356,6 +360,7 @@ class DevelopCommand extends PatrolCommand {
interruptible: true,
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
clearTestSteps: clearTestSteps,
);
final bundleId = iosOpts.bundleId;
if (bundleId != null && uninstall) {
Expand Down
5 changes: 5 additions & 0 deletions packages/patrol_cli/lib/src/commands/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class TestCommand extends PatrolCommand {
useCoverageOptions();
usesShowFlutterLogs();
usesHideTestSteps();
usesClearTestSteps();

usesUninstallOption();

Expand Down Expand Up @@ -270,6 +271,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more.
device: device,
showFlutterLogs: boolArg('show-flutter-logs'),
hideTestSteps: boolArg('hide-test-steps'),
clearTestSteps: boolArg('clear-test-steps'),
);

return allPassed ? 0 : 1;
Expand Down Expand Up @@ -346,6 +348,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more.
required Device device,
required bool showFlutterLogs,
required bool hideTestSteps,
required bool clearTestSteps,
}) async {
Future<void> Function() action;
Future<void> Function()? finalizer;
Expand All @@ -358,6 +361,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more.
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
flavor: flutterOpts.flavor,
clearTestSteps: clearTestSteps,
);
final package = android.packageName;
if (package != null && uninstall) {
Expand All @@ -371,6 +375,7 @@ See https://github.com/leancodepl/patrol/issues/1316 to learn more.
device,
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
clearTestSteps: clearTestSteps,
);
final bundleId = ios.bundleId;
if (bundleId != null && uninstall) {
Expand Down
2 changes: 2 additions & 0 deletions packages/patrol_cli/lib/src/ios/ios_test_backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class IOSTestBackend {
bool interruptible = false,
required bool showFlutterLogs,
required bool hideTestSteps,
required bool clearTestSteps,
}) async {
await _disposeScope.run((scope) async {
// Read patrol logs from log stream
Expand All @@ -178,6 +179,7 @@ class IOSTestBackend {
reportPath: reportPath,
showFlutterLogs: showFlutterLogs,
hideTestSteps: hideTestSteps,
clearTestSteps: clearTestSteps,
)
..listen()
..startTimer();
Expand Down
8 changes: 8 additions & 0 deletions packages/patrol_cli/lib/src/runner/patrol_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ abstract class PatrolCommand extends Command<int> {
);
}

void usesClearTestSteps() {
argParser.addFlag(
'clear-test-steps',
help: 'Clear test steps after the test finishes.',
defaultsTo: true,
);
}

/// Gets the parsed command-line flag named [name] as a `bool`.
///
/// If no flag named [name] was added to the `ArgParser`, an [ArgumentError]
Expand Down
4 changes: 2 additions & 2 deletions packages/patrol_cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: patrol_cli
description: >
Command-line tool for Patrol, a powerful Flutter-native UI testing framework.
version: 3.4.0-dev.2 # Must be kept in sync with constants.dart
version: 3.4.0-dev.3 # Must be kept in sync with constants.dart
homepage: https://patrol.leancode.co
repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_cli
issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+patrol_cli%22
Expand Down Expand Up @@ -30,7 +30,7 @@ dependencies:
mason_logger: ^0.2.10
meta: ^1.10.0
path: ^1.8.3
patrol_log: ^0.0.1+2
patrol_log: ^0.1.0
platform: ^3.1.3
process: ^5.0.1
pub_updater: ^0.4.0
Expand Down

0 comments on commit 09a8416

Please sign in to comment.