vico-aguado/flutter_wallet

requestData() custom command doesn't work with gherkin in FlutterDriver

Closed this issue · 1 comments

I'm using flutter_gherkin for BDD test on my flutter Application.

Recently I have a requirement in which I need to clear cache(SharePreference) for some scenarios so I have chosen to send custom command to my application. Here below is the code:

class IClearCache extends AndWithWorld {
IClearCache()
: super(StepDefinitionConfiguration()..timeout = Duration(seconds: 50));

@OverRide
Future executeStep() async {
await world.driver.requestData("deleteChache");
stdout.write("##sending message");
}

@OverRide
RegExp get pattern => RegExp(r"I clear cache");
}

and I am expecting the command in the main.dart in test environment as per below:

void main() {
enableFlutterDriverExtension(handler: (message) async {
stdout.write('##message received $message');
await app.deleteCache();
return null;
});
app.main();
}

I am able to see the logs for sending part but there is no logs found for receiving part, looks like flutter driver is unable send the command to my App. Am I missing anything, is this because of gherkin environment?

Not raised on right place, moving it to appropriate place.