flutter_gherkin
flutter_gherkin copied to clipboard
Can we accept exceptions?
Is it possible to 'accept' exceptions? For an action a custom Exception gets thrown, and that makes the step fail, but I want the exception to be thrown...
Is it possible to say that that specific exception is allowed to be thrown? @jonsamwell
This is a tricky one of a step performs an action and unlike a unit test does not wrap the code being executed rather perform an action on say a UI element that executes the code that would throw an exception.
That being said I you might be able to do something with this https://api.flutter.dev/flutter/flutter_test/WidgetTester/takeException.html?
I never had success with takeException in e2e compared to WidgetTests, hopefully it works in later versions of flutter maybe?
Is this working in 3.0.0-rc.17?
I will check tomorrow, thanks
It seems to work, at least with my testing. To emulate this I added exception throw on button which navigates screen, and added takeException in step which presses this button, and it caught it just fine (even recorded in variable as it should so we can test for planned Exceptions) and then proceeded next.