-
Notifications
You must be signed in to change notification settings - Fork 9
Add experimental support for testing on real devices #8
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
Open
schmidt9
wants to merge
22
commits into
devexperts:master
Choose a base branch
from
schmidt9:ifuse
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cdde436
add script;
schmidt9 52ded41
update swiftpm prefs
schmidt9 d1acfc6
fix "internal access" error for variables;
schmidt9 425739f
add comment
schmidt9 90c22db
add script doc
schmidt9 35c50a5
add description to readme;
schmidt9 710785b
Update README.md
schmidt9 3a4fede
Update README.md
schmidt9 4eb2742
refactor notSimulator check
schmidt9 cda6003
reformat script, add comments;
schmidt9 42ba814
fix script description
schmidt9 c998e54
remove scheme
schmidt9 45f4386
update post-action script
schmidt9 9eb251c
use rsync instead of cp;
schmidt9 9104b7d
add platform check
schmidt9 8d3db86
fix some SwiftLint warnings
schmidt9 e9fc4ac
add swiftpm directory to gitignore
schmidt9 ec5875a
avoid logging if log path not set
schmidt9 2fe3e37
rename script variables using SUITCASE prefix, change comments;
schmidt9 4212b36
fix default log path check
schmidt9 aabfd40
output date in script;
schmidt9 2093792
rename environment variable;
schmidt9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Scheme | ||
| LastUpgradeVersion = "1400" | ||
| version = "1.3"> | ||
| <BuildAction | ||
| parallelizeBuildables = "YES" | ||
| buildImplicitDependencies = "YES"> | ||
| <BuildActionEntries> | ||
| <BuildActionEntry | ||
| buildForTesting = "YES" | ||
| buildForRunning = "YES" | ||
| buildForProfiling = "YES" | ||
| buildForArchiving = "YES" | ||
| buildForAnalyzing = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "SUITCase" | ||
| BuildableName = "SUITCase" | ||
| BlueprintName = "SUITCase" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </BuildActionEntry> | ||
| </BuildActionEntries> | ||
| </BuildAction> | ||
| <TestAction | ||
| buildConfiguration = "Debug" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| <Testables> | ||
| <TestableReference | ||
| skipped = "NO"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "SUITCaseTests" | ||
| BuildableName = "SUITCaseTests" | ||
| BlueprintName = "SUITCaseTests" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </TestableReference> | ||
| </Testables> | ||
| </TestAction> | ||
| <LaunchAction | ||
| buildConfiguration = "Debug" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| launchStyle = "0" | ||
| useCustomWorkingDirectory = "NO" | ||
| ignoresPersistentStateOnLaunch = "NO" | ||
| debugDocumentVersioning = "YES" | ||
| debugServiceExtension = "internal" | ||
| allowLocationSimulation = "YES"> | ||
| </LaunchAction> | ||
| <ProfileAction | ||
| buildConfiguration = "Release" | ||
| shouldUseLaunchSchemeArgsEnv = "YES" | ||
| savedToolIdentifier = "" | ||
| useCustomWorkingDirectory = "NO" | ||
| debugDocumentVersioning = "YES"> | ||
| <MacroExpansion> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "SUITCase" | ||
| BuildableName = "SUITCase" | ||
| BlueprintName = "SUITCase" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </MacroExpansion> | ||
| </ProfileAction> | ||
| <AnalyzeAction | ||
| buildConfiguration = "Debug"> | ||
| </AnalyzeAction> | ||
| <ArchiveAction | ||
| buildConfiguration = "Release" | ||
| revealArchiveInOrganizer = "YES"> | ||
| </ArchiveAction> | ||
| </Scheme> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Add the following script as Post-action to your Target's scheme in Test section, set needed values: | ||
|
|
||
| ```sh | ||
| # set log file path where get_device_screenshots.sh script actions will be saved for debug purposes | ||
| LOG_FILE_PATH="$PROJECT_DIR/TestPostActions.log" | ||
| rm "$LOG_FILE_PATH" | ||
|
|
||
| # remote path - this path is valid if you install SUITCase as a remote package | ||
| SWIFT_PACKAGES_PATH="${BUILD_DIR%Build/*}SourcePackages/checkouts" | ||
| SCRIPT_PATH="$SWIFT_PACKAGES_PATH/suitcase/Scripts/get_device_screenshots.sh" | ||
| # local path - set manually if you add SUITCase as a local package | ||
| LOCAL_SCRIPT_PATH="" | ||
|
|
||
| if test -f "$SCRIPT_PATH"; then | ||
| echo "Script found at '$SCRIPT_PATH'" >> "$LOG_FILE_PATH" | ||
| else | ||
| echo "Script not found at '$SCRIPT_PATH'" >> "$LOG_FILE_PATH" | ||
|
|
||
| # try local path if it is set | ||
| if [[ -z $LOCAL_SCRIPT_PATH ]]; then | ||
| echo "Local path not set too, exiting" >> "$LOG_FILE_PATH" | ||
| exit | ||
| fi | ||
|
|
||
| SCRIPT_PATH=$LOCAL_SCRIPT_PATH | ||
|
|
||
| if test -f "$SCRIPT_PATH"; then | ||
| echo "Script found at '$SCRIPT_PATH'" >> "$LOG_FILE_PATH" | ||
| else | ||
| echo "Script not found at '$SCRIPT_PATH', exiting" >> "$LOG_FILE_PATH" | ||
| exit | ||
| fi | ||
| fi | ||
|
|
||
| # set path where to save test images retrieved from device | ||
| TEST_IMAGES_DESTINATION_PATH="$PROJECT_DIR/TestImages" | ||
|
|
||
| # set test images relative path inside application container without leading slash | ||
| # for instance FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("TestImages").path | ||
| TEST_IMAGES_SOURCE_PATH="Documents/TestImages" | ||
|
|
||
| # set tests target bundle id. This will be a runner app where images will be saved | ||
| TESTS_TARGET_BUNDLE_ID="com.suitcase.SUITCaseExampleAppUITests" | ||
|
|
||
| # run configured script | ||
| "$SCRIPT_PATH" "$TESTS_TARGET_BUNDLE_ID" "$TEST_IMAGES_SOURCE_PATH" "$TEST_IMAGES_DESTINATION_PATH" "$LOG_FILE_PATH" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
|
|
||
| # | ||
| # Add the following script as Post-action to your Target's scheme in Test section, set needed values: | ||
| # | ||
| # SCRIPT_PATH="$PROJECT_DIR/get_device_screenshots.sh" | ||
| # # set path where to save test images retrieved from device | ||
| # TEST_IMAGES_DESTINATION_PATH="$PROJECT_DIR/TestImages" | ||
| # # set test images relative path inside application container without leading slash | ||
| # # for instance FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent("TestImages").path | ||
| # TEST_IMAGES_SOURCE_PATH="Documents/TestImages" | ||
| # # set tests target bundle id. This will be a runner app where images will be saved | ||
| # TESTS_TARGET_BUNDLE_ID="com.suitcase.SUITCaseExampleAppUITests" | ||
| # "$SCRIPT_PATH" "$TESTS_TARGET_BUNDLE_ID" "$TEST_IMAGES_SOURCE_PATH" "$TEST_IMAGES_DESTINATION_PATH" | ||
|
|
||
|
|
||
| LOG_FILE_PATH="$4" | ||
|
|
||
| MOUNT_DIR="$HOME/fuse_mount_point" | ||
| echo "Mount point $MOUNT_DIR" >> "$LOG_FILE_PATH" | ||
|
|
||
| mkdir "$MOUNT_DIR" | ||
|
|
||
| # get input | ||
|
|
||
| TESTS_TARGET_BUNDLE_ID="$1.xctrunner" | ||
| TEST_IMAGES_SOURCE_PATH="$MOUNT_DIR/$2" | ||
| TEST_IMAGES_DESTINATION_PATH="$3" | ||
|
|
||
| echo "Got following data:" >> "$LOG_FILE_PATH" | ||
| echo "-- Bundle id $TESTS_TARGET_BUNDLE_ID" >> "$LOG_FILE_PATH" | ||
| echo "-- Images source path $TEST_IMAGES_SOURCE_PATH" >> "$LOG_FILE_PATH" | ||
| echo "-- Images destination path $TEST_IMAGES_DESTINATION_PATH" >> "$LOG_FILE_PATH" | ||
|
|
||
| # mount app container | ||
|
|
||
| echo "(Re)mounting '$TESTS_TARGET_BUNDLE_ID'" >> "$LOG_FILE_PATH" | ||
| # remount container to avoid copying error, make it forcibly (with -f flag) to get updated mounted container | ||
| umount -f -v "$MOUNT_DIR" >> "$LOG_FILE_PATH" 2>&1 | ||
| ifuse --debug --container $TESTS_TARGET_BUNDLE_ID "$MOUNT_DIR" >> "$LOG_FILE_PATH" 2>&1 | ||
|
|
||
| # copy images | ||
|
|
||
| echo "Copying images from $TEST_IMAGES_SOURCE_PATH to $TEST_IMAGES_DESTINATION_PATH" | ||
| cp -r "$TEST_IMAGES_SOURCE_PATH" "$TEST_IMAGES_DESTINATION_PATH" >> "$LOG_FILE_PATH" 2>&1 | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.