Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to not clear test steps #2421

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/patrol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.13.0-dev.4

- Bump `patrol_finders` and `patrol_log`

## 3.13.0-dev.3

- Fix macos functionality. (#2408)
Expand Down
6 changes: 3 additions & 3 deletions packages/patrol/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: patrol
description: >
Powerful Flutter-native UI testing framework overcoming limitations of
existing Flutter testing tools. Ready for action!
version: 3.13.0-dev.3
version: 3.13.0-dev.4
homepage: https://patrol.leancode.co
repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol
issue_tracker: https://github.com/leancodepl/patrol/issues
Expand All @@ -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.4.0
patrol_log: ^0.1.0
shelf: ^1.4.1
test_api: '^0.7.0'

Expand Down
6 changes: 5 additions & 1 deletion packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 3.4.0-dev.3

- Add flag `clear-test-steps`. (#2421)

## 3.4.0-dev.2

- Bump `patrol_log` version.
- Bump `patrol_log` version. (#2402)

## 3.4.0-dev.1

Expand Down
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
Loading