Skip to content

Commit

Permalink
Merge pull request #1231 from NASA-AMMOS/fix/e2e-test-gradle-env-parsing
Browse files Browse the repository at this point in the history
Fix Parsing Issues with .env in E2E-Tests
  • Loading branch information
Mythicaeda authored Nov 8, 2023
2 parents 16c6352 + c25cbe9 commit 44e4134
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions e2e-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@ jacocoTestReport {
}

task e2eTest(type: Test) {
ext.parseEnvFile = { filePath ->
file(filePath).readLines().each() {
if (!it.isEmpty() && !it.startsWith("#")) {
def (key, value) = it.tokenize('=')
if (key.startsWith("export ")) {
key = key.split("export ")[1];
}
if (System.getenv(key) == null) {
environment key, value
}
}
}
}

dependsOn ":examples:banananation:assemble"

if(file('.env').exists()) {
file('.env').readLines().each() {
def (key, value) = it.tokenize('=')
environment key, value
}
parseEnvFile('.env')
} else if(file('../.env').exists()){
file('../.env').readLines().each() {
def (key, value) = it.tokenize('=')
environment key, value
}
parseEnvFile('../.env')
}
environment "PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD", 1
// Run the tests in parallel to improve performance
Expand Down

0 comments on commit 44e4134

Please sign in to comment.