leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
868 stars 127 forks source link

Performing an optional action #2280

Open piotruela opened 2 months ago

piotruela commented 2 months ago

Use case

In some tests, there is a situation where I need to click on the dialog to close it, but it does not show every time. (i.e. cookie consent dialog on webview). Currently I need to wrap the action of clicking on dialog with try-catch.

    try {
      await $.native.tap(Selector(textStartsWith: 'ACCEPT'));
    } on PatrolActionException catch (_) {
      // ignore
    }

Proposal

I want to be able to mark action as optional to not be forced to wrap it with try-catch.

await $.native.tap(Selector(textStartsWith: 'ACCEPT'), optional: true);