Finder fails on on visible widget #2459
Replies: 5 comments
-
Maybe i should mention that i use MobX as State Management. So the UI update is done via reactive progamming depending on Mobx Observables. I have created a test project to find out if the Patrol tests where incompatible with Mobx, but that was not the case. |
Beta Was this translation helpful? Give feedback.
-
I have found an answer on why the this will be found when calling class ElementA extends StatelessWidget {
ElementA() : super(key: Keys.elementA);
@override
Widget build(BuildContext context) {
return const Column(
children: [
Text(
'Element A',
),
],
);
}
} this will NOT be found when calling class ElementB extends StatelessWidget {
ElementB() : super(key: Keys.elementB);
@override
Widget build(BuildContext context) {
return const Column(
children: [
Text(
'Element B',
),
SizedBox(height: 48)
],
);
}
} I have created a reproducable example: Patrol Bug Finder Example |
Beta Was this translation helpful? Give feedback.
-
I have created an issue #2463 and a Pull Request to address the issue: #2464 |
Beta Was this translation helpful? Give feedback.
-
The issue cannot be finally solved. While the PR fixes some problems, the visibilty issues will persist. So updating the Docs will probably be the best way for "Newbies" like me. I have made the suggestions here: #2463 |
Beta Was this translation helpful? Give feedback.
-
After a lot of learnings i have found out: Do not test "visibility" on Columns, Rows or Widgets with Columns or Rows. Take a nested Widget to test "visibility". Thanks to the LeanCode Team for this great package! |
Beta Was this translation helpful? Give feedback.
-
I cannot find out, why my widgets are not found:
I run Patrol Tests (Patrol 3.13.1) and i frequently run into the problem, that
await $(Key('myWidgetKey')).waitUntilVisible()
and alsoexpect($(Key('myWidgetKey')).visible, equals(true)))
fail though i can seeMyWidget
on the screen. Thefinder
seems to find one asexpect($(Key('myWidgetKey')).exists, equals(true)))
is successful. This is the error i get when callingwaitUntilVisible()
:assume i have this widget:
The test fails when searching by Key:
await $(Keys.elementA).waitUntilVisible();
.It will also fail if i search by Class:
await $(MyApp).$(ElementA).waitUntilVisible();
.But it succeeds if i search by the Text:
await $(MyApp).$('Element A').waitUntilVisible();
.Usually i have an interaction before checking the visibility like
await $(Key('myButton')).tap();
I would really appreciate any help as the only option i see right now is only using the find by text method in all tests, which is not a nice solution.
This might be related to #2404
Beta Was this translation helpful? Give feedback.
All reactions