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

Disable printing logs in nested waitUntilVisible and waitUntilExits calls #2434

Merged
merged 1 commit into from
Nov 27, 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_finders/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.1

- Disable printing logs in nested `waitUntilVisible` and `waitUntilExists` calls.

## 2.5.0

- Update `patrol_log`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ class PatrolFinder implements MatchFinder {
wrapWithPatrolLog(
action: 'waitUntilExists',
color: AnsiCodes.cyan,
function: () => tester.waitUntilExists(this, timeout: timeout),
function: () => tester.waitUntilExists(
this,
timeout: timeout,
enablePatrolLog: false,
),
);

/// Waits until this finder finds at least one visible widget.
Expand All @@ -400,11 +404,19 @@ class PatrolFinder implements MatchFinder {
///
/// Timeout is globally set by [PatrolTester.config.visibleTimeout]. If you
/// want to override this global setting, set [timeout].
Future<PatrolFinder> waitUntilVisible({Duration? timeout}) =>
Future<PatrolFinder> waitUntilVisible({
Duration? timeout,
bool enablePatrolLog = true,
}) =>
wrapWithPatrolLog(
action: 'waitUntilVisible',
color: AnsiCodes.cyan,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR: I would totally remove color information from this method. It should be like type: step or something that under the hood does color: AnsiCodes.cyan. I would not see this as the concern of this method.

function: () => tester.waitUntilVisible(this, timeout: timeout),
function: () => tester.waitUntilVisible(
this,
timeout: timeout,
enablePatrolLog: false,
),
enablePatrolLog: enablePatrolLog,
);

/// Returns a finder matching widget of type [T] which also fulfills
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ class PatrolTester {
enablePatrolLog: enablePatrolLog,
function: () async {
var viewPatrolFinder = PatrolFinder(finder: view, tester: this);
await viewPatrolFinder.waitUntilVisible();
await viewPatrolFinder.waitUntilVisible(enablePatrolLog: false);
viewPatrolFinder = viewPatrolFinder.hitTestable().first;
dragDuration ??= config.dragDuration;
settleBetweenScrollsTimeout ??= config.settleBetweenScrollsTimeout;
Expand Down Expand Up @@ -655,7 +655,7 @@ class PatrolTester {
enablePatrolLog: enablePatrolLog,
function: () async {
var viewPatrolFinder = PatrolFinder(finder: view, tester: this);
await viewPatrolFinder.waitUntilVisible();
await viewPatrolFinder.waitUntilVisible(enablePatrolLog: false);
viewPatrolFinder = viewPatrolFinder.hitTestable().first;
dragDuration ??= config.dragDuration;
settleBetweenScrollsTimeout ??= config.settleBetweenScrollsTimeout;
Expand Down Expand Up @@ -719,7 +719,7 @@ class PatrolTester {
final scrollablePatrolFinder = await PatrolFinder(
finder: finderView,
tester: this,
).waitUntilVisible();
).waitUntilVisible(enablePatrolLog: false);

AxisDirection direction;
if (scrollDirection == null) {
Expand Down Expand Up @@ -790,7 +790,7 @@ class PatrolTester {
final scrollablePatrolFinder = await PatrolFinder(
finder: finderView,
tester: this,
).waitUntilVisible();
).waitUntilVisible(enablePatrolLog: false);
AxisDirection direction;
if (scrollDirection == null) {
if (finderView.evaluate().first.widget is Scrollable) {
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.5.0
version: 2.5.1
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.2.0
patrol_log: ^0.2.1

dev_dependencies:
leancode_lint: ^14.2.0
Loading