flutter_gherkin icon indicating copy to clipboard operation
flutter_gherkin copied to clipboard

Q: Call in-app code within hook

Open WernerRaathAtPolymorph opened this issue 3 years ago • 1 comments
trafficstars

So I see in the example_with_integration_test that you create a CustomWorld and call in-app code by injecting the app with an external application manager.

I'm a bit stuck understanding how to do something similar for my app. I know how to handle the tag logic, but where I'm stuck is how to call in-app code.

I specifically want to create both login and logout hooks, since writing steps for each scenario to log out and log in from the current flow would just be inefficient and too much work to maintain. So the in-app logic would be a simple HTTP call with a username and password that will set a static variable's data within the app so that for certain Scenarios I can assume certain roles.

Any advice on this would be greatly appreciated. I'm sure this is a very common use case as role-based testing is a very natural part of QA, so adding a use case like this to the example would avoid re-explaining.

WernerRaathAtPolymorph avatar Jun 24 '22 19:06 WernerRaathAtPolymorph

@WernerRaathAtPolymorph use are effectively in the app so you can call any service / action in your app. For instance the authentication service to login / logout. The external application manger example is just a wrapper around doing this. This of course is much easier if you are using injection etc

jonsamwell avatar Jun 27 '22 01:06 jonsamwell