Skip to content

Commit

Permalink
Merge branch 'leancodepl:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
GChanathip authored Nov 23, 2024
2 parents bc67b83 + 0bf04f2 commit ce328a5
Show file tree
Hide file tree
Showing 23 changed files with 187 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/patrol_log-check-semver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Get last released version
id: get_last_released_version
run: |
last_version=$(git tag --list 'patrol_log-v*' | grep -v '\-dev\.[0-9]\+$' | sort -V | tail -n 1 | sed 's/^patrol_finders-v//')
last_version=$(git tag --list 'patrol_log-v*' | grep -v '\-dev\.[0-9]\+$' | sort -V | tail -n 1 | sed 's/^patrol_log-v//')
echo "last_version=$last_version" >> $GITHUB_ENV
echo "::set-output name=last_version::$last_version"
Expand Down
3 changes: 2 additions & 1 deletion docs/compatibility-table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ the table below to assess which version you should use.

| patrol_cli | patrol | Min Flutter Version |
| -------------- | -------------- | ------------------- |
| 3.3.0+ | 3.12.0+ | 3.24.0 |
| 3.4.0+ | 3.13.0+ | 3.24.0 |
| 3.3.0 | 3.12.0 | 3.24.0 |
| 3.2.1 | 3.11.2 | 3.24.0 |
| 3.2.0 | 3.11.0 - 3.11.1| 3.22.0 |
| 3.1.0 - 3.1.1 | 3.10.0 | 3.22.0 |
Expand Down
17 changes: 4 additions & 13 deletions packages/patrol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
## 3.13.0-dev.4

- Bump `patrol_finders` and `patrol_log`

## 3.13.0-dev.3
## 3.13.0

- Add support for the `patrol_log` package. (#2387)
- Fix tapping on notification on iOS 18. (#2394)
- Fix macos functionality. (#2408)
- Bump `patrol_finders` and enable logging.

## 3.13.0-dev.2

- Bump `patrol_log` version.

## 3.13.0-dev.1

- Add support for the patrol_log package. (#2387)
- Fix tapping on notification on iOS 18. (#2394)
This version requires version 3.4.0 of `patrol_cli` package.

## 3.12.0

Expand Down
2 changes: 1 addition & 1 deletion packages/patrol/lib/src/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void patrolTest(
LiveTestWidgetsFlutterBindingFramePolicy framePolicy =
LiveTestWidgetsFlutterBindingFramePolicy.fadePointers,
}) {
final patrolLog = PatrolLogWriter();
final patrolLog = PatrolLogWriter(config: {'printLogs': config.printLogs});
final automator = NativeAutomator(config: nativeAutomatorConfig);
final automator2 = NativeAutomator2(config: nativeAutomatorConfig);
final patrolBinding = PatrolBinding.ensureInitialized(nativeAutomatorConfig)
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.4
version: 3.13.0
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.4.0
patrol_log: ^0.1.0
patrol_finders: ^2.4.1
patrol_log: ^0.2.0
shelf: ^1.4.1
test_api: '^0.7.0'

Expand Down
12 changes: 3 additions & 9 deletions packages/patrol_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
## 3.4.0-dev.3
## 3.4.0

- Add flag `clear-test-steps`. (#2421)
- Add support for the `patrol_log` package. (#2387)

## 3.4.0-dev.2

- Bump `patrol_log` version. (#2402)

## 3.4.0-dev.1

- Add support for the patrol_log package. (#2387)
This version requires version 3.13.0 of `patrol` package.

## 3.3.0

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.3';
const version = '3.4.0';
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ final _patrolVersionRange = [
),
VersionRange(
min: Version.parse('3.12.0'),
max: Version.parse('3.12.0'),
),
VersionRange(
min: Version.parse('3.13.0'),
),
];

Expand Down Expand Up @@ -257,5 +261,9 @@ final _patrolCliVersionRange = [
),
VersionRange(
min: Version.parse('3.3.0'),
max: Version.parse('3.3.0'),
),
VersionRange(
min: Version.parse('3.4.0'),
),
];
3 changes: 3 additions & 0 deletions packages/patrol_cli/lib/src/pubspec_reader.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TODO: manage immutable classes
// ignore_for_file: must_be_immutable

import 'package:equatable/equatable.dart';
import 'package:file/file.dart';
import 'package:yaml/yaml.dart';
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.3 # Must be kept in sync with constants.dart
version: 3.4.0 # 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.1.0
patrol_log: ^0.2.0
platform: ^3.1.3
process: ^5.0.1
pub_updater: ^0.4.0
Expand Down
4 changes: 4 additions & 0 deletions packages/patrol_finders/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.0

- Update `patrol_log`.

## 2.4.0

- Wrap actions on finders with patrol logs.
Expand Down
4 changes: 2 additions & 2 deletions packages/patrol_finders/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: patrol_finders
description: Streamlined, high-level API on top of flutter_test.
version: 2.4.0
version: 2.5.0
homepage: https://patrol.leancode.co
repository: https://github.com/leancodepl/patrol/tree/master/packages/patrol_finders
issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3Apackage%3Apatrol_finders
Expand All @@ -20,7 +20,7 @@ dependencies:
flutter_test:
sdk: flutter
meta: ^1.10.0
patrol_log: ^0.1.0
patrol_log: ^0.2.0

dev_dependencies:
leancode_lint: ^14.2.0
6 changes: 6 additions & 0 deletions packages/patrol_log/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.2.0

- Fix report path when path contain spaces.
- Fix path to the test file on the failed test list in summary.
- Add `ConfigEntry`.

## 0.1.0

- Add option to not clear test steps.
Expand Down
22 changes: 10 additions & 12 deletions packages/patrol_log/lib/src/ansi_codes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ class AnsiCodes {
/// `[1m` - Set text to bold.
static const String bold = '$escape[1m';

/// `[30m` - Set text color to gray.
static const String gray = '$escape[30m';
static String color(String color) => '$escape[${color}m';

/// `[38;5;87m` - Set text color to light blue. Used for native actions.
static const String lightBlue = '$escape[38;5;87m';

static String custom(String color) => '$escape[${color}m';

static String get green => custom('32');
static String get yellow => custom('33');
static String get blue => custom('34');
static String get magenta => custom('35');
static String get cyan => custom('36');
static String gray = color('30');
static String red = color('31');
static String green = color('32');
static String yellow = color('33');
static String blue = color('34');
static String lightBlue = color('38;5;87');
static String magenta = color('35');
static String cyan = color('36');
static String orange = color('38;5;208');
}
30 changes: 30 additions & 0 deletions packages/patrol_log/lib/src/entries/config_entry.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
part of 'entry.dart';

@JsonSerializable()
class ConfigEntry extends Entry {
ConfigEntry({
required this.config,
DateTime? timestamp,
}) : super(
timestamp: timestamp ?? DateTime.now(),
type: EntryType.config,
);

@override
factory ConfigEntry.fromJson(Map<String, dynamic> json) =>
_$ConfigEntryFromJson(json);

final Map<String, dynamic> config;

@override
Map<String, dynamic> toJson() => _$ConfigEntryToJson(this);

@override
String pretty() => config.toString();

@override
String toString() => 'ConfigEntry(${toJson()})';

@override
List<Object?> get props => [config, timestamp, type];
}
8 changes: 7 additions & 1 deletion packages/patrol_log/lib/src/entries/entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ part 'error_entry.dart';
part 'log_entry.dart';
part 'step_entry.dart';
part 'test_entry.dart';
part 'warning_entry.dart';
part 'config_entry.dart';

part 'entry.g.dart';

Expand Down Expand Up @@ -39,14 +41,18 @@ enum EntryType {
error,
step,
test,
log;
log,
warning,
config;

static EntryType byName(String name) {
return switch (name) {
'error' => EntryType.error,
'step' => EntryType.step,
'test' => EntryType.test,
'log' => EntryType.log,
'warning' => EntryType.warning,
'config' => EntryType.config,
_ => throw ArgumentError('Unknown EntryType: $name')
};
}
Expand Down
30 changes: 30 additions & 0 deletions packages/patrol_log/lib/src/entries/entry.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/patrol_log/lib/src/entries/error_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ErrorEntry extends Entry {

@override
String pretty() {
return message;
return '${AnsiCodes.red}$message${AnsiCodes.reset}';
}

@override
Expand Down
32 changes: 32 additions & 0 deletions packages/patrol_log/lib/src/entries/warning_entry.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
part of 'entry.dart';

@JsonSerializable()
class WarningEntry extends Entry {
WarningEntry({
required this.message,
DateTime? timestamp,
}) : super(
timestamp: timestamp ?? DateTime.now(),
type: EntryType.warning,
);

@override
factory WarningEntry.fromJson(Map<String, dynamic> json) =>
_$WarningEntryFromJson(json);

final String message;

@override
Map<String, dynamic> toJson() => _$WarningEntryToJson(this);

@override
String pretty() {
return '${AnsiCodes.yellow}$message${AnsiCodes.reset}';
}

@override
String toString() => 'WarningEntry(${toJson()})';

@override
List<Object?> get props => [message, timestamp, type];
}
Loading

0 comments on commit ce328a5

Please sign in to comment.