withStep

suspend fun <T> withStep(id: String? = null, block: suspend (id: String) -> T): T(source)

Runs block as one step and passes it the step's id: a caller's own unit of work (a line of a test, a command of a tool), named so that what it did on the device can be found afterwards.

Every call block makes to the server carries the id. The server copies it to the actions the calls cause in the device log (LogAction.step), so a caller that keeps its own record of steps can match the two:

val checkout = withStep { id -> cart.tap(); pay.tap(); id }
val log = device.logs.read(filter = LogFilter(step = checkout)) // its first action to its last

id is 1 to 64 of A-Z a-z 0-9 . _ -; without one a new id is made. A step inside a step replaces it until the inner block ends.