Closed MageshPandian20 closed 1 year ago
@erickok @Sub6Resources Anyone support on this ?. Please confirm we can able to cover test-case for OnLinkTap ?
You code does not work because find.byKey("html_tap");
will find the Html
widget and not the link. Perhaps you are looking for AnchorKey.forId(htmlWidgetKey, "#linkYouWantToClick")
?
@MageshPandian20 were you able to test ?
I think the AnchorKey
solution should have fixed this? Please ping if not.
HI Team,
I used flutter_html to load html content in my app. It work fine. We currently working on covering test case over all project. When we tried to cover OnLinkTap method in html(), It not covering. We had key to the html widget and in the test case we used tap with key but it not working.
Container( color: Colors.white, padding: EdgeInsets.only(top: 10, right: 10, bottom: 10, left: 10), child: Html( key : Key("html_tap") data: htmlContent, onLinkTap: (link) { -----> Need to cover this block launch(link); }, ))
In Test case :
var foo = find.byKey("html_tap"); await tester.ensureVisible(foo); // <-- here await tester.tap(foo); await tester.pumpAndSettle();