Skip to content

Commit c7e9599

Browse files
authored
Propagate log environment variable to unit tests for the app. (#10718)
1 parent fabe88f commit c7e9599

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcodeproj/xcshareddata/xcschemes/AppQualityDevApp_iOS.xcscheme

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
isEnabled = "YES">
8282
</CommandLineArgument>
8383
</CommandLineArguments>
84+
<EnvironmentVariables>
85+
<EnvironmentVariable
86+
key = "FirebaseSessionsRunEnvironment"
87+
value = "$(FirebaseSessionsRunEnvironment)"
88+
isEnabled = "YES">
89+
</EnvironmentVariable>
90+
</EnvironmentVariables>
8491
</LaunchAction>
8592
<ProfileAction
8693
buildConfiguration = "Release"

FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcodeproj/xcshareddata/xcschemes/UITests_iOS.xcscheme

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
debugDocumentVersioning = "YES"
3636
debugServiceExtension = "internal"
3737
allowLocationSimulation = "YES">
38+
<EnvironmentVariables>
39+
<EnvironmentVariable
40+
key = "FirebaseSessionsRunEnvironment"
41+
value = "$FirebaseSessionsRunEnvironment"
42+
isEnabled = "YES">
43+
</EnvironmentVariable>
44+
</EnvironmentVariables>
3845
</LaunchAction>
3946
<ProfileAction
4047
buildConfiguration = "Release"

FirebaseSessions/Tests/TestApp/UITestsiOS/UITestsiOS.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ final class UITestsiOS: XCTestCase {
1919
func test_sessionGenerated_onColdStart() throws {
2020
// UI tests must launch the application that they test.
2121
let app = XCUIApplication()
22+
23+
// Collect necessary environment variables and propagate them as necessary
24+
let environment = ProcessInfo.processInfo.environment["FirebaseSessionsRunEnvironment"]
25+
if environment != nil {
26+
let variables = ["FirebaseSessionsRunEnvironment": environment!]
27+
app.launchEnvironment = variables
28+
}
29+
2230
app.launch()
2331
XCUIDevice.shared.press(.home)
2432
app.activate()

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ case "$product-$platform-$method" in
549549
# Run E2E Integration Tests for Autopush.
550550
RunXcodebuild \
551551
-workspace 'FirebaseSessions/Tests/TestApp/AppQualityDevApp.xcworkspace' \
552-
FirebaseSessionsRunEnvironment=AUTOPUSH \
553552
-scheme "AppQualityDevApp_iOS" \
553+
FirebaseSessionsRunEnvironment=AUTOPUSH \
554554
"${ios_flags[@]}" \
555555
"${xcb_flags[@]}" \
556556
build \

0 commit comments

Comments
 (0)