Skip to content

Commit

Permalink
Fix environment variables for multi-flow runs (#2163)
Browse files Browse the repository at this point in the history
* Add e2e-test for environment variables

* Apply environment variables to test suite runs (fixes #2101)
  • Loading branch information
Fishbowler authored Dec 5, 2024
1 parent c677568 commit 66e5e15
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
ANDROID_HOME: /home/runner/androidsdk
ANDROID_SDK_ROOT: /home/runner/androidsdk
ANDROID_OS_IMAGE: system-images;android-28;google_apis;x86_64
MAESTRO_EXAMPLE: test-value

steps:
- name: Enable KVM group perms
Expand Down
5 changes: 5 additions & 0 deletions e2e/workspaces/no-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# No App

For tests that don't require an app to be launched.

Tests of JavaScript or environment variables can be run here.
6 changes: 6 additions & 0 deletions e2e/workspaces/no-app/environment-variables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: com.example.notused
tags:
- passing
---
# Relies on MAESTRO_EXAMPLE being set in the environment
- assertTrue: ${MAESTRO_EXAMPLE == 'test-value'}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ class TestSuiteInteractor(

// proceed to run all other Flows
executionPlan.flowsToRun.forEach { flow ->
val (result, aiOutput) = runFlow(flow.toFile(), env, maestro, debugOutputPath)
val flowFile = flow.toFile()
val updatedEnv = env
.withInjectedShellEnvVars()
.withDefaultEnvVars(flowFile)
val (result, aiOutput) = runFlow(flowFile, updatedEnv, maestro, debugOutputPath)
aiOutputs.add(aiOutput)

if (result.status == FlowStatus.ERROR) {
Expand Down

0 comments on commit 66e5e15

Please sign in to comment.