Giter Site home page Giter Site logo

snapshot's People

Contributors

adamcohenrose avatar aquarius avatar ashton-w avatar bartoszj avatar chrisamanse avatar confusedvorlon avatar craigsiemens avatar doppelganger9 avatar feralbob avatar ffittschen avatar fizker avatar flogehring avatar jilouc avatar kiliankoe avatar koenpunt avatar krausefx avatar larryonoff avatar marcboquet avatar marcomiltenburg avatar mathcarignani avatar mfurtak avatar milch avatar neilkimmett avatar ohayon avatar onato avatar osemenovboyarka avatar powtac avatar radex avatar skywinder avatar vpolouchkine avatar

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snapshot's Issues

Support apps with WatchKit

snapshot works fine on an empty, new project. But on my "real" project using cocoapods, frameworks etc. my screenshot is alway black (the simulator pops up and stays black too).

What's wrong? How can I debug this issue?

#import "SnapshotHelper.js"

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();


target.delay(3)
captureLocalizedScreenshot("0-LandingScreen")

UI Testing

Hi,
i guess this is in the wrong place but i wanted to raise the question: Since snapshot can run UIAutomation scripts against multiple simulators, is there some component of Fastlane that will only run UI tests as a step?

Thanks
Maciej

Device specific automation script

UI that runs on iPad may be different with UI that runs on iPhone. (Universal App)
It means that the automation script should have to be specified per device.

or

Sanpfile should have to be passed as argument.

Clear simulator

Hi,

Is there a command to clear the simulator (like reset contents and settings) before running the snapshots?

This is because I have a login screen and after the login it would show the main screen and my UI Automation script also included filling in the credentials in the login screen.
And when I run the snapshot command for the second time, it would start with the main screen and the snapshot script will fail.

Would be great if that is possible.. :)

Thanks!

Command fails when multiple projects in path

My project file is located in a path together with 8 other project fails. This currently leads to an error because snapshot looks for schemes in this path via xcodebuild -list. This command fails when there are multiple project files in the path:

xcodebuild: error: The directory ... contains 9 projects, including multiple projects with the current extension (.xcodeproj). Specify the project to use with the -project option.

/usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/lib/snapshot/snapshot_config.rb:149:in `rescue in scheme': Could not fetch available schemes: undefined method `split' for nil:NilClass (RuntimeError)
from /usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/lib/snapshot/snapshot_config.rb:119:in `scheme'
from /usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/lib/snapshot/builder.rb:57:in `generate_build_command'
from /usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/lib/snapshot/builder.rb:20:in `build_app'
from /usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/lib/snapshot/runner.rb:14:in `work'
from /usr/local/lib/ruby/gems/2.2.0/gems/snapshot-0.3.3/bin/snapshot:38:in `block (2 levels) in <top (required)>'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/import.rb:10:in `block in <top (required)>'

Wrong Simulator

It always can only open the last simulator that I was using in xcode. It times out for all the other ones.

New build of app not being copied to simulator

Hi,

I just made some changes to one of my screens to load some dummy data, when I run snapshot it seems to be building correctly but the changes are not being to the simulator. If I delete the app in the simulator its correctly installed, but if I just run snapshot it doesn't seem to push the new app.

Have you seen anything like this? Any suggestion? Logging?

Murray

Is it possible to stop cleaning project to avoid long rebuild process?

It takes about 20s to build my app. I am not much into digging build command and fixing Snapfile each time, so I think it would be nice to have a --no-clean flag to avoid rebuilding app each time I need to re-run a snapshot if automation script broke in the middle of process. And you know the process itself is quite long itself. What do you think?

Add command line argument to disable alpha removal

It is a convenient feature when generating screenshots for app submission, but it is not needed when creating them for UI testing. At the moment I am always Ctrl+C'ing after the last screenshot is made...

Remove supported language restrictions

I am using snapshot as a runner for UI tests. Test suite takes screenshots at every step and we then inspect them manually.

The problem I am having is that we support Arabic, but it is not in the language list. I have added it manually to languages.rb and it seems to be working fine. What was the initial idea about that list? Does it contain only those languages that iTunes Connect supports?

I think it would be better to remove that check altogether, then it would be possible to use any language supported by iOS.

Support for 8.2 Simulator?

What about support for the 8.2 Simulator?

error: Device 'iPhone 6 (8.1 Simulator)' not found. Available device types: ["Resizable iPad (8.2 Simulator)", "Resizable iPhone (8.2 Simulator)", "iPad 2 (8.2 Simulator)", "iPad Air (8.2 Simulator)", "iPad Retina (8.2 Simulator)", "iPhone 4s (8.2 Simulator)", "iPhone 5 (8.2 Simulator)", "iPhone 5s (8.2 Simulator)", "iPhone 6 (8.2 Simulator)", "iPhone 6 Plus (8.2 Simulator)"]. Use --trace to view backtrace

Found 0 simulators

Hi,
At first thanks for your work, I just discovered your other projects and wow, that'll definitely save me a lot of time as an iOS developer!

I followed your instructions and end up to the following error message :

DEBUG [2014-11-28 14:21:00.91]: Found 0 simulators.
FATAL [2014-11-28 14:21:00.91]: #############################################################
FATAL [2014-11-28 14:21:00.91]: # You have to add new simulators using Xcode
FATAL [2014-11-28 14:21:00.91]: # Xcode => Window => Devices
FATAL [2014-11-28 14:21:00.91]: #############################################################

Here is the backtrace :

/Library/Ruby/Gems/2.0.0/gems/snapshot-0.3.2/lib/snapshot/dependency_checker.rb:28:in `check_simulators': Create the new simulators and run this script again (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.3.2/lib/snapshot/dependency_checker.rb:5:in `check_dependencies'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.3.2/lib/snapshot/runner.rb:8:in `initialize'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.3.2/bin/snapshot:37:in `new'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.3.2/bin/snapshot:37:in `block (2 levels) in <top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/import.rb:10:in `block in <top (required)>'

Any help would be appreciated (ot the hundred of screenshot pain will kill me ;))

Ruby version :

$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

Here are my simulators

capture d ecran 2014-11-28 a 14 25 21

JS script kicks in too late

I have a splash screen that I would like to take capture. I show splash for about 2 seconds after app launched, but turns out it's not enough for JS script to kick in.

My script starts like that:

#import "SnapshotHelper.js"

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();

// Splash screenshot
captureLocalizedScreenshot("0-Splash", true);
target.delay(1);

and modified capture function:

function captureLocalizedScreenshot(name, immediately) {
  if (immediately !== true) {
    wait_for_loading_indicator_to_be_finished();
  } else {
    UIALogger.logMessage('Take screenshot immediately.');
  }
// ...
}

The splash is always captured somewhat in between transition to next controller. Is there anything I can about that on configuration level?

Generate screenshot thumbnails for html file

The project I am using snapshot for at the moment supports 13 languages. Even taking only 10 screenshots for each language produces around 150mb worth of screenshots.
Safari seems to be having trouble when displaying the generated html file. It is still usable, but barely. Not sure what will happen when I will add the new iPhones and the iPad to the list of devices though...

US-ASCII (ArgumentError)

Hi,

Do I need to open the simulator before I run "snapshot" or will snapshot open the simulator itself?

I have an error when I run it

/Library/Ruby/Gems/2.0.0/gems/snapshot-0.2.4/lib/snapshot/snapshot_file.rb:86:in `split': invalid byte sequence in US-ASCII (ArgumentError)

I am trying with the Example project and I have the same issue. I tried with opening the simulator but without success..

Wouter

No support for iPad?

Hello,

First of all thanks a lot for creating this, I'm still experimenting with it, but I feel like it will save me countless hours.

It seems that the current code does not support iPad devices... is that true? Are there plans to include it? I'm looking to the code and trying to figure it out. Unfortunately I have no experience with Ruby and I'm a bit lost... if I make it work with the iPad simulators I'll submit a Pull Request. Meanwhile I wanted to open this issue as an Enhancement request.

Thanks once again for this great work!
Fidel.

Error on "Run custom shell script 'Embed Pods Frameworks"

My project use Cocoapods, and when I use snapshot (integrated with fastlane) it failed on this script.

Run custom shell script 'Embed Pods Frameworks' (37 ms)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PhaseScriptExecution Embed\ Pods\ Frameworks /tmp/snapshot/PanNews.build/Debug-iphonesimulator/PanNews.build/Script-1B2064DEBC14EF88AE127F22.sh

    cd /Users/sarunw/Desktop/oozou/show_and_tell/PanNews

    /bin/sh -c /tmp/snapshot/PanNews.build/Debug-iphonesimulator/PanNews.build/Script-1B2064DEBC14EF88AE127F22.sh



mkdir -p /tmp/snapshot/build/PanNews.app/Frameworks

rsync -av --filter - CVS/ --filter - .svn/ --filter - .git/ --filter - .hg/ --filter - Headers/ --filter - PrivateHeaders/ /tmp/snapshot/build/Pods-PanNews/Alamofire.framework /tmp/snapshot/build/PanNews.app/Frameworks

building file list ... rsync: link_stat "/tmp/snapshot/build/Pods-PanNews/Alamofire.framework" failed: No such file or directory (2)

done



sent 29 bytes  received 20 bytes  98.00 bytes/sec

total size is 0  speedup is 0.00

rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-45/rsync/main.c(992) [sender=2.6.9]

Command /bin/sh failed with exit code 23

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

      1 errored, 1 warning (2887 ms)







Failures:



  0) Run custom shell script 'Embed Pods Frameworks'

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PhaseScriptExecution Embed\ Pods\ Frameworks /tmp/snapshot/PanNews.build/Debug-iphonesimulator/PanNews.build/Script-1B2064DEBC14EF88AE127F22.sh

    cd /Users/sarunw/Desktop/oozou/show_and_tell/PanNews

    /bin/sh -c /tmp/snapshot/PanNews.build/Debug-iphonesimulator/PanNews.build/Script-1B2064DEBC14EF88AE127F22.sh



mkdir -p /tmp/snapshot/build/PanNews.app/Frameworks

rsync -av --filter - CVS/ --filter - .svn/ --filter - .git/ --filter - .hg/ --filter - Headers/ --filter - PrivateHeaders/ /tmp/snapshot/build/Pods-PanNews/Alamofire.framework /tmp/snapshot/build/PanNews.app/Frameworks

building file list ... rsync: link_stat "/tmp/snapshot/build/Pods-PanNews/Alamofire.framework" failed: No such file or directory (2)

done



sent 29 bytes  received 20 bytes  98.00 bytes/sec

total size is 0  speedup is 0.00

rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-45/rsync/main.c(992) [sender=2.6.9]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━



** BUILD FAILED ** (39001 ms)

INFO [2015-02-02 18:02:47.45]: Variable Dump:
INFO [2015-02-02 18:02:47.45]: {:LANE_NAME=>:inhouse, :BUILD_NUMBER=>"3\n"}
** BUILD FAILED ** (39001 ms)]: 

FATAL [2015-02-02 18:02:47.45]: fastlane finished with errors
/Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/ (RuntimeError) ** (39001 ms)rse_build_line': 
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/builder.rb:30:in `block (2 levels) in build_app'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/builder.rb:27:in `each'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/builder.rb:27:in `block in build_app'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/builder.rb:26:in `spawn'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/builder.rb:26:in `build_app'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/snapshot-0.4.7/lib/snapshot/runner.rb:10:in `work'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/actions/snapshot.rb:22:in `block in run'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/actions/snapshot.rb:20:in `chdir'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/actions/snapshot.rb:20:in `run'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/fast_file.rb:81:in `block (2 levels) in method_missing'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/actions/actions_helper.rb:28:in `execute_action'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/fast_file.rb:80:in `block in method_missing'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/fast_file.rb:79:in `chdir'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/fast_file.rb:79:in `method_missing'
    from (eval):48:in `block (2 levels) in parse'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/runner.rb:17:in `call'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/runner.rb:17:in `block in execute'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/runner.rb:11:in `chdir'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/runner.rb:11:in `execute'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/lane_manager.rb:15:in `block in cruise_lanes'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/lane_manager.rb:14:in `each'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/lib/fastlane/lane_manager.rb:14:in `cruise_lanes'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/bin/fastlane:31:in `block (2 levels) in run'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/bin/fastlane:59:in `run'
    from /Users/sarunw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fastlane-0.1.6/bin/fastlane:63:in `<top (required)>'
    from /Users/sarunw/.rbenv/versions/2.1.2/bin/fastlane:23:in `load'
    from /Users/sarunw/.rbenv/versions/2.1.2/bin/fastlane:23:in `<main>'

"Instruments tool failed again" for iPhone 6 Plus

When I run snapshot, it always fails when it gets to the iPhone 6 Plus simulator. I can see my app starting over and over again in the simulator, with the error message "Instruments tool failed again. Re-trying..." in the console. The app only starts for a split second, then immediately closes and restarts again.

All other devices (iPhone 6, 5s, 4s, iPad Air) do work fine, it's only this one that doesn't work. Tried on 2 computers, and it fails on both.

No idea how to proceed.

  1. Copy the generated code into ./snapshot.js in Quick Start
    What is the code? Didn't find it. After run snapshot init, below default shows up in snapshot.js
#import "SnapshotHelper.js"
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
target.delay(3)
captureLocalizedScreenshot("0-LandingScreen")
target.frontMostApp().tabBar().buttons()[1].tap();
target.delay(1)
captureLocalizedScreenshot("1-SecondScreen")
  1. localisation doesn't work correctly.
    Using Localizable.strings files, including English / Japanese languages, English is fine. But when Japanese, it show some of titles/labels are Japanese, others are still English.
  2. Is only the first screen captured?
    How to capture arbitrary screen, like the 1st, 3rd, which I could appoint.
  3. lots of errors.
    When finished, lots of below errors.
    ERROR [2015-01-26 17:01:11.62]: UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from targ - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().bu - UIAutomation Error: Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().tabBar().buttons()[1] on line 11 of snapshot.js ERROR [2015-01-26 17:01:11.62]: ----------------------------------------------------------- error: Finished generating 8 screenshots with 8 errors.. Use --trace to view backtrace

Rotate Landscape Screenshots

If one rotates the device to landscape, the screenshot is not automatically rotated. It would be nice if snapshot detected and rotated it. This is something that ui-screen-shooter does already.

To test, rotate device in the automation script via:

UIATarget.localTarget().setDeviceOrientation(UIA_DEVICE_ORIENTATION_LANDSCAPELEFT);

This could be implemented in the same way that ui-screen-shooter does it by running this command just prior to copying to the output screenshots directory:

find $trace_results_dir/Run\ 1/ -name _landscape_png -type f -exec sips -r -90 {} ;

pass also regional settings at building

Currently snapshot passes the language at building. This provides screenshots in different languages, which is one of the top benefits of snapshot. When the app displays fields like date, time and amount, it would be appropriate to set also the corresponding region. Otherwise you will receive screenshots with german texts and dates in US date format or vice versa, for example. Thanks.

wrong png format

When uploading files in iTunesConnect i receive this error:

Images can’t contain alpha channels or transparencies.

Some javascript commands will block (iPad - modalViews)

Hi,

if i run this script in UIAuomation

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();


target.delay(3)
var iconsCollView = window.collectionViews()[0];
iconsCollView.cells()[0].tap();

it will run perfectly
but if run this with the snapshot.js it won't make this part

#import "SnapshotHelper.js"

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();


target.delay(3)
captureLocalizedScreenshot("0-LandingScreen")
var iconsCollView = window.collectionViews()[0];
iconsCollView.cells()[0].tap();

and so in my opinion is snapshot this action blocking but don't know why.

This is only an issue with the iPad in connection to Modal Views

UIAutomation Error: The operation couldn’t be completed. (com.apple.instruments error -6.)")

Hi Felix,

thanks a lot for your great work on snapshot! It's quite a handy πŸ‘

Running snapshot --trace with Xcode 6.1 / iOS 8.1 / OSX 10.10.1 gives me the following error message:

INFO [2014-11-16 13:57:00.26]: BUILD SUCCEEDED
INFO [2014-11-16 13:57:00.26]: Running tests on iPhone 6 (8.1 Simulator) in language en-US
ERROR [2014-11-16 13:57:00.87]: Instruments Trace Error : Failed to load template 'Automation/ -- file:///Users/redacted/' (Error Domain=com.apple.instruments Code=-6 "Document Missing Template Error: The operation couldn’t be completed. (com.apple.instruments error -6.)")

ERROR [2014-11-16 13:57:00.87]: UIAutomation Error: The operation couldn’t be completed. (com.apple.instruments error -6.)")
INFO [2014-11-16 13:57:00.89]: Successfully created HTML file with all the screenshots: ./screenshots/screenshots.html
ERROR [2014-11-16 13:57:00.89]: -----------------------------------------------------------
ERROR [2014-11-16 13:57:00.89]: UIAutomation Error: The operation couldn’t be completed. (com.apple.instruments error -6.)")
ERROR [2014-11-16 13:57:00.89]: -----------------------------------------------------------
/Library/Ruby/Gems/2.0.0/gems/snapshot-0.2.4/lib/snapshot/runner.rb:37:in `work': Finished generating 0 screenshots with 1 errors. (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.2.4/bin/snapshot:33:in `block (2 levels) in <top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/import.rb:10:in `block in <top (required)>'

I traced it back to:

Runner.rb

def generate_test_command(device, language, app_path)
      script_path = SnapshotConfig.shared_instance.js_file

      [
        "instruments",
        "-w '#{device}'",
        "-D '#{TRACE_DIR}/trace'",
        "-t 'Automation'",
        "'#{app_path}'",
        "-e UIARESULTSPATH '#{TRACE_DIR}'",
        "-e UIASCRIPT '#{script_path}'",
        "-AppleLanguages '(#{language})'",
        "-AppleLocale '#{language}'" 
      ].join(' ')

I suspect -t 'Automation' to be deprecated, shouldn't this be

instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate [... other params ...]

?

Thanks!
Robert

Evolution: give the Snapfile as parameter

Hello,

This time it's more some kind of evolution, I would appreciate the possibility of giving the Snapfile as a parameter. In fact, when your script is different, for instance, for iPad and iPhone, it would be great if we could put:

snapshot Snapfile_iPhone
snapshot Snapfile_iPad

Well, if you think it's a good idea!

Multiple schemes

Hi,
as developer in a large product I would need to be able to take screenshot in several schemes automatically.

I calculated that to take 5 screenshot in 6 different schemes for 10 different languages and 5 different devices, I need to leave it working 12.5 hours over night (and 1500 screenshots).

It is strongly needed something to call snapshot on the next scheme.

Thanks.

NoMethodError in v.0.4.7

Hello Felix,

I've just installed v.0.4.7 and on the iPad, I have a NoMethodError, here is the stack trace :

killall 'iOS Simulator'
xcrun simctl boot 'FA2D154E-24CE-4E0C-B7DE-59C1F13011D8'
xcrun simctl uninstall booted 'XXXXXXXXXX'
xcrun simctl install booted '/tmp/snapshot/build/XXXXXX.app'
xcrun simctl shutdown booted
INFO [2015-02-03 14:41:19.01]: Running tests on iPad Air (8.1 Simulator) in language fr-FR
DEBUG [2015-02-03 14:41:19.01]: instruments -w 'iPad Air (8.1 Simulator)' -D '/tmp/snapshot_traces/trace' -t 'Automation' '/tmp/snapshot/build/XXXXXX.app' -e UIARESULTSPATH '/tmp/snapshot_traces' -e UIASCRIPT '/Users/XXXXXXXXXXXXX/Documents/XXXXXXXXXXXXXXX/snapshots/snapshot.js' -AppleLanguages '(fr-FR)' -AppleLocale 'fr-FR'
INFO [2015-02-03 14:41:29.20]: Successfully took screenshot πŸ“±
INFO [2015-02-03 14:41:32.35]: Successfully took screenshot πŸ“±
INFO [2015-02-03 14:41:32.87]: Going to remove the alpha channel from generated png files
INFO [2015-02-03 14:41:32.87]: Removing alpha channel from '/tmp/snapshot_traces//Run 1/fr-FR-iOS-iPad-0-Home-portrait.png'
INFO [2015-02-03 14:41:33.16]: Removing alpha channel from '/tmp/snapshot_traces//Run 1/fr-FR-iOS-iPad-1-Home-landscaperight.png'
INFO [2015-02-03 14:41:33.46]: Finished removing the alpha channel.
DEBUG [2015-02-03 14:41:33.46]: Going to rotate screenshots from generated png files
DEBUG [2015-02-03 14:41:33.46]: Rotating '/tmp/snapshot_traces//Run 1/fr-FR-iOS-iPad-0-Home-portrait.png'
DEBUG [2015-02-03 14:41:33.46]: Rotating '/tmp/snapshot_traces//Run 1/fr-FR-iOS-iPad-1-Home-landscaperight.png'
(erb):48:in `block (3 levels) in generate': undefined method `[]' for nil:NilClass (NoMethodError)
    from (erb):40:in `each'
    from (erb):40:in `block (2 levels) in generate'
    from (erb):33:in `each'
    from (erb):33:in `block in generate'
    from (erb):29:in `each'
    from (erb):29:in `generate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/erb.rb:849:in `eval'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/erb.rb:849:in `result'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/lib/snapshot/reports_generator.rb:31:in `generate'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/lib/snapshot/runner.rb:37:in `work'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/bin/snapshot:38:in `block (3 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/bin/snapshot:36:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/bin/snapshot:36:in `block (2 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/runner.rb:81:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/bin/snapshot:55:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/snapshot-0.4.7/bin/snapshot:59:in `<top (required)>'
    from /usr/bin/snapshot:23:in `load'
    from /usr/bin/snapshot:23:in `<main>'

Latest Apple Screenshot Guidelines Require No Status Bar

In your readme, you recommend SimulatorStatusMagic to make the status bar look good.

However, the latest apple guidelines on submitting screenshots require that the status bar not be in the screenshot.

See: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Appendices/Properties.html

Where it's clearly stated:
"Don’t include the device status bar in your screenshots."

Minimally, you may want to mention that in your readme. If you're serious about using snapshot as a tool to automatically take and upload screenshots, incorporating something to trim the status bar from the image might be a good idea as well.

(As a note, I really admire the professionalism of snapshot, and was sad that I couldn't quite use it with a recent set of projects, due to the nature of the apps.)

some functions in snapshot.js won't call

Hi,

i don't know why but i have a weird problem.

Ich have a snapshot.js file like this:

#import "SnapshotHelper.js"

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
var navBar = window.navigationBar();
var allElements = navBar.elements();
var navBarButtons = navBar.buttons();

target.frontMostApp().mainWindow().logElementTree();

// Alert detected. Expressions for handling alerts should be moved into the UIATarget.onAlert function definition.
captureLocalizedScreenshot('-PAGE0');
window.buttons()[0].tap();

captureLocalizedScreenshot('-PAGE1');
window.buttons()[0].tap();

captureLocalizedScreenshot('-PAGE2');
window.buttons()[0].tap();

captureLocalizedScreenshot('-PAGE3');
window.buttons()[0].tap();

captureLocalizedScreenshot('-PAGE4');
window.buttons()[0].tap();

captureLocalizedScreenshot('-PAGE5');
window.buttons()[0].tap();

window.logElementTree();

and i don't get the element tree in terminal and if want get a callback for alert like

UIATarget.onAlert = function onAlert(alert) {
    var title = alert.name();

    // add a warning to the log for each alert encountered
    UIALogger.logWarning("Alert with title '" + title + "' encountered!");
    UIATarget.localTarget().captureScreenWithName("alert_" + (new Date()).UTC());

    // test if your script should handle the alert, and if so, return true

    // otherwise, return false to use the default handler
    return false;

it will never called. i don't know why. Have u guys some ideas :) ?

Thx for helping

Generated html file doesn't generate relative urls

This is my Snapfile

screenshots_path "./screenshots"
js_file './screenshots/snapshot.js'
html_path './screenshots/screenshots.html'

The generated file now has links like these: ./screenshots/en-US/en-US-iOS-iPad-portrait-0-LandingScreen.png, which is incorrect, it should be ./en-US/en-US-iOS-iPad-portrait-0-LandingScreen.png

It seems it only works if the html file is in the root project folder. What I want is only a Snapfile in the root, and everything else in a subfolder called "screenshots".

"Instruments Trace Error : Target failed to run" not trying to retry

It looks like this is supposed to be handled gracefully, but this doesn't seem to work for me. Here is the error:

INFO [2014-11-21 22:39:26.51]: Running tests on iPhone 4s (8.1 Simulator) in language en-US
ERROR [2014-11-21 22:39:29.44]: Waiting for device to boot...
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier 'com.example.app'

ERROR [2014-11-21 22:39:29.44]: invalid byte sequence in US-ASCII

Today Extension Targets not Launched

I am unsure if this is an instruments or snapshot issue, but reporting it here.

I'm trying to automate today-extension creation too. If you pick a today extension target in snapshot (regardless of if you're using xctool or the fallback), the app containing the widget instead of the widget is launched.

A demo project can be downloaded here: http://subzero.eu/wp-content/uploads/2014/11/Widget-Snapshot-Test.zip

Replication:

  1. extract the project
  2. launch snapshot
  3. pick the widget target

Expected results:
The widget launches, allowing snapshot to take a picture

Actual results:
The containing app launches.

PNG Transparent layer

Hello (for the last time today, I hope),

When I submitted my screenshots to Apple yesterday, they have been rejected because they contained a transparent layer. I've corrected that with a quick and dirty ImageMagick script, but would it be possible to save the screenshot PNGs directly without the alpha layer?

Thanks in advance,
M.

PS : If you cannot save without alpha, I could give you the script for you to propose it in your tool.

Enable logging

Is it possible to pass UIALogger messages thru to console?

callback method won't call

Hi

i have a snapfile which looks like that:
devices([
"iPhone 6",
"iPhone 6 Plus",
])

languages([
'de-DE'
])
screenshots_path "./screenshots"

scheme 'Test'

project_path './Test.xcworkspace'

teardown_device do |device|
puts "Cleaning device #{device}"
system('./cleanup.sh')
end

And the teardown_device method will not called. But i don't know why.
The Script cleanup.sh works fine if i run it separate.

Thx for your help

Language Code list accuracy

In the main readme, the section titled "Available language codes" has the following list:

["da-DK", "de-DE", "el-GR", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi-FI", "fr-CA", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nl-NL", "no-NO", "pt-BR", "pt-PT", "ru-RU", "sv-SE", "th-TH", "tr-TR", "vi-VI", "cmn-Hans", "zh_CN", "cmn-Hant"]

Can you explain where this list came from? It seems to include codes that aren't officially supported and omit some that are.

I believe the "no-NO" entry should be 'nb' because 'nb' is the supported iOS code for Norwegian Bokmal. Also, traditional and simplified Chinese should be 'zh-Hant' and 'zh-Hans'. I'm not sure why "cmn-Hans", "zh_CN", and "cmn-Hant" are in the list.

Reference: https://www.ibabbleon.com/iOS-Language-Codes-ISO-639.html

Issue while updating to snapshot 0.3.2

When I execute:
gem update snapshot

I get the following:
Updating installed gems
Updating snapshot
ERROR: While executing gem ... (Gem::SpecificGemNotFoundException)
Could not find a valid gem 'snapshot' (= 0.3.2) locally or in a repository

How to capture Launch Screen

Noticed that LaunchScreen.xib localised too in the demo, but not captured. How to make it?
Tried to find and record in Instruments, but had no idea to do it.

Populating Database

Hi,

In your demo you use the example of populating the database, if you did run a script to pollute the database then I guess you would need to know the path of the .app?

I am trying to work out how I can preload a workout database onto the simulator app so I have some data for the screenshots.

Thanks

setup_for_language_change do |lang, device|
puts "Running #{lang} on #{device}"
system("./popuplateDatabase.sh")
end

Feature Request: Setup and Teardown Methods

Wouldn't it be great to have setup and tearDown -methods which run in between language and device changes ?

Usecase(s)

  1. Clean iossimulator before each run to have a clean state
  2. Populate databases and / or user profiles
  3. ...

Additions to Snapfile:

# Shell command ran **before** device change
setup_device_change './setup_device.sh'

# Shell command ran **after** device change 
teardown_device_change './teardown_device.sh'

# Shell command ran **before** language change
setup_language_change './setup_language.sh'

# Shell command ran **after** language change 
teardown_language_change './teardown_language.sh'

Additions to Runner.rb

SnapshotConfig.shared_instance.devices.each do |device|
       # Run device specific setup methods
        SnapshotConfig.shared_instance.languages.each do |language|
          # Run device specific setup methods

          ...
          end
        end
      end

What do you think?

Arguments which is defined in Scheme is not passing

I really impressed what you'v done.

However, I found 1 small problem.

I usually define a -demo arguments to generate sample data to take screenshot.
And I made a scheme for take screenshot, and this scheme contains -demo argument.

snapshot seems to uses scheme to build purpose only. When launchesInstrument, the arguments that belongs to scheme are not used.
So launched app(mine) did not populate demo content.

The run destination iPad 2 is not valid for Running the scheme

Trying out snapshot for the first time. Did snapshot init and am simply trying to run snapshot with the default config.

Devices:

devices([
  "iPhone 6",
  "iPhone 6 Plus",
  "iPhone 5",
  "iPhone 4s",
  "iPad Air"
])

When I run snapshot, I get this error:

  xcodebuild clean sling
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Failed to build workspace sling with scheme sling.
    Reason: The run destination iPad 2 is not valid for Running the scheme 'sling'.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Any idea what this could be? It is an iOS 8 only app, is it trying to use the iOS 7 simulator or something?

Specifying screenshots output folder and html don't line up.

Hey - I've been playing with this tool and am impressed... Thanks!

I'm building a Cordova hybrid application and as such tweaked the output folders/locations a little as I don't want to muddy up the root of the project with iOS specific stuff.

With the following configuration in my Snapfile file:

screenshots_path "./screenshots/ios"
html_path './screenshots/ios.html'

It's not generating the html links correctly. With the above configuration I get the following links in html.

<a href="./screenshots/ios/en-US/en-US-iOS-iPad-portrait-0-LandingScreen.png" target="_blank">
  <img class="screenshot" 
         src="./screenshots/ios/en-US/en-US-iOS-iPad-portrait-0-LandingScreen.png",
       style="width: 180px;" />
</a>

Looks like it would need to be a little smarter lining up the location of the html file and the output folder...

Thoughts?

Landscape naming

Hello (again),

When the app runs in landscape the naming of the snapshot of captureLocalizedScreenshot(). Morevover, the rect.size.height is a float and sometimes the test ==667 does not work. To fix both problems, here what I've done :

var theSize = (rect.size.width > rect.size.height)?rect.size.width.toFixed():rect.size.height.toFixed();

if (model.match(/iPhone/))
{
if (theSize > 667) {
model = "iPhone6Plus";
} else if (theSize == 667) {
model = "iPhone6";
} else if (theSize == 568){
model = "iPhone5";
} else {
model = "iPhone4";
}
}
else
{
model = "iOS-iPad";
}

Well thanks again for this tool.

alpha removal seems not work

at the end, log says Could not remove transparency of generated screenhots.. But didn't use skip_alpha_removal.

Why?

command line parameters

Can you add the some parameters to command line to:

1 - define output directory
2 - define schema name

Impossible to take snapshots in iOS 7.1

Hello Felix,

I've made a snapfile for taking iOS 7.1 snapshots, and I've specified:
ios_version '7.1'

I've run it only on compatible devices (iPhone 5s, iPhone 4s and iPad Air) but the script keeps launching the Simulator in iOS 8.1.

I use Xcode 6.1.1, do you know if this is a bug or a problem on my configuration?

Here is my snapfile for more information:

# Uncomment the lines below you want to change by removing the # in the beginning

# A list of devices you want to take the screenshots from
devices([
  "iPhone 5s",
  "iPhone 4s",
  "iPad Air"
])

languages([
  'fr-FR'
])

# Where should the resulting screenshots be stored?
screenshots_path "./screenshots_iOS7"

# JavaScript UIAutomation file
js_file './snapshot.js'

# The name of the project's scheme
scheme 'Patient'

# Where is your project (or workspace)? Provide the full path here
project_path '../Patient/Patient.xcodeproj'

# By default, the latest version should be used automatically. If you want to change it, do it here
ios_version '7.1'

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.