Reputation: 31
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).
Upvotes: 2
Views: 95
Reputation: 483
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.com
-e APP_ID=myappid
Within your package.json
, edit test
script ;
maestro test maestro.yml $(eas env:list --environment=development 2> /dev/null | grep = | sed 's/^/-e /g')
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
Upvotes: 1