maestro icon indicating copy to clipboard operation
maestro copied to clipboard

Allow filtering of tags using AND rather than OR

Open prolificcoder opened this issue 7 months ago • 6 comments

Is there an existing issue for this?

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

Steps to reproduce

Based on the docs https://docs.maestro.dev/cli/tags multiple matching should act as AND

Have four flow files...

        appId: com.example.app
        tags:
          - regression
          - smoke
        ---
        - launchApp
        - tapOn: "text:SomeElementOnScreenA"
        appId: com.example.app
        tags:
          - regression
          - experience
        ---
        - launchApp
        - tapOn: "text:SomeElementOnScreenB"
    appId: com.example.app
        tags:
          - experience
          - smoke
        ---
        - launchApp
        - tapOn: "text:SomeElementOnScreenC"
        appId: com.example.app
        tags:
          - regression
        ---
        - launchApp
        - tapOn: "text:SomeElementOnScreenD"

Run maestro with maestro test --include-tags="regression,experience" .

Actual results

All 4 are executed.

Expected results

Only flow_B.yaml should be executed, as it is the only flow containing both the regression and experience tags.

About app

Nothing specific about this app

About environment

Image

nothing specific

Logs

Logs
[Failed] flow_A (1s) (Unable to launch app com.example.app: An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
Simulator device failed to launch com.example.app.
Underlying error (domain=FBSOpenApplicationServiceErrorDomain, code=4):
	The request to open "com.example.app" failed.
)
[Failed] flow_D (1s) (Unable to launch app com.example.app: An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
Simulator device failed to launch com.example.app.
Underlying error (domain=FBSOpenApplicationServiceErrorDomain, code=4):
	The request to open "com.example.app" failed.
)
[Failed] flow_C (1s) (Unable to launch app com.example.app: An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
Simulator device failed to launch com.example.app.
Underlying error (domain=FBSOpenApplicationServiceErrorDomain, code=4):
	The request to open "com.example.app" failed.
)
[Failed] flow_B (1s) (Unable to launch app com.example.app: An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
Simulator device failed to launch com.example.app.
Underlying error (domain=FBSOpenApplicationServiceErrorDomain, code=4):
	The request to open "com.example.app" failed.
)

4/4 Flows Failed

Maestro version

1.40.2

How did you install Maestro?

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

Anything else?

This is bug with test filtering not with running tests.

prolificcoder avatar May 19 '25 13:05 prolificcoder

My reading of the docs is different. Look at the worked example in https://docs.maestro.dev/cli/tags#filtering

If they use --include-tags=dev,pull-request , both flows will run.

Where you expect an AND is where you use tags in the config alongside tags in the CLI (effectively double-filtering)

Fishbowler avatar May 19 '25 14:05 Fishbowler

How would I go about including tests that match both of them. Is there a way?

prolificcoder avatar May 19 '25 17:05 prolificcoder

@Fishbowler I also see it as intended behavior, we have the same reading of the docs, but I was just thinking if maybe it's worth a feature request for more filtering options directly in the CLI, like for example:

  1. --require-all-tags=dev,pull-request --require-no-tags=tagA,tagB
  2. --include-all-tags=dev,pull-request --exclude-all-tags=tagA,tagB same thing, but maybe better parity as --include-tags behavior is equal to include-any-tags, the any is implicit
  3. --all-include-tags=dev,pull-request --all-exclude-tags=... kinda the same as 2.
  4. --required-include-tags=dev,pull-request --required-exclude-tags=...
  5. or maybe like --flags=someOf(tagA,tagB),noneOf(TagD,TagE),allOf(dev,pull-request) for an alternative api for advanced filtering, such complex filtering may be an code/architecture smell, but I feel like it would be a good thing to be able to do so, I see myself using --flags=noneOf(TagC),allOf(dev,something),someOf(performance,ddos)

Hazer avatar Sep 26 '25 22:09 Hazer

I think the 2nd one looks easiest to document and explain to new users and existing users.

Fishbowler avatar Sep 27 '25 06:09 Fishbowler

That proposal suggests no change to exclusions?

Fishbowler avatar Oct 12 '25 21:10 Fishbowler