Skip to content

Add runFlow timeout with context propagation#30

Open
omnarayan wants to merge 1 commit intomainfrom
feat/runflow-timeout
Open

Add runFlow timeout with context propagation#30
omnarayan wants to merge 1 commit intomainfrom
feat/runflow-timeout

Conversation

@omnarayan
Copy link
Contributor

Summary

  • Add timeout parameter to runFlow steps (milliseconds) that propagates into driver polling loops via SetContext(ctx), enabling mid-operation cancellation when the timeout expires
  • All drivers updated: uiautomator2, wda, appium, devicelab, flutter, mock
  • Informative error messages show timeout value, flow file, and which step was executing
  • Timeout failures classified as TIMEOUT error type in HTML, JUnit, and Allure reports

Example usage

- runFlow:
    file: common/login.yaml
    timeout: 5000       # 5 second timeout
    env:
      username: devicelab

- runFlow:
    timeout: 3000       # inline steps with timeout
    commands:
      - tapOn: "Submit"
      - assertVisible: "Success"

Error messages

runFlow 'common/login.yaml' timed out (2s timeout)
runFlow timed out (3s timeout) while executing: assertVisible: text="THIS_ELEMENT_DOES_NOT_EXIST"
element "Username" not found: runFlow timeout (2s) exceeded

Test plan

  • 4 executor unit tests + 2 parser unit tests
  • Validated on real Android device (Pixel 4a) — 20 flows, 18 pass, 2 expected timeout failures
  • Validated on iOS simulator (iPhone 16 Pro) — 20 flows, 14 pass, 2 expected timeout failures + 4 pre-existing iOS test issues
  • No regressions in existing test suites

Ref #29 — Thanks to @maraujop for the suggestion!

Add timeout parameter to runFlow steps that propagates through the
driver interface via SetContext, enabling mid-operation cancellation
of element-finding polling loops when the timeout expires.

Example usage:

  - runFlow:
      file: common/login.yaml
      timeout: 5000       # 5 second timeout
      env:
        username: devicelab

  - runFlow:
      timeout: 3000       # inline steps with timeout
      commands:
        - tapOn: "Submit"
        - assertVisible: "Success"

- Add SetContext(ctx) to Driver interface and all implementations
  (uiautomator2, wda, appium, devicelab, flutter, mock)
- Propagate timeout context into driver polling loops so element
  finding is interrupted immediately on expiry
- Fix parser to include timeout field in runFlow raw struct
- Replace cryptic "context deadline exceeded" errors with informative
  messages showing timeout value, flow file, and executing step
- Add enrichTimeoutError for sub-step error enrichment
- Timeout failures are classified as "TIMEOUT" error type in reports
  (not "UNKNOWN"), enabling proper failure categorization in HTML,
  JUnit, and Allure reports
- Add 4 executor tests and 2 parser tests for timeout behavior

Ref #29

Thanks to @maraujop for the suggestion!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant