mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.81k stars 273 forks source link

Add `onSuccess`/`onFail`/`onFinish` callbacks #1062

Open retyui opened 1 year ago

retyui commented 1 year ago

Is your feature request related to a problem? Please describe.

Right now there is no ability to run a custom script when test finish

it's will be useful in case integration with third party services

Describe the solution you'd like

we can use a special syntax to solve it

appId: com.example.app
runScript:
  - onFinish: reportStatatus.js # on success|fail
  - onSucess: reportStatatus.js # on fail
  - onFail: reportStatatus.js   # on sucess
---
- runFlow: Login.yaml # <-- Run commands from "Login.yaml"
- tapOn: Profile
- assertVisible: "Name: Test User"

Describe alternatives you've considered

also we can use a config.yaml to define onFail onSuccess section

Additional context

also we need somehow pass an extra information to that script

lucashdoa commented 5 months ago

+1 on this. Right now I'm trying to send test results to a test management tool, but having a hard time sending "Failed" results because there's no "onFail" hook or something similar to run the API call before the execution is interrupted.

bartekpacia commented 2 months ago

This is a valid feature request, thanks!

See also: onFlowStart/onFlowComplete callbacks