tapping on password visibility button toggles it
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching node in the widget tree
Actual: _AncestorFinder:<zero widgets with type "IconButton" which is an ancestor of icon
"IconData(U+0F06E)">
Which: means none were found but one was expected
The reason is that FaIcon is not an Icon (i.e FaIcon extends StatelessWidget), so find.widgetWithIcon can't find it.
The problem
Let's say that I have the following Widget:
If I want to test that this Widget is visible, I'd normally use
But the above will fail:
The reason is that
FaIcon
is not anIcon
(i.eFaIcon extends StatelessWidget
), sofind.widgetWithIcon
can't find it.The solution 1/2
To make
find.widgetWithIcon
work withFaIcon
, we have to create a custom implementation of Flutter'sWidgetIconFinder
:Then, to make it shorter for use in tests, we can create our own
CustomFinders
class, basing on Flutter'sCommonFinders
:The solution 2/2
Then, we can use our custom finders just like we'd use the default ones
Further steps
I see 2 ways:
FaIcon
(maybe link to this issue?)