New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --script-file-path to run a user script #290
Add --script-file-path to run a user script #290
Conversation
… booted, but before tests are run
Source/Shared/BPConfiguration.m
Outdated
@@ -141,6 +141,8 @@ typedef NS_OPTIONS(NSUInteger, BPOptionType) { | |||
"Directory where simulator screenshots for failed ui tests will be stored"}, | |||
{362, "simulator-preferences-file", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_VALUE | BP_PATH, "simulatorPreferencesFile", | |||
"A .GlobalPreferences.plist simulator preferences file to be copied to any newly created simulators before booting"}, | |||
{363, "script-file-path", BP_MASTER | BP_SLAVE, NO, NO, required_argument, NULL, BP_VALUE | BP_PATH, "scriptFilePath", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just script-file
@@ -0,0 +1,5 @@ | |||
#!/bin/sh | |||
|
|||
# This is a script to test --script-file-path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to test-script.sh
XCTAssert(exitCode2 == BPExitStatusSimulatorDeleted); | ||
XCTAssertEqualObjects(self.config.deleteSimUDID, bp2.test_simulatorUDID); | ||
|
||
XCTAssertFalse([[NSFileManager defaultManager] fileExistsAtPath:testFile]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also delete the testfile after this test finishes
@@ -718,6 +720,18 @@ - (BOOL)validateConfigWithError:(NSError *__autoreleasing *)err { | |||
} | |||
} | |||
|
|||
if (self.scriptFilePath) { | |||
if ([[NSFileManager defaultManager] fileExistsAtPath:self.scriptFilePath isDirectory:&isdir]) { | |||
if (isdir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also make sure this file is executable
- rename script-file-path option to script-file - rename script.sh file to test-script.sh - if test file is not removed by sim delete, remove in test - check to see if the script is executable
@oliverhu all comments addressed in latest commit |
LGTM, thanks |
This adds a way to run a script after a simulator is booted, but before tests are run. One reason to use this is to install certificates to integrate with mitmproxy (per #194)