Skip to content

Commit 03fb887

Browse files
author
Keqiu Hu
authored
Merge pull request #119 from djrenfro/add_testAction_environmentVariables
#118: Read environment variables for test action
2 parents 1279a2a + 168416f commit 03fb887

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Bluepill-cli/BPInstanceTests/BPUtilsTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ - (void)testBuildArgsAndEnvironmentWithPath {
5454
@"MNTF_SCREENSHOTS_BASELINE_REAL" : @"/Documents/Baseline",
5555
@"MNTF_SCREENSHOTS_DIFF" : @"$(PROJECT_DIR)/build/outputs/tests_artifacts/Diff",
5656
@"MNTF_SCREENSHOTS_DIFF_REAL" : @"/Documents/Screenshots/Diff",
57-
@"MNTF_SCREENSHOTS_REAL" : @"/Documents/Screenshots"
57+
@"MNTF_SCREENSHOTS_REAL" : @"/Documents/Screenshots",
58+
@"TA_SCREENSHOTS_REAL" : @"/Documents/Screenshots"
5859
}
5960
};
6061
XCTAssert([dictionary isEqualToDictionary:expectedDictionary], @"Dictionary doesn't match expectation");

Bluepill-cli/BPInstanceTests/Resource Files/testScheme.xcscheme

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@
8686
ReferencedContainer = "container:mntf-ios.xcodeproj">
8787
</BuildableReference>
8888
</MacroExpansion>
89+
<EnvironmentVariables>
90+
<EnvironmentVariable
91+
key = "TA_SCREENSHOTS_REAL"
92+
value = "/Documents/Screenshots"
93+
isEnabled = "YES">
94+
</EnvironmentVariable>
95+
</EnvironmentVariables>
8996
<AdditionalOptions>
9097
</AdditionalOptions>
9198
</TestAction>

Source/Shared/BPUtils.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ + (NSDictionary *)buildArgsAndEnvironmentWith:(NSString *)schemePath {
160160
NSArray *argsNodes =
161161
[document nodesForXPath:[NSString stringWithFormat:@"//%@//CommandLineArgument", @"LaunchAction"] error:&error];
162162
NSAssert(error == nil, @"Failed to get nodes: %@", [error localizedFailureReason]);
163-
NSArray *envNodes =
164-
[document nodesForXPath:[NSString stringWithFormat:@"//%@//EnvironmentVariable", @"LaunchAction"] error:&error];
163+
NSMutableArray *envNodes = [[NSMutableArray alloc] init];
164+
[envNodes addObjectsFromArray:[document nodesForXPath:[NSString stringWithFormat:@"//%@//EnvironmentVariable", @"LaunchAction"] error:&error]];
165+
[envNodes addObjectsFromArray:[document nodesForXPath:[NSString stringWithFormat:@"//%@//EnvironmentVariable", @"TestAction"] error:&error]];
165166
for (NSXMLElement *node in argsNodes) {
166167
NSString *argument = [[node attributeForName:@"argument"] stringValue];
167168
NSArray *argumentsArray = [argument componentsSeparatedByString:@" "];

0 commit comments

Comments
 (0)