zeebe-spec icon indicating copy to clipboard operation
zeebe-spec copied to clipboard

Add action "wait-for-state-transition"

Open pihme opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. Not really a problem, more an inconvenience. If I wanted to write a test to wait that a certain timer has been fired twice, currently this would mean:

  • await-element-instance-state - activated
  • await-element-instance-state - completed
  • await-element-instance-state - activated
  • await-element-instance-state - completed

This makes it difficult to understand the intention of the test.

A shorthand action could be introduced to first wait for one state, than another state. The shorthand could also check that the transition makes sense (e.g. activated to completed makes more sense then completed to activated)

Describe the solution you'd like I'd like to have an action with the following spec:

 - action: await-element-instance-state-transition
        args:
          element_name: B
          from-state: activated
          to-state: completed

Additional context Not sure how relevant this will be for the tests, but this could also be a place to specify for the test to wait for the n-th state transition.

pihme avatar Sep 29 '20 11:09 pihme

I like the idea :+1:

To be more flexible and avoid multiple actions, we could check for a list of state transitions:

- action: await-element-instance-state-transition
  args:
     element_name: B
     state_tranisitions: activated, completed

- action: await-element-instance-state-transition
  args:
     element_name: non-interupting timer event
     state_tranisitions: completed, completed

saig0 avatar Sep 30 '20 05:09 saig0