admin管理员组

文章数量:1289496

I'm setting up an end-to-end (E2E) workflow using Maestro in an Expo EAS environment. The following command works perfectly in my local development environment:

maestro test -e APP_ID=myappid

And my maestro.yml looks like this:

appId: ${APP_ID}
---
- launchApp:
    clearState: true

However, when running this in the EAS environment, it fails to find the APP_ID and throws the following error:

maestro.cli.runner.TestSuiteInteractor.invoke: Launch app "${APP_ID}" with clear state FAILED

It seems like Maestro is not able to resolve the environment variable (APP_ID) inside the EAS environment.

How can I correctly pass environment variables like APP_ID to Maestro when running tests in an EAS build? Is there a specific way to ensure that Maestro picks up environment variables in an Expo EAS environment?

Any insights would be greatly appreciated!

Hardcoding the appId directly in maestro.yml (which works but is not a viable solution for different environments).

I'm setting up an end-to-end (E2E) workflow using Maestro in an Expo EAS environment. The following command works perfectly in my local development environment:

maestro test -e APP_ID=myappid

And my maestro.yml looks like this:

appId: ${APP_ID}
---
- launchApp:
    clearState: true

However, when running this in the EAS environment, it fails to find the APP_ID and throws the following error:

maestro.cli.runner.TestSuiteInteractor.invoke: Launch app "${APP_ID}" with clear state FAILED

It seems like Maestro is not able to resolve the environment variable (APP_ID) inside the EAS environment.

How can I correctly pass environment variables like APP_ID to Maestro when running tests in an EAS build? Is there a specific way to ensure that Maestro picks up environment variables in an Expo EAS environment?

Any insights would be greatly appreciated!

Hardcoding the appId directly in maestro.yml (which works but is not a viable solution for different environments).

Share Improve this question asked Feb 19 at 23:57 RightHotRightHot 334 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I believe there's is no "clean" solution, at the moment.


As a workaround, to make sure maestro always use the same environment variables as EAS, you might use a command like this to maestro :

eas env:list --environment=development 2> /dev/null | grep = | sed 's/^/-e /g'

Note: You might want to replace development by preview or production.

This commands will 1) format the output such that -e is appended before each variable, and 2) suppressing errors

Expected output example :

-e EXPO_PUBLIC_BASE_URL=https://example
-e APP_ID=myappid

Within your package.json, edit test script ;

  1. If you have setup your environment variables within EAS, then use it like above:
maestro test maestro.yml $(eas env:list --environment=development 2> /dev/null | grep = | sed 's/^/-e /g')
  1. If you have setup your environment variables within an environment file (I personally prefer this one):
maestro test maestro.yml $(cat .env.development | sed -E 's/^(.*)(#.*)$/\1/g' | egrep -v '^(\s*)$' | sed 's/^/-e /g')

This command will 1) ignore comments, 2) ignore blank lines, and 3) append -e before each variable

本文标签: react nativeHow to pass environment variables to Maestro in Expo EAS buildStack Overflow