TapWidgetOfTypeWithinStep function
StepDefinitionGeneric<World>
TapWidgetOfTypeWithinStep()
Taps a widget of type within another widget.
Examples:
Then I tap the element of type "MaterialButton" within the "user_settings_list"
Implementation
StepDefinitionGeneric TapWidgetOfTypeWithinStep() {
return when2<String, String, FlutterWorld>(
RegExp(
r'I tap the (?:button|element|label|icon|field|text|widget) of type {string} within the {string}$'),
(widgetType, ancestorKey, context) async {
final finder = context.world.appDriver.findByDescendant(
context.world.appDriver.findBy(ancestorKey, FindType.key),
context.world.appDriver.findBy(widgetType, FindType.type),
firstMatchOnly: true,
);
await context.world.appDriver.tap(finder);
await context.world.appDriver.waitForAppToSettle();
},
);
}