mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.76k stars 266 forks source link

`addMedia` command does not resolve path consistently based on execution context #1707

Open greeeg opened 6 months ago

greeeg commented 6 months ago

Describe the bug

I have a project folder structure like this:

.
├── e2e
│   ├── output
│   ├── assets
│   ├── scenarios
│   ├── scripts
│   └── utils

Assets contains medias I'm using with addMedia in my scenarios:

# e2e/scenarios/my-scenario.yaml
appId: com.example
name: Attach a receipt to a transaction
---
- addMedia:
    - '../assets/sample-receipt.jpg'

When running maestro test ./e2e/scenarios/my-scenario.yaml, everything works as expected, but when I run maestro test e2e/scenarios, the relative path does not work. I could only make it work by moving the assets folder within the scenarios folder.

I would expect this to work in both contexts, or the notion of Maestro workspace needs to be clarified

Environment information (please complete the following information):

mskhan18 commented 5 months ago

Any update regarding this issue?

bartekpacia commented 2 months ago

Hey @greeeg, thanks for reporting this bug - I reproduced it.

Directory hierarchy:

.maestro
├── assets
│   └── image.png
├── assets_example
│   └── flow.yaml

Flow:

appId: com.example.example
---
- launchApp
- addMedia:
    - ../assets/image.png

Works (as it should)

maestro test .maestro/assets_example/flow.yaml

Does not work (but should work)

maestro test .maestro/assets_example

Error: The File "image.png" referenced in flow file: /Users/bartek/projects/demo_app/.maestro/assets_example/flow.yaml not found in workspace