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

Change patrol_log #2419

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
5 changes: 5 additions & 0 deletions packages/patrol_log/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.0

- Add option to not clear test steps.
- Display test path only in finished test logs.

## 0.0.1+2

- Remove flutter from dependencies.
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_log/lib/src/entries/test_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestEntry extends Entry {

@override
String pretty() {
if (status == TestEntryStatus.skip) {
if (!isFinished) {
return '${status.name} $_testName';
}
return '${status.name} $_testName ${AnsiCodes.gray}(integration_test/$_filePath.dart)${AnsiCodes.reset}${error != null ? '\n$error' : ''}';
Expand Down
12 changes: 8 additions & 4 deletions packages/patrol_log/lib/src/patrol_log_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class PatrolLogReader {
required this.reportPath,
required this.showFlutterLogs,
required this.hideTestSteps,
required this.clearTestSteps,
}) : _scope = scope;

final void Function(String) log;
final String reportPath;
final bool showFlutterLogs;
final bool hideTestSteps;
final bool clearTestSteps;
final StreamSubscription<void> Function(
void Function(String) onData, {
Function? onError,
Expand Down Expand Up @@ -172,7 +174,9 @@ class PatrolLogReader {
_singleEntries.last.closeTest(entry);

// Optionally clear all printed [StepEntry] and [LogEntry].
if (!showFlutterLogs && entry.status != TestEntryStatus.failure) {
if (!showFlutterLogs &&
clearTestSteps &&
entry.status != TestEntryStatus.failure) {
_clearLines(stepsCounter + logsCounter + 1);
}

Expand All @@ -184,10 +188,10 @@ class PatrolLogReader {
if (!hideTestSteps) {
// Clear the previous line it's not the new step, or increment counter
// for new step
if (entry.status != StepEntryStatus.start) {
_clearPreviousLine();
} else {
if (entry.status == StepEntryStatus.start) {
stepsCounter++;
} else if (clearTestSteps) {
_clearPreviousLine();
}

// Print the step entry to the console.
Expand Down
2 changes: 1 addition & 1 deletion packages/patrol_log/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: patrol_log
description: >
Log package for Patrol, a powerful Flutter-native UI testing framework.
version: 0.0.1+2
version: 0.1.0
homepage: https://patrol.leancode.co
repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_log
issue_tracker: https://github.com/leancodepl/patrol/issues
Expand Down
Loading