Git Product home page Git Product logo

ui-screen-shooter's Introduction

UI Screen Shooter

DEPRECATED

I'm no longer able to maintain the development of this project, but fear not! Felix Krause has done a fantastic job integrating iOS screenshot capability in his all-encompasing fastlane project. I would recommend looking into his screenshot project for your needs.


UI Screen Shooter will take screen shots for your iOS app for the App Store automatically using UI Automation. This will produce the images needed in each localization, for each device, and in each screen of the app you need. This saves quite a bit of time since we need to generate screens for the 3.5", 4", 4.5", and 5.5" displays, and both iPhone and iPad if your app is universal--not to mention that you have to do this for every localization you support in the store.

Prerequisites

You will need Apple's Xcode and its included instruments. Additionally, install command line tools using Xcode 5 or later by running xcode-select --install in your Terminal.
Optional: ImageMagick, to remove alpha channel (which iTunes Connect requires). Script will run regardless of whether its installed or not.

Demonstration

To run the demonstration, copy the two example config files and rename them without "example", then run ./ui-screen-shooter.sh from inside the project directory. After a few minutes, you can open the destination directory and see all the languages, devices types and screen sizes as PNGs. By default each screenshot is saved to ~/Desktop/screenshots/ named like so:

en_US/iphone5-portrait-screen1.png
...

You can see the script run against one of my apps in this video.

Usage

To use UI Screen Shooter, clone or download inside your project's folder. Then copy the example config files and rename without "example". You may need to change the "Release" build configuration to add i386 to the VALID_ARCHITECTURES for this to work. Then play with the script automation/config-automation.js to simulate the user interaction you want. After your screen shots are saved, see https://github.com/rhaining/itc-localized-screenshot-uploader about uploading them in batch to iTunes connect.

How It Works

ui-screen-shooter.sh triggers a build of the application for the iOS simulator and puts the resulting bundle in /tmp with a custom name so it can find it. Then, the instruments command line tool is invoked which installs the app bundle and then executes automation/shoot_the_screens.js which drives the simulator. config-automation.js drives the app and calls captureLocalizedScreenshot() to shoot each image after navigating to the right screen.

captureLocalizedScreenshot() is a custom method that checks for the device and whether it's a 4" display or not, deduces the orientation, and generates the screenshot file name along with the user supplied identifier. Once the name is calculated, it calls captureScreenWithName() on the UIATarget which saves the image along with the Instruments trace results in /tmp.

After each time the automation script ends, ui-screen-shooter.sh copies all the screenshots taken for that Instruments trace run and copies them to locale subdirectories in the destination directory. Then it continues on to execute the same automation script again with a new language or an a new device type. Check out the main function in ui-screen-shooter.sh for how this is all set up.

The app build process may be the most difficult part for you if you're trying to integrate this with your project. xcodebuild needs extra details if you're using an explicit workspace or using a beta version of the dev tools. If the app isn't building, see if you can try to get xcodebuild to work yourself and then alter the xcode function in ui-screen-shooter.sh to match your setup.

For More Info

To learn more about UI Automation, check out my collection of resources on cocoamanifest.net.

Contributing

Feel free to fork the project and submit a pull request. If you have any good ideas to make this easier to set up for new users, that would be great!

Thanks

Thanks to all who have submitted pull requests and offered improvements. Special thanks to Ole Begemann for his marvelous post on NSUserDefaults that inspired me to pass the locale information in on the command line rather than what I was doing before by manipulating the simulate preference plist files.

Contact

Questions? Ask!

Jonathan Penn

License

UI Screen Shooter is available under the MIT license. See the LICENSE file for more info.

ui-screen-shooter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui-screen-shooter's Issues

Revert back to original locale

After the script is run, simulator locale is set to last locale screensshot.
Would be great to revert to original situation.

Might be due to the fact that initiale local was not set.

Problem with incremental version 7.0.3

Hi, Jonathan,

Thanks for a really nifty tool!

When trying out the run_screenshooter.sh demo, I ran into a problem. The script failed with the following results:

** BUILD SUCCEEDED **

Localizing for en_US
2013-11-09 14:06:24.434 ScriptAgent[4248:2f07] CFPreferences: user home directory at file:///Users/[username]/Library/Application%20Support/iPhone%20Simulator/7.0/ is unavailable. User domains will be volatile.
2013-11-09 14:06:24.546 ScriptAgent[4248:2f07] CLTilesManagerClient: initialize, sSharedTilesManagerClient
2013-11-09 14:06:24.546 ScriptAgent[4248:2f07] CLTilesManagerClient: init
2013-11-09 14:06:24.546 ScriptAgent[4248:2f07] CLTilesManagerClient: reconnecting, 0x9600000
2013-11-09 14:06:54.691 ScriptAgent[4248:2f07] +[UIAXElement initializeAccessibility]: UIAutomation never received kAXAccessibilityLoaded.  Waited 30.03 seconds.
2013-11-09 14:06:54.692 ScriptAgent[4248:2f07] AXError: Could not auto-register for pid status change
2013-11-09 14:06:54.693 ScriptAgent[4248:2f07] Failed to enable accessiblity, kAXErrorServerNotFound
2013-11-09 14:06:55.223 instruments[4211:6007] Automation Instrument ran into an exception while trying to run the script.  UIAScriptAgentSignaledException
2013-11-09 19:06:55 +0000 Fail: An error occurred while trying to run the script.
Instruments Trace Complete (Duration : 39.346142s; Output : /tmp/screen_shooter/traces/trace.trace)

The first error gives a clue to the solution. In my case, in the user directory there was no folder:

... iPhone%20Simulator/7.0/

Instead there was only the newest version folder, i.e.:

... iPhone%20Simulator/7.0.3/

To solve the problem, I just added a symlink:

$ cd /Users/[username]/Library/Application%20Support/iPhone%20Simulator/
$ ln -s 7.0.3 7.0

Pretty simple, and it worked fine. This was mentioned in a slightly different context here: https://groups.google.com/d/msg/zucchini-discuss/fQNrfOTaIuU/NLM5-Hk45tYJ

Just thought you (or other users) might find it helpful.

Bug in Landscape Orientation

There is a problem with the landscape mode. The resolution in rect is not exactly 568.0 etc. Sometimes it's something like 568.0000000235217. Thus the function rectMaxSizeMatchesPhoneWithMaxDimensionForOrientation returns the wrong value.

Replacing the old rectMaxSizeMatchesPhoneWithMaxDimensionForOrientation with

function rectMaxSizeMatchesPhoneWithMaxDimensionForOrientation(rect, maxDimension, orientation) {
return (orientation == kPortraitString && rect.size.height.toFixed() == maxDimension) || (orientation == kLandscapeString && rect.size.width.toFixed() == maxDimension)
}

fixes this bug.

Use -w parameter of instruments command

After I upgraded to Xcode 5.1.1, ui-screen-shooter stopped working with 3.5" iPhone retina screenshots. I did a little digging, and I think I've found a better way than AppleScript to select the correct simulator. The instruments command had a -w parameter, which takes the name of a device or simulator to use. Run instruments -s devices to see a list of available devices and simulators.

I think the use of AppleScript should be replaced with the use of the -w flag to set the simulator directly. @jonathanpenn I would like to hear your thoughts, and then I will work on it and submit a pull request.

Target failed to run: The operation couldn’t be completed.

Hi Jonathan,
thanks for this great script. I really appreciate your work.

I have only one problem. Half of the time when running the script I get the error:

$ ./ui-screen-shooter.sh
[...]
Running automation script "./config-automation.js"
          for "iPad 2"
          in language "en-US"...
Waiting for device to boot...
2014-10-31 15:09:32.009 instruments[44646:1015886] WebKit Threading Violation - initial use of WebKit from a secondary thread.
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier 'com.xxx.yyy'

After few tries, I've understood that resetting the simulator and re-running the script it works fine.

$ ./ui-screen-shooter.sh
[...]
Running automation script "./config-automation.js"
          for "iPad 2"
          in language "en-US"...
2014-10-31 15:10:31.981 instruments[44764:1017855] WebKit Threading Violation - initial use of WebKit from a secondary thread.
2014-10-31 15:10:34 +0000 Debug: target.captureRectOnScreenWithName("{origin:{x:0.00,y:0.00}, size:{height:1024.00,width:768.00}}", UIScreen, "iOS-iPad___portrait___WelcomeScreen")
2014-10-31 15:10:34 +0000 Screenshot captured.
Instruments Trace Complete (Duration : 3.712188s; Output : /tmp/screen_shooter/traces/trace.trace)

Then problem is that it's unpredictable, so I have to reset the simulator a lot of times.
Do you have any idea why this is happening?

I have Xcode 6.1 with an app that run exclusively on iOS 8.1.

Thanks

Not able to run... /tmp/screen_shooter/traces/Run 1/: No such file or directory

Not able to run the example, getting this error:

find: /tmp/screen_shooter/traces/Run 1/: No such file or directory

Full logs.

** BUILD SUCCEEDED **

Running automation script "./config-automation.js"
for "iPhone 6 (8.3 Simulator),"
in language "en-US"...
Waiting for device to boot...
2015-05-16 14:17:57.486 instruments[661:5614] Argument 'UIASCRIPT' does not point to a valid script. Using script defined in template.
Instruments Trace Complete (Duration : 3.175483s; Output : /tmp/screen_shooter/traces/trace.trace)
find: /tmp/screen_shooter/traces/Run 1/: No such file or directory

Doesn't work with cordova/phonegap

Doesn't work with cordova/phonegap, libCordova.a problem. Just created a default project:

cordova create test
cd test
cordova platform add ios

Running your script results in:

Release-iphonesimulator/HelloCordova.build/Objects-normal/x86_64/app
ld: file not found: /tmp/screen_shooter/libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld build/HelloCordova.build/Release-iphonesimulator/HelloCordova.build/Objects-normal/i386/app normal i386
    Ld build/HelloCordova.build/Release-iphonesimulator/HelloCordova.build/Objects-normal/x86_64/app normal x86_64

Any chance to get this fixed?

Thanks!

Problems with xcodebuild workaround

This is an awesome project and Apple should really include a version of this in their dev tools! Thanks a lot! 👍

Now, trying to make ui-screen-shooter work with a project using CocoaPods on XCode 5, I never got xcodebuild to work properly.

Could we integrate a tool like https://github.com/nomad/shenzhen to handle the building part? Or could we even just use the DerivedData from XCode's GUI build command? (which is what I ended up doing as a workaround)

It seems like xcodebuild is brittle, hard to configure (judging by all the Jenkins people on Google who get similar errors as me) and not really related to the scope of this project. I think it seems desirable to avoid requiring it to work.

(Not saying it shouldn't totally be the way to go, just that in it's current state xcodebuild is too hard to configure correctly, and that there are easier ways to get to the build products.)

How to make it work with cocos2d game?

I'm getting this error in Terminal on clean Cocos2d-iPhone v3.1 project:

ld: library not found for -lObjectiveChipmunk
clang: error: linker command failed with exit code 1 (use -v to see invocation)

And this errors in Terminal on clean cocos2d project made by SpriteBuilder project:

Check dependencies
Unable to run command 'Libtool libapp.a' - this target might include its own product.
Unable to run command 'Libtool libapp.a' - this target might include its own product.
Unable to run command 'CreateUniversalBinary libapp.a' - this target might include its own product.

Of course all projects work on simulator and on devices.
ui-screen-shooter works great on test project and on clean single view project.

Update filenames

Update filenames to match correct pattern for downstream itc-localized-screenshot-uploader

screenshots/en_us+iOS-3.5-in+1.png

Other devices are iOS-4-in and `iOS-iPad'. This is the preferred format as it is specified by iTunes Transporter.

See also:

rhaining/itc-localized-screenshot-uploader#4

Can’t get menu "iPhone Retina (3.5-inch)"

Hi !

I'm running

./run_screenshooter.sh ~/Desktop/screenshots

And I get this error :

bin/choose_sim_device:2036:2041: execution error: System Events got an error: Can’t get menu "iPhone Retina (3.5-inch)" of menu item "iPhone Retina (3.5-inch)" of menu 1 of menu item 1 of menu 1 of menu bar item 5 of menu bar 1 of process "iOS Simulator". (-1728)

Here is the full gist of what is happening : https://gist.github.com/Palleas/67a99c500d589e6ea643

Any idea why ?
I'm running Xcode 5 with OSX 10.9.

Thanks !

When running the script,

When running the script, I get the following:

** BUILD SUCCEEDED **

bin/choose_sim_device:1629:1637: execution error: An error of type -10660 has occurred. (-10660)

Has anyone ever seen this before? Any tips?

Resource busy

Hi jonathanpenn,

I've an issue:

* BUILD SUCCEEDED **
Localizing for en
bin/unix_instruments: line 54: /dev/ptyvf: Resource busy
cp: /tmp/screen_shooter/traces/Run 1/
.png: No such file or directory

As before I'll drop in my info:

Xcode v: 5.0.2
OSX: 10.9

Simulator hardware screenshot:
screen shot 2013-12-03 at 10 43 29 am

Support custom js file location

New use case:

  1. Open my app at ~/Developer/impostor
  2. Clone ui-screen-shooter to ~/Developer/impostor/ui-screen-shooter
  3. Create script at ~/Developer/impostor/make_screenshots.js
  4. cd ~/Developer/impostor && ui-screen-shooter/ui-screen-shooter.sh ~/Desktop ./make_screenshots.js
    Or even better, ~/Desktop and ./*.js should be the default

If #27 and #28 are complete then the bin directory is gone. Otherwise we need something like: DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

choose_sim_device fails with error -10810

I've been using ui-screen-shooter successfully for a while - thanks for putting it together!

Lately, though, when I try to run it, the choose_sim_device script fails with error -10810:

bin/choose_sim_device:2840:2845: execution error: An error of type -10810 has occurred. (-10810)

I have Xcode 5.0.2 installed and selected via xcode-select. I also have Xcode 5.1 beta 5 installed, for whatever that's worth. This is running on OS X 10.9.1.

I spent some time trying to work it out, but I am not very familiar with AppleScript and didn't get very far... sorry! Any ideas?

Remove unix_instruments wrapper script

The wrapper script is used to returns a proper unix status code but actually in is run inside function _run_automation which is called from:

  for simulator in "${simulators[@]}"; do
    for language in $languages; do
      _clean_trace_results_dir
      _run_automation "automation/shoot_the_screens.js" "$language" "$simulator"
      _copy_screenshots "$language"
    done
  done

It seems like this wrapper is not needed any more. Or maybe I am not understanding this properly.

Update for XCode 6 GM

Now that XCode 6 is GM we can talk about it and get ready! Here is the bug running it so far.

Running automation script "./shoot_the_screens.js"
          for "iPad Retina"
          in language "nl-NL"...
Waiting for device to boot...
Instruments Usage Error : The specified template '/Applications/Xcode.app/Contents/Developer/../Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate' does not exist.
instruments, version 6.0 (56156)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]

3.5in simulator not starting

For some reason, I get two runs of screenshots using the same 4in 64bit sim, never the 3.5 in one. This is with XCode 5.1 and iOS 7.1.
I've had that happen before, but a restart usually fixed it.

Any ideas?

How to use this in simulator

Hi,
i am tray use this code for how to get screen short
while i run in terminal i am facing below error ,

./run_screenshooter.sh ~/Desktop/screenshots
Saving original language en...
Error: No developer directory found at /Volumes/DATA/Xcode.app/Contents/Developer. Run /usr/bin/xcode-select to update the developer directory path.

how to take different application screen shots with this application

Thanks in advance

Update function _xcode for CocoaPods

The _xcode function will build a single project in the current directory.

Please update to work easily with CocoaPods which will use workspace in the current directory.

Region/Locale not set properly in XCode6

I am trying to make screenshots in different languages, but every language must use its own locale as i am showing currencies in the screenshot.
However the languages array in ui-screen-shooter.sh is set to 'languages="de-DE en-US en-GB"'.
The effect however ist that the language in the simulator is set accoringly, but the currency does not reflect the approprioate region.

Is there any solution to this or is it a change how Instrumentation works in Xcode6?

Thanks and regards.

locale is not always same as language

For the United States, language = 'en' but locale should be 'en_US'. I noticed this when some code I use to get the currency symbol would return an unexpected string:

    NSString *currencySymbol = [currentUserLocale objectForKey:NSLocaleCurrencySymbol];

I tracked the problem down to chose_sim_language, setting locale='en' caused the bad currency symbol.

I made the following modification to chose_sim_language which solved my problem:

    # Create the language array with just the given language
    # Special case for US locale != language:
    if [[ $1 == "en" ]]; then
        locale="en_US"
    else
        locale = $1
    fi
    _plistbuddy "$file" \
    -c "Add :AppleLanguages array" \
    -c "Add :AppleLanguages:0 string '$1'" \
    -c "Add :AppleLocale string '$locale'"

I didn't delve into this issue too much further other than to solve my own problem, but I presume that UK developers would need a similar if-then for 'en_GB'.

The above was tested using xcode 5 and iOS7.

Should build texture atlasses, but copies them

I have a SpriteKit project which uses texture atlasses. (Xcode 6.2, Mavericks 10.9.5) These are directories named like "Shield.atlas" and they contain a few image file. When the project is built by Xcode, it "compiles" these directories and the result is a "Shield.atlasc" in the built app which contains a single png file and a plist file describing the location of the individual textures in the new png file. The build log in Xcode shows, that this tool is used:

/Applications/Xcode.app/Contents/Developer/Tools/../usr/bin/TextureAtlas

In the output of the screen shooter script it shows:

CpResource path/to/Shield.atlas /tmp/screen_shooter/app.app/Shield.atlas
    cd /path/to/my/project
    export PATH="my path environment"
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /path/to/Shield.atlas /tmp/screen_shooter/app.app

So I assume that somewhere .atlas resources must be handled special.

Is this something which needs to fixed in my project, or in ui-screen-shooter?

(I do not yet know all the features of Xcode and I may miss some simple setting somewhere which may solve that already.)

Way to Simulate Pressing a Table Row?

I know that you select a button by pressing the buttons like so:
window.buttons()[0].tap();

in the shoot_the_screen.js file but is there a way to simulate selecting a table row?

Thanks.

iOS Simulator failed to install the application

I have copied all the files in the same folder in which my project is and when I run the following command:
./ui-screen-shooter.sh ~/Desktop/screenshots

Build succeeded and the iOS simulator also opens up, however, an alert dialog opens up with the message "iOS Simulator failed to install the application". Please help.

add custom xcodebuild parameters to config-screenshots.sh

The way I have my app set up, it does slightly different things (e.g. loads placeholder data) when I am taking screenshots. I do this by passing SCREENSHOTS=1 to the invocation of xcodebuild in ui-screen-shooter.h.

In the new model, where configuration is in a separate file, I would like to suggest that config-screenshots.example.sh include a placeholder, empty export where you can set arbitrary build parameters that get passed to xcodebuild. Related: I would be interested to hear if anyone else has their app run special code when taking screenshots, and how they accomplish this. Maybe there is a better way?

Segmentation fault: 11 error

I copied

capture.js
config-automation.js
config-screenshots.sh
ui-screen-shooter.sh
unix_instruments.sh

To root project folder, try to run ./ui-screen-shooter.sh

And after cleaning got error (only for the first run): ./ui-screen-shooter.sh: line 103: 45211 Bus error: 10

Clean.Remove clean /Users/petrkorolev/Library/Developer/Xcode/DerivedData/EconomicCalendar-gkqposcfrltfxocwxldozxpntlvm/Build/Intermediates/PrecompiledHeaders/Pods-DTFoundation-prefix-ajekpypvzzkmescxwqrvatwyqmku/Pods-DTFoundation-prefix.pch.pch
builtin-rm -rf /Users/petrkorolev/Library/Developer/Xcode/DerivedData/EconomicCalendar-gkqposcfrltfxocwxldozxpntlvm/Build/Intermediates/PrecompiledHeaders/Pods-DTFoundation-prefix-ajekpypvzzkmescxwqrvatwyqmku/Pods-DTFoundation-prefix.pch.pch
./ui-screen-shooter.sh: line 103: 45211 Bus error: 10           xcodebuild -sdk "iphonesimulator$ios_version" CONFIGURATION_BUILD_DIR="$build_dir/build" -workspace "$base.xcworkspace" -scheme "$base" -configuration Debug DSTROOT=$build_dir OBJROOT=$build_dir SYMROOT=$build_dir GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS SCREENSHOTS=1' ONLY_ACTIVE_ARCH=NO "$@"

And all next attempts to run got another error: ./ui-screen-shooter.sh: line 103: 51123 Segmentation fault: 11

Check dependencies
./ui-screen-shooter.sh: line 103: 51123 Segmentation fault: 11  xcodebuild -sdk "iphonesimulator$ios_version" CONFIGURATION_BUILD_DIR="$build_dir/build" -workspace "$base.xcworkspace" -scheme "$base" -configuration Debug DSTROOT=$build_dir OBJROOT=$build_dir SYMROOT=$build_dir GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS SCREENSHOTS=1' ONLY_ACTIVE_ARCH=NO "$@"

Can't figure out what cause this error. (With your example all works fine)

Support custom package build

Allow a 3rd runtime parameter to specify a package to use. This will avoid building the package using this tool. It will also allow you to use ui-screen-shooter with CocoaPods.

Discussion from: #29 and #26

Add option to delete existing screenshots folder

When I'm trying to get something new to work, it's annoying to keep having to delete the previous run's output by hand. It would be nice to have a prompt: “Would you like to delete the images from the previous run? Y/n.” And perhaps an argument that, when passed, auto-deletes the results.

Typos in ui-screen-shooter.sh

Line 31 (in the comment): replace "cmm-Hans" with "zh-Hans"
Line 33: "jp" is not a valid language symbol, the correct symbol for Japanese is "ja"

Run ui-screen-shooter on device, not on simulator.

Is it possible to run ui-screen-shooter on iPhone device? not on simulator?
my output:
Running automation script "./config-automation.js"
for "iPhone (8.3)"
in language "en-US"...
2015-06-17 13:54:25.140 instruments[930:18893] WebKit Threading Violation - initial use of WebKit from a secondary thread.
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.) : Failed to launch process with bundle identifier 'net.cocoamanifest.app'
Instruments failed to start up... retrying in 2 seconds
2015-06-17 13:54:29.990 instruments[941:18974] WebKit Threading Violation - initial use of WebKit from a secondary thread.
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.) : Failed to launch process with bundle identifier 'net.cocoamanifest.app'
Instruments failed to start up... retrying in 2 seconds

System Events error

Thanks for the great scripts - it will be a huge time saver. I'm running into a little snag after a successful build. This is what I'm seeing:

** BUILD SUCCEEDED **

bin/choose_sim_device:1961:2003: execution error: System Events got an error: Can’t get menu item "iPhone (Retina 3.5-inch)" of menu 1 of menu item 1 of menu 1 of menu bar item 5 of menu bar 1 of process "iPhone Simulator". (-1728)

I'm running Xcode 4.6.3 with latest command line tools installed. Full disclosure: I have Xcode 5 installed as well, but have verified that Xcode 4.6.3 is doing the work (with xcode-select). I've also verified that System Events is present and where it should be (same with iPhone Simulator, and all applicable SDKs are also installed - the script is currently running against 6.1).

Also, executing choose_sim_device alone (as recommended in the documentation of the file) yielded similar results:

$ bin/choose_sim_device "iPad (Retina)"
bin/choose_sim_device:1961:2003: execution error: System Events got an error: Can’t get menu item "iPad (Retina)" of menu 1 of menu item 1 of menu 1 of menu bar item 5 of menu bar 1 of process "iPhone Simulator". (-1728)

Have you seen this error before? Any ideas? Thanks in advance.

Example not working in Xcode 6.0.1

Running automation script "./shoot_the_screens.js"
for "iPhone 6 (8.0 Simulator) [XXXXXXXXXXXX]"
in language "en-US"...
Instruments Usage Error : The specified template '/Applications/Xcode.app/Contents/Developer/../Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate' does not exist.
instruments, version 6.0 (56156)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]

UI Screen Shooter should be easier to keep up to date

Since there is no auto-update mechanism, I spent a few hours trying to get my project to build before realizing that I was not using the latest version of the scripts. It would probably be difficult to separate out the parts of the code that the user has to change into some kind of config file, but it would mean that distribution through something like CocoaPods would be possible, which would make it much more likely that users have the latest version.

fatal error: '-Swift.h' file not found

it looks like xcode generated Project-name.Swift.h file isn't taken into account when CompileC is compiling source files that call the -Swift.h file

I even copied the file from the derived data folder and aded it to my project but then the LD process runs into LD errors ld: symbol(s) not found for architecture i386 and ld: symbol(s) not found for architecture x86_64

any ideas?

hang on changing languages

There is a hang sometimes when changing languages. The last line printed in the console is:
Localizing for xx
then it just hangs. I also find since upgrading to Xcode 5 the app also occasionally crashes, where as I had no issues on previous versions of Xcode.

I would also like to request we have a variable for original language as halting and restarting the process results in the wrong language being restored. Obviously resetting the simulator works too.

Fix close simulator and add reset simulator

I worked with that amazing script and recognized two things:

The close sim function does not work:
Simulator application name is "iOS Simulator", not "iPhone Simulator"
function _close_sim {

I know, I know. It says "iPhone Simulator". For some reason,

that's the only way Applescript can identify it.

osascript -e "tell application "iOS Simulator" to quit"
}

I had to delete the app from the simulator to get the new code version in UIAutomation so i reset all simulators before the "_xcode clean build" call by calling my "_reset_all_sim" function:
function _reset_all_sim {
instruments -s devices
| grep Simulator
| grep -o "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}"
| while read -r line ; do
echo "Reseting Simulator with UDID: $line"
xcrun simctl erase $line
done
}

Attention: If a simulator is running it will not be cleaned. I recommend to call "_close_sim" before "_reset_all_sim" to ensure all simulators are getting cleared.

Add support for multiple iOS versions

How about we add an array of iOS versions to the run_screenshooter.sh script?

We can access the version from UIA using UIATarget.localTarget().systemVersion() to the append to the screenshot filename.

This will require two changes:

  1. Adding the array of versions
  2. Invoking xcodebuild for each iOS version, as it seems that just changing the version of the simulator does not work.

There are two drawbacks to adding this:

  1. You won't be able to test different iOS/Device pairs on the same run, meaning that if you are only interested in iPhone Retina 7.0 and iPad Retina 6.0, you will end up with iPhone Retina 6.0/7.0 and iPad Retina 6.0/7.0

  2. There will be no tests for invalid pairs (i.e, it's not possible to launch iOS 5 on an iPhone Retina - the script will fail).

I can work on this after cleaning up the Xcode 5 stuff.

What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.