diff --git a/packages/patrol_log/CHANGELOG.md b/packages/patrol_log/CHANGELOG.md index 5f95e7624..692811c5b 100644 --- a/packages/patrol_log/CHANGELOG.md +++ b/packages/patrol_log/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1 + +- Fix skipping first word in started TestEntry. + ## 0.2.0 - Fix report path when path contain spaces. diff --git a/packages/patrol_log/lib/src/entries/test_entry.dart b/packages/patrol_log/lib/src/entries/test_entry.dart index b94afdfcf..3b969b114 100644 --- a/packages/patrol_log/lib/src/entries/test_entry.dart +++ b/packages/patrol_log/lib/src/entries/test_entry.dart @@ -20,6 +20,7 @@ class TestEntry extends Entry { final TestEntryStatus status; final String? error; + /// Returns the execution time between [start] and TestEntry [timestamp]. Duration executionTime(DateTime start) => timestamp.difference(start); @override @@ -28,15 +29,24 @@ class TestEntry extends Entry { @override String pretty() { if (!isFinished) { - return '${status.name} $_testName'; + return '${status.name} $name'; } - return '${status.name} $_testName ${AnsiCodes.gray}(integration_test/$_filePath.dart)${AnsiCodes.reset}${error != null ? '\n$error' : ''}'; + return '${status.name} $nameWithPath${error != null ? '\n$error' : ''}'; } String get nameWithPath => '$_testName ${AnsiCodes.gray}(integration_test/$_filePath.dart)${AnsiCodes.reset}'; + /// Returns the file path of the test. + /// + /// The file path is the first part of the test name. + /// '.' is replaced with '/' to create a valid file path. String get _filePath => name.split(' ').first.replaceAll('.', '/'); + + /// Returns the test name without the file path. + /// + /// When test is finished, then first part of the name is the file name. + /// So we skip the first part. String get _testName => name.split(' ').skip(1).join(' '); @override @@ -45,7 +55,7 @@ class TestEntry extends Entry { @override List get props => [name, status, error, timestamp, type]; - /// Returns `true` if the test is finished successfully or with a failure. + /// Returns `true` if the test is finished, successfully or with a failure. bool get isFinished => status == TestEntryStatus.success || status == TestEntryStatus.failure; } diff --git a/packages/patrol_log/pubspec.yaml b/packages/patrol_log/pubspec.yaml index 56bcbfd6e..166fb0873 100644 --- a/packages/patrol_log/pubspec.yaml +++ b/packages/patrol_log/pubspec.yaml @@ -1,7 +1,7 @@ name: patrol_log description: > Log package for Patrol, a powerful Flutter-native UI testing framework. -version: 0.2.0 +version: 0.2.1 homepage: https://patrol.leancode.co repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_log issue_tracker: https://github.com/leancodepl/patrol/issues