Skip to content

Variables in flows are not cleared between uses #2501

Open
@ricardo7martins

Description

@ricardo7martins

Is there an existing issue for this?

  • I have searched the existing issues and didn't find mine.

Steps to reproduce

  • Variables passed in one flow are not cleared after it's execution. So if the same flow, or even a different one with parameters with the same names is called, it still considers the ones from the previous call.
    For example:

- runFlow: 
    file: "utils/tap-on.yaml"
    env:
     # These arguments will exist in the following calls, even if not passed
      androidId: "IdValue"
      iosId: "idValue"
      
- runFlow: 
    file: "utils/tap-on.yaml"
    env:
    # androidId is not being passed here, but Maestro still has that information from the previous call, 
    # so it will use it and break the test
      androidText: "IdValue"
      iosText: "idValue"

This behavior even applies between different flows:

- runFlow: 
    file: "utils/assert-visible.yaml"
    env:
     # These arguments will exist in the following calls, even if not passed
      androidId: "IdValue"
      iosId: "idValue"
      
- runFlow: 
    file: "utils/tap-on.yaml"
    env:
    # The androidId argument passed in the assert-visible flow will be available here and break the test
      androidText: "IdValue"
      iosText: "idValue"

Actual results

Parameters persist between flow calls

Expected results

Parameters are cleared at the end if the flow execution. If they are not passed on subsequent calls in a test, they will be considered as null

About app

  • Closed source project
  • Kotlin Multiplatform

About environment

Java version: 17.0.4
MacOS: 15.3.2
Processor: Apple M2 Pro

Logs

Logs
<!-- Replace this line with your logs. *DO NOT* remove the backticks! -->

Maestro version

1.40.2

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions