Giter Club home page Giter Club logo

bwoken's People

Contributors

alecgorge avatar bendyworks-admin avatar jaym3s avatar listrophy avatar mrdavidgagnon avatar ryanamos avatar ryanjm avatar wbyoung 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

bwoken's Issues

Tests not relaunching

Similar to issue #4....after first execution of tests (tests execute fine), when trying to relaunch tests, tests do not execute. The first run of test complete fine, but second just displays prompt of executing tests but no tests are run. I have to restart machine to fix issue.

I am using:
bwoken 1.1.0
ruby 1.9.3 (using rvm)
Xcode 4.3.3 (with command line tools installed)
Mac OS X 10.7.4

where to find result of logElementTree?

This is a question. I have searched over these docs, issues, Apple docs, StackOverflow, blogs… Am not finding an answer.

When a test calls, UIAElement.logElementTree(), where does the output go? I have found png files in the results directory, but not any log output. My console log shows:

Debug:  keyboard.typeString("[email protected]")
logElementTree: 
Debug:  tap scrollViews[0].secureTextFields[0]

Running with ruby 2.1.0, Gemfiles:

  specs:
    bwoken (2.0.0)
      coffee-script-source
      colorful
      execjs
      json_pure
      rake
      slop
    coffee-script-source (1.6.3)
    colorful (0.0.3)
    execjs (2.0.2)
    json_pure (1.8.1)
    rake (10.1.1)
    slop (3.4.7)

blocked on ** BUILD SUCCEEDED **

bwoken v2.0.0.beta.3

I followed the instructions, and put my tests on the dir "integration/javascript/ipad", on an existing project.

Then I run sudo bwoken test --verbose
(without sudo I have an error while cleaning about removing a .bundle file)

And it builds succesfully (the last thing that I see on the command line is "** BUILD SUCCEEDED **").
The simulator launches, goes to landscape (like if it is launching the app), and the app gets immediately closed, returning to the springboard �(it doesn't show the splascreen or anything else).

Does someone know how to solve the problem?.

What I tried:

  • Restarted mac (since I read in other issues that sometime it is the only solution)
  • Checked that the build files are really created
  • Used some params like --scheme and --product-name with the right values, but nothing changed.

Test Script Failed with (null)

Not sure what happened here, when I run rake iphone --trace, simulator didn't run and I got this

** Invoke iphone (first_time)
** Invoke iphone:test (first_time)
** Invoke integration/tmp/results (first_time, not_needed)
** Invoke coffeescript (first_time)
** Invoke integration/tmp/javascript/iphone/example.js (first_time, not_needed)
** Invoke integration/tmp/javascript/iphone (first_time, not_needed)
** Invoke integration/coffeescript/iphone/example.coffee (first_time, not_needed)
** Invoke integration/coffeescript/iphone (first_time, not_needed)
** Invoke integration/tmp/javascript/example_js.js (first_time, not_needed)
** Invoke integration/tmp/javascript (first_time, not_needed)
** Invoke integration/javascript/example_js.js (first_time, not_needed)
** Invoke integration/javascript (first_time, not_needed)
** Execute coffeescript
** Execute iphone:test

iphone  example.js
:   (null)
rake aborted!
Test Script Failed
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/script.rb:88:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/script.rb:32:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/script.rb:20:in `block in run_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/script.rb:19:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/script.rb:19:in `run_all'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/bwoken-1.3.0/lib/bwoken/tasks/bwoken.rake:82:in `block (3 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'

OSX 10.8.4
Xcode 4.6.3 (4H1503)

Help, please....

Failed test causes remainder of tests to not run

Steps to repro:

  1. Run bwoken with multiple .js test files. One of those test files must fail.
    Observed:
    When the failing test runs, the test run stops and the remainder of tests are not run.

When running multiple tests, if one test fails the test run stops. In practical terms, that means if one component turns buggy, tests for non-buggy components will never run (and we'll never know for sure that they're non-buggy).

It could be argued that it is preferred that as many tests are run as possible. One failing test should not stop the run. Log the failure and move on.

Perhaps it's just a difference in philosophy between me and the bwoken authors. For now I've modified script.rb so that the run method does not raise if a test fails.

Additional Install Instructions needed

Darn. I was so close to getting my xcode project up and runnign with travis ci, but recently when I work my way through the new (non rake based) install instructions, I get stuck at:

$ bwoken init
-bash: bwoken: command not found

Do I have to do something to enable bwoken as a shell command in OSX?

1/3 of all tests randomly fail

Hey!

First, thanks for this great wrapper for UIAutomation. The setup is really straight forward and it's easy to get going.

I've setup a really simple sample application with two buttons and a small 1.5 second animation at startup - all I test for is to see that both buttons are actually available in the view.

This simple test case fails about 1/3 of all test runs.

See my attached test case:

#import "../../../../tuneup/tuneup.js"

test "Initial screen has two buttons", (target, app) ->
  target.delay(2) # wait until animation is over
  window = app.mainWindow()
  assertNotNull window.elements()["buttonA"], "buttonA is missing"
  assertNotNull window.elements()["buttonB"], "buttonB is missing"

Any ideas on why that is?

I've checked for common errors:

  • the accessibilityLabel is set correctly
  • the tests fail even if the animation at startup is disabled
  • adding / removing delays doesn't change the problem

Add universal folder?

My UIAutomation tests, are able to run both on iPhone and iPad (I use tuneup js that adds target.isDeviceiPhone() and target.isDeviceiPad() to make them universal).

Would be really cool to have a "universal" directory where we put tests meant to be run both on iPhone and iPad.

The only option right now seems to be copying the files in both folders iphone and ipad, but I don't like it at all.

I also tried to make a folder alias inside iphone\ipad pointing to a folder where I have the tests, but it is ignored by bwoken.

If someone can point me in the right direction I could try to implement this feature, also if I'm not experienced with Ruby :-)

Does Bwoken play well with CocoaPods?

I ask because my build fails on

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

This could be because bwoken wants to build my .xcodeproj instead of my .xcworkspace, or it could be something idiosyncratic to my machine. I'm not sure where to look for guidance on this sort of thing, or how much it is to do with bwoken itself.

Any good examples?

Hi, I installed Bwoken because it seems pretty cool and fits my needs.

Problem is that I'm not sure where to start. Do you guys have any examples?

Specifically, I'm looking for ones that uses CoffeeScript, and has classes and extends.

Xcworkspace vs Xcodeproj

Hey guys,
first of all thanks for this great tool!

I'm not using a workspace in my project, just have the xcodeproj file.
In your setup instructions you tell us to create a workspace, but bwoken works just fine without the xcworkspace file.

Can you tell me a little more about this, should i create a workspace anyway?
It would be easier for me to keep going with the xcodeproj file only...

Thanks in advance!

Path not found for simulator

When I try to use the simulator it does a pop up that says:

Path not found 'Users/ryanjm/code/myAppName/iphone/build/iphonesimulator/MyAppName.app'

Any ideas? With their being multiple iOS versions for the simulator can we pass additional preferences to --simulator?

Document Missing Template Error

trying to run my ios app test installation, I get the following error :

macMini:OAuthClientSetup yves$ bwoken init
macMini:OAuthClientSetup yves$ bwoken test
Building............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Build Successful!

iphone  example.js
:   Failed to load document 'file:///Users/yves/Developpement/iOS7/rails_clients/OAuthClientSetup/integration/tmp/trace.trace/' : (Error Domain=com.apple.instruments Code=-6 "Document Missing Template Error: The operation couldn’t be completed. (com.apple.instruments error -6.)")
/Users/yves/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bwoken-2.0.0/lib/bwoken/script.rb:55:in `block in run': Test Script Failed (Bwoken::ScriptFailedError)
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open3.rb:199:in `popen_run'
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open3.rb:93:in `popen3'
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bwoken-2.0.0/lib/bwoken/script.rb:53:in `run'
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bwoken-2.0.0/lib/bwoken/simulator_runner.rb:21:in `each'
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bwoken-2.0.0/lib/bwoken/simulator_runner.rb:21:in `execute'
    from /Users/yves/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bwoken-2.0.0/lib/bwoken/script_runner.rb:33:in `execute_for_family'

Run tests without debug info

Hey, is there a way how to run tests without debug info? So basically that there will be just info about which test is currently running and if it passed or not.

Thanks

Default options specified in .bwokenrc

In order to omit options at the command line that I always use (e.g., --simulator)
As a tester
I want to populate a .bwokenrc file with my default options, which would also get overridden when I specify conflicting options at the command line

Instruction don't explain where to put javascript test files

I finally got bwoken to run the included test script and now am trying to get my own script to work, but have to go through lots of trial and error to figure out where to put my files (just dropping them in the javascript folder does not seem to work)

Is bwoken supporting Xcode 4.4?

I got this error when running tests on device

Exception   encountered during 'setThrottleConstraints:' dispatch: (null)

and this error on simulator.

xcodebuild: error: 'sim' not found.
xcrun: error: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild failed with exit code 17664
1.339582  handled [c0]: < DTXMessage 0x7f9da36a8c60 : i1.0 c0 dispatch:[agentIsReady] >
1.340150  sending [c0]: < DTXMessage 0x7f9da36aa140 : i1.1 c0 >
1.349105  handled [c0]: < DTXMessage 0x7f9da36aa2f0 : i2.0 c0 dispatch:[updateScriptStatus:[1]] >
1.349543  sending [c0]: < DTXMessage 0x7f9da3763bf0 : i2.1 c0 >
1.351177  sending [c0]: < DTXMessage 0x7f9da36ab730 : i3.0 c0 dispatch:[startScriptWithInfo:< NSDictionary 0x7f9da36aca60 | 3 key/value pairs>] >
1.358965  handled [c0]: < DTXMessage 0x7f9da36ac800 : i3.1 c0 object:(NSNull*)[<null>] >
1.368855  handled [c0]: < DTXMessage 0x7f9da3440f10 : i4.0 c0 dispatch:[updateScriptStatus:[2]] >
1.369123  sending [c0]: < DTXMessage 0x7f9da374e780 : i4.1 c0 >
1.379418  handled [c0]: < DTXMessage 0x7f9da36a4ce0 : i5.0 c0 dispatch:[scriptDidThrowException:< NSDictionary 0x7f9da36ab810 | 3 key/value pairs>] >
1.379867  sending [c0]: < DTXMessage 0x7f9da36aad80 : i5.0 c0 dispatch:[stopScript] >
1.380970  handled [c0]: < DTXMessage 0x7f9da36ad1c0 : i6.0 c0 dispatch:[updateScriptStatus:[1]] >
1.389602  handled [c0]: < DTXMessage 0x7f9da3763bf0 : i5.1 c0 object:(NSNull*)[<null>] >
1.497598  handled [c0]: < DTXMessage : kDTXInterruptionMessage >
1.497767  handled [c0]: < DTXMessage : kDTXInterruptionMessage >

XCode 4.5 support

It seems like paths to /Developer and Instruments hardcoded somewhere in gem, so xcode-select switch cause build to fail.

Can you please add 4.5 support!

Simulator timing out when running from jenkins job

I am trying to have bwoken run during a jenkins job. the build completes successfully, and it starts the first test from the iPhone folder, but then the simulator times out. this is the command i'm using
cd /Users/Shared/Jenkins/Home/jobs/TestJob/workspace/src/folder
bwoken test --scheme 'folder\ -\ Folder'

after clicking ok on the simulator pop up the log shows this.

Building in workspace /Users/Shared/Jenkins/Home/jobs/TestJob/workspace
Fetching changes from the remote Git repository
Fetching upstream changes from https://github.com/project.git
Checking out Revision 5fb24f1a4b477047c05818d780f5d5365bf766f8 (origin/feature/bwoken-final)
[workspace] $ /bin/sh -xe /var/folders/9h/89ywpzvx2v7c37yy8hn49yq80000gn/T/hudson2637842362533209426.sh

  • cd /Users/Shared/Jenkins/Home/jobs/TestJob/workspace/src/elektra
  • bwoken test --scheme 'elektra\ -\ Dogfish'
    �[34mBuilding�
    �[32mBuild Successful!�[m
    �[36miphone CaptureView.js�[m
    /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script.rb:55:in run': Test Script Failed (Bwoken::ScriptFailedError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/open3.rb:86:inpopen3'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script.rb:53:in run' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1427:into_proc'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/simulator_runner.rb:21:in each' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/simulator_runner.rb:21:inexecute'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:33:in execute_for_family' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:28:inexecute_in_simulator'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:27:in each' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:27:inexecute_in_simulator'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:20:in execute' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli/test.rb:105:intest'
    from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli/test.rb:71:in run' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli.rb:56 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/bin/bwoken:3 from /usr/bin/bwoken:19:inload'
    from /usr/bin/bwoken:19
    �[36mRecording�[m cancelled : At least one target failed to launch; aborting run
    �[1;31m:�[m �[4;1mError Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7f8a35804a80 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}�[m
    �[1;31m:�[m �[4;1mFailed to start trace.�[m
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE

it is running correctly from terminal.

if you need more info just let me know

Failing to compile simple project

I am getting this error that I couldn't overcome. I followed the instructions, saved the project as a workspace with title.

'/.rvm/gems/ruby-1.9.3-p194@Auto/gems/bwoken-1.1.1/lib/bwoken/tasks/bwoken.rake:69:in `block in <top (required)>'

I pasted the error, .rvmrc and directory structure in the below image.

image

I am guessing the directory structure $(BWOKEN_CONFIGURATION_BUILD_DIR) is not being set correctly. Can I do this manually.

Let me know if you need further info.

How to properly use UIAutomation script through bwoken ?

Hi,

How can I properly run a basic UIAutomation script through bwoken ?

I filled ./integration/javascript/example_js.js with the test script and tried to run it through bwoken without success. It started but it did nothing.

$>rake
Building....................................................................................................................................
Build Successful!

iphone  example.js

Complete
 Duration: 3.169913s

I want to transform cucumber test script to UIAutomation test script and then run them through bwoken.

Is there some hooks on bwoken ?

Bellow is the file that I tried to use through bwoken. It's working with Apple example CoreDataBooks

// Generated by CoffeeScript 1.4.0
(function() {
  var AuthorScreen, BookTitleScreen, BooksScreen, NewBookScreen, Screen, Zucchini, app, extend, isNullElement, puts, raise, screensCount, target, view,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  Function.prototype.bind = function(context) {
    var fun;
    if (!context) {
      return this;
    }
    fun = this;
    return function() {
      return fun.apply(context, arguments);
    };
  };

  String.prototype.camelCase = function() {
    return this.replace(/([\-\ ][A-Za-z])/g, function($1) {
      return $1.toUpperCase().replace(/[\-\ ]/g, "");
    });
  };

  extend = function(obj, mixin) {
    var method, name;
    for (name in mixin) {
      method = mixin[name];
      obj[name] = method;
    }
    return obj;
  };

  puts = function(text) {
    return UIALogger.logMessage(text);
  };

  raise = function(message) {
    throw new Error(message);
  };

  UIATarget.onAlert = function(alert) {
    return true;
  };

  target = UIATarget.localTarget();

  app = target.frontMostApp();

  view = app.mainWindow();

  UIAElement.prototype.$ = function(name) {
    var el, elem, _i, _len, _ref;
    target.pushTimeout(0);
    elem = null;
    _ref = this.elements();
    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
      el = _ref[_i];
      elem = el.name() === name ? el : el.$(name);
      if (elem) {
        break;
      }
    }
    target.popTimeout();
    return elem;
  };

  target.waitForElement = function(element) {
    var counter, found, _results;
    if (!element) {
      return;
    }
    found = false;
    counter = 0;
    _results = [];
    while (!found && (counter < 10)) {
      if (element.isValid() && element.isVisible()) {
        found = true;
        puts("Got the awaited element: " + element);
        _results.push(this.delay(1));
      } else {
        this.delay(0.5);
        _results.push(counter++);
      }
    }
    return _results;
  };

  isNullElement = function(elem) {
    return elem.toString() === "[object UIAElementNil]";
  };

  screensCount = 0;

  target.captureScreenWithName_ = target.captureScreenWithName;

  target.captureScreenWithName = function(screenName) {
    var screensCountText;
    screensCountText = (++screensCount < 10 ? "0" + screensCount : screensCount);
    return this.captureScreenWithName_(screensCountText + "_" + screenName);
  };

  Zucchini = (function() {

    function Zucchini() {}

    Zucchini.run = function(featureText) {
      var func, functionFound, line, lines, match, regExpText, screen, screenMatch, screenName, section, sections, _i, _len, _results;
      sections = featureText.trim().split(/\n\s*\n/);
      _results = [];
      for (_i = 0, _len = sections.length; _i < _len; _i++) {
        section = sections[_i];
        lines = section.split(/\n/);
        screenMatch = lines[0].match(/.+ on the "([^"]*)" screen:$/);
        if (!screenMatch) {
          raise("Line '" + lines[0] + "' doesn't define a screen context");
        }
        screenName = screenMatch[1];
        try {
          screen = eval("new " + (screenName.camelCase()) + "Screen");
        } catch (e) {
          raise("Screen '" + screenName + "' not defined");
        }
        _results.push((function() {
          var _j, _len1, _ref, _ref1, _results1;
          _ref = lines.slice(1);
          _results1 = [];
          for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
            line = _ref[_j];
            functionFound = false;
            _ref1 = screen.actions;
            for (regExpText in _ref1) {
              func = _ref1[regExpText];
              match = line.trim().match(new RegExp(regExpText));
              if (match) {
                functionFound = true;
                func.bind(screen)(match[1], match[2]);
              }
            }
            if (!functionFound) {
              _results1.push(raise("Action for line '" + line + "' not defined"));
            } else {
              _results1.push(void 0);
            }
          }
          return _results1;
        })());
      }
      return _results;
    };

    return Zucchini;

  })();

  Screen = (function() {

    function Screen(name) {
      this.name = name;
      if (this.anchor) {
        target.waitForElement(this.anchor());
      }
    }

    Screen.prototype.elements = {};

    Screen.prototype.actions = {
      'Take a screenshot$': function() {
        return target.captureScreenWithName(this.name);
      },
      'Take a screenshot named "([^"]*)"$': function(name) {
        return target.captureScreenWithName(name);
      },
      'Tap "([^"]*)"$': function(element) {
        if (!this.elements[element]) {
          raise("Element '" + element + "' not defined for the screen '" + this.name + "'");
        }
        return this.elements[element]().tap();
      },
      'Confirm "([^"]*)"$': function(element) {
        return this.actions['Tap "([^"]*)"$'].bind(this)(element);
      },
      'Wait for "([^"]*)" second[s]*$': function(seconds) {
        return target.delay(seconds);
      },
      'Type "([^"]*)" in the "([^"]*)" field$': function(text, element) {
        if (!this.elements[element]) {
          raise("Element '" + element + "' not defined for the screen '" + this.name + "'");
        }
        this.elements[element]().tap();
        return app.keyboard().typeString(text);
      },
      'Clear the "([^"]*)" field$': function(element) {
        if (!this.elements[element]) {
          raise("Element '" + element + "' not defined for the screen '" + this.name + "'");
        }
        return this.elements[element]().setValue("");
      },
      'Cancel the alert': function() {
        var alert;
        alert = app.alert();
        if (isNullElement(alert)) {
          raise("No alert found to dismiss on screen '" + this.name + "'");
        }
        return alert.cancelButton().tap();
      },
      'Confirm the alert': function() {
        var alert;
        alert = app.alert();
        if (isNullElement(alert)) {
          raise("No alert found to dismiss on screen '" + this.name + "'");
        }
        return alert.defaultButton().tap();
      },
      'Select the date "([^"]*)"$': function(dateString) {
        var counter, dateParts, datePicker, monthWheel;
        datePicker = view.pickers()[0];
        if (!((!isNullElement(datePicker)) && datePicker.isVisible())) {
          raise("No date picker available to enter the date " + dateString);
        }
        dateParts = dateString.match(/^(\d{2}) (\D*) (\d{4})$/);
        if (dateParts == null) {
          raise("Date is in the wrong format. Need DD Month YYYY. Got " + dateString);
        }
        view.pickers()[0].wheels()[0].selectValue(dateParts[1]);
        counter = 0;
        monthWheel = view.pickers()[0].wheels()[1];
        while (monthWheel.value() !== dateParts[2] && counter < 12) {
          counter++;
          monthWheel.tapWithOptions({
            tapOffset: {
              x: 0.5,
              y: 0.33
            }
          });
          target.delay(0.4);
        }
        if (!(counter < 12)) {
          raise("Counldn't find the month " + dateParts[2]);
        }
        return view.pickers()[0].wheels()[2].selectValue(dateParts[3]);
      }
    };

    return Screen;

  })();

  AuthorScreen = (function(_super) {

    __extends(AuthorScreen, _super);

    AuthorScreen.prototype.anchor = function() {
      return view.navigationBars()["Author"];
    };

    function AuthorScreen() {
      AuthorScreen.__super__.constructor.call(this, 'author');
      extend(this.elements, {
        'Save': function() {
          return view.navigationBars()[0].buttons()["Save"];
        }
      });
      extend(this.actions, {
        'Type "([^"]*)"$': function(text) {
          var field;
          field = view.textFields()[0];
          return field.setValue(text);
        }
      });
    }

    return AuthorScreen;

  })(Screen);

  BookTitleScreen = (function(_super) {

    __extends(BookTitleScreen, _super);

    BookTitleScreen.prototype.anchor = function() {
      return view.navigationBars()["Book Title"];
    };

    function BookTitleScreen() {
      BookTitleScreen.__super__.constructor.call(this, 'book-title');
      extend(this.elements, {
        'Save': function() {
          return view.navigationBars()[0].buttons()["Save"];
        }
      });
      extend(this.actions, {
        'Type "([^"]*)"$': function(text) {
          var field;
          field = view.textFields()[0];
          return field.setValue(text);
        }
      });
    }

    return BookTitleScreen;

  })(Screen);

  BooksScreen = (function(_super) {

    __extends(BooksScreen, _super);

    BooksScreen.prototype.anchor = function() {
      return view.navigationBars()["Books"];
    };

    function BooksScreen() {
      BooksScreen.__super__.constructor.call(this, 'books');
      extend(this.elements, {
        'Edit': function() {
          return view.navigationBars()[0].buttons()["Edit"];
        },
        'Add': function() {
          return view.navigationBars()[0].buttons()["Add"];
        }
      });
      extend(this.actions, {
        'Scroll to "([^"]*)"$': function(elementName) {
          return view.tableViews()[0].scrollToElementWithName(elementName);
        },
        'Delete a row "([^"]*)"$': function(rowName) {
          view.tableViews()[0].cells()[rowName].switches()[0].setValue(true);
          return view.tableViews()[0].cells()[rowName].buttons()[0].tap();
        }
      });
    }

    return BooksScreen;

  })(Screen);

  NewBookScreen = (function(_super) {

    __extends(NewBookScreen, _super);

    NewBookScreen.prototype.anchor = function() {
      return view.navigationBars()["New Book"];
    };

    function NewBookScreen() {
      NewBookScreen.__super__.constructor.call(this, 'new-book');
      extend(this.elements, {
        'Save': function() {
          return view.navigationBars()[0].buttons()["Save"];
        }
      });
      extend(this.elements, {
        'Title': function() {
          return view.tableViews()[0].cells()[0];
        },
        'Author': function() {
          return view.tableViews()[0].cells()[1];
        }
      });
    }

    return NewBookScreen;

  })(Screen);

  Zucchini.run('Start on the "Books" screen:\n  Take a screenshot\n Tap "Add"\n\nThen on the "New Book" screen:\n   Take a screenshot\n Tap "Title"\n   \nThen on the "Book Title" screen:\n    Type "Testing with Zucchini"\n  Take a screenshot\n Confirm "Save"\n\nThen on the "New Book" screen:\n  Tap "Author"\n\nThen on the "Author" screen:\n  Type "Vasily M. and Raj K."\n   Take a screenshot\n Confirm "Save"\n\nThen on the "New Book" screen:\n  Take a screenshot named "new-book-filled"\n Confirm "Save"\n    \nThen on the "Books" screen:\n Scroll to "Testing with Zucchini"\n Take a screenshot named "books-with-a-new"\n    Tap "Edit"\n    Delete a row "Testing with Zucchini"\n  \n');

}).call(this);

--family should indicate connected device as well

I have an iPad and an iPhone connected and I want to set it up so it can test on both devices. "bwoken test" and all variants of "--family=" run only against the first connected device. I'm including a screenshot of an attempt to test against the attached iPhone, with "bwoken test --family=iphone" and it executing against the iPad instead. Thanks.
bwoken

Real device deployment?

Hi there,
i'm currently setting up a test environment for our app using bwoken as testrunner on jenkins and so far, everything is working fine if the tests run on simulator.

However, i recently tried to run the tests on a real device and somehow, thing didn't work out as expected:
Is bwoken supposed to deploy the app onto a connected device and start testing afterwards, just like it does on the simulator?
In my case, this does not seem to work. (if it is supposed to)

Tested with iPad 1 (seems like it does NOT work with iOS 5?!) and iPad mini (testing only started if the app was already installed, but the tests kept failing as no buttons could be tapped).

Thanks in advance!

Cheers, Tobias

Travis-CI: Failed to connect to local pid watcher service: (os/kern) failure

Bwoken works great locally but when the Travis-CI machines try to run the tests I get the error below:

Failed to connect to local pid watcher service: (os/kern) failure

The project builds and it tests fine but the exit code is still 1 instead of 0

https://travis-ci.org/ARISGames/iOSClient

Do you guys have any suggestions on how to fix this?

Thank you,

P.S. I think this is related to the Authorization prompt when the simulator opens.

http://stackoverflow.com/questions/9476131/is-there-a-way-to-remove-the-authorization-prompt-from-command-line-instances-of

Custom name for Info.plist file fails to run tests

If your project or target has non-standard name for Info.plist file, you will get this error and tests are stopped.

** Execute coffeescript
** Execute iphone:test
File Doesn't Exist, Will Create: /build/iphonesimulator/Prototype.app/Info.plist
Delete: Entry, ":UIDeviceFamily", Does Not Exist
File Doesn't Exist, Will Create: /build/iphonesimulator/Prototype.app/Info.plist
File Doesn't Exist, Will Create: /build/iphonesimulator/Prototype.app/Info.plist
iphone  example.js

Any ideas how to fix this?

Resource busy - /dev/ptyvf

This happens when you abort a test execution half way. It causes several issues.

  • A ScriptAgent process will stay running forever and for some reason it cannot be killed. It's holding /dev/ptyvf, but it's not listed by lsof. Whoever finds out how to kill this thing via launchctl gets a 🍺 from me.
  • Bwoken will hang because there's no stdout output, only stderr, which says Resource busy - /dev/ptyvf. Bwoken needs to pipe that properly so that the user sees it, and not hang.

Coffeescript doesn't support #import

There's no way to get an #import statement into the generated javascript through pure coffeescript means... the compiler would choke.

I imagine having to use something like:

###
imports:
tuneup.js
###

which would result in:

#import "tuneup.js"

Run Bwoken on OS X Server for CI

I don't know if anyone as tried to run Bwoken as a post-action in build scheme, I was trying out that today so we could run UI test on OS X Server, but I've run into this weird error says invalid byte sequence in US-ASCII (ArgumentError)

I've tried to add encoding info into my own Gemfile but that didn't work. And this doesn't happen if I run Bwoken locally on my machine.

The full error message

/Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/formatter.rb:29:in `line_demuxer': invalid byte sequence in US-ASCII (ArgumentError)
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/formatter.rb:65:in `block in format'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/formatter.rb:64:in `each_line'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/formatter.rb:64:in `format'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/script.rb:54:in `block in run'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:217:in `popen_run'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open3.rb:99:in `popen3'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/script.rb:53:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/device_runner.rb:17:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/device_runner.rb:17:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/script_runner.rb:55:in `execute_on_device'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/script_runner.rb:22:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/cli/test.rb:103:in `test'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/cli/test.rb:65:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/lib/bwoken/cli.rb:52:in `<top (required)>'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.0.0/gems/bwoken-2.0.0.beta.1/bin/bwoken:3:in `<top (required)>'
    from /usr/bin/bwoken:23:in `load'
    from /usr/bin/bwoken:23:in `<main>'

Simulator is not launched automatically

Hey,
I got very strange issue with bwoken, that basically simulator is not launched automatically when I run "rake" command. That means its stucked on "iphone example.js"...

Please check this very short video http://cl.ly/1h1f473r2f2f0C2j060f of running rake with --trace.

I am using:
bwoken 1.0.0
ruby 1.9.3 (using rvm)
Xcode 4.3.3 (with command line tools installed)
Mac OS X 10.7.4

verbose does not print the instruments command

I'm trying to debug why broken won't work when run from jenkins and i would need to see the command that is launching instruments so that i can check that it is correct.

--verbose option unfortunately does not do this.

Is there a quick way for me to see this in the meantime?

Thanks, olivier

simulator black screen when executing from remote machine via ssh

I have Xcode 4.6 and iphone simulator 6.0 on the machine. I'm able to run bwoken tests just fine from the machine itslef. But when I run from a remote machine via ssh. The simulator shows up but when the app launches it shows a blank, black colored screen and the tests are not seeing the UI elements and return UIAElementNil.

I needed to be able to run remotely because I was trying to setup the machine as a Jenkins slave so that I can do the builds from the CI interface.

Xcode 6 issue

At least for my two machines, there is no longer a full path to Automation.tracetemplate. Running xcrun instruments -s I'm left with the following templates:

Known Templates:
"Activity Monitor"
"Allocations"
"Automation"
"Blank"
"Cocoa Layout"
"Core Animation"
"Core Data"
"Counters"
"Dispatch"
"Energy Diagnostics"
"File Activity"
"GPU Driver"
"Leaks"
"Multicore"
"Network"
"OpenGL ES Analysis"
"Sudden Termination"
"System Trace"
"System Usage"
"Time Profiler"
"UI Recorder"
"Zombies"

I haven't done much digging into this, but it runs fine for me if I adjust the [-t template] option via a slight code tweak like so:

def path_to_automation_template
  template = nil
  `xcrun instruments -s 2>&1 | grep Automation.tracetemplate`.split("\n").each do |path|
    path = path.gsub(/^\s*"|",\s*$/, "")
    template = path if File.exists?(path)
    break if template
  end
  template || 'Automation' #ADDED HERE
end

We're back in business. I'm not sure if it's safe to assume this as a default, however. Without this, you'll get the following error message:

2014-09-22 17:21:22.000 instruments[9053:1007] *** -[__NSCFConstantString stringByAppendingPathExtension:]: cannot append extension 'tracetemplate' to path ''
Instruments Usage Error : The specified template '' 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 ...]]]

Remove colorful formatter for Jenkins

Hi guys,
just another question regarding continuous integration:

By default bwoken uses the colorful formatter which is really nice!
However if you run your tests with bwoken on jenkins, the console can't handle the colorful highlighting and it looks like this:

[34mBuilding�[m�[34m.�[m�[34m.[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m�[34m.�[m
�[32mBuild Successful!�[m

�[36mipad Testscript.js�[m
�[36mStart:�[m Testscript
�[36mDefault:�[m I'm an iPad Simulator
�[36mDebug:�[m �[33mtap�[m toolbar.buttons[�[35m"Show menu"�[m]
�[36mDebug:�[m �[33mtap�[m popover.actionSheet.buttons[�[35m"Settings"�[m]
�[36mDebug:�[m �[33mtap�[m tableViews[�[35m"Empty list"�[m].cells[�[35m"Something"�[m]
�[36mDebug:�[m �[33mtap�[m tableViews[�[35m"Empty list"�[m].cells[�[35m"Test"�[m].textFields[0]
�[36mDebug:�[m �[33mtap�[m tableViews[�[35m"Empty list"�[m].cells[�[35m"Test"�[m].textFields[0].buttons[�[35m"Clear text"�[m]
�[36mDebug:�[m keyboard.typeString("default")
�[36mDebug:�[m �[33mtap�[m tableViews[�[35m"Empty list"�[m].cells[�[35m"Test2"�[m].textFields[0]
�[36mDebug:�[m �[33mtap�[m tableViews[�[35m"Empty list"�[m].cells[�[35m"Test2"�[m].textFields[0].buttons[�[35m"Clear text"�[m]
�[36mDebug:�[m keyboard.typeString("address")
�[36mDebug:�[m �[33mtap�[m navigationBar.leftButton
�[36mDebug:�[m �[33mtap�[m navigationBar.leftButton
�[32mPass:�[m Testscript

�[32mComplete�[m
Duration: �[4;1m27.359995s�[m

So, is there an easy option to disable the colorful formatting for this configuration?

Thanks!

Installation instructions outdated, don't work

That, or I'm doing it wrong :)

  1. After creating the .rvmrc, the instructions say to '. .rvmrc'. Up pops a warning "You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers..."

It suggests running 'rvm rvmrc to .ruby-version', which I did. OK.

  1. Later on after creating the Gemfile, the instructions say to 'rake bwoken:init'. Unfortunately that results in:

    rake aborted!
    cannot load such file -- bwoken/tasks

Unsure how to proceed here.

(Ruby version is 1.9.3-p429)

can't get anything to run

I followed the instructions to a T and set it up with tuneup. It builds fine but nothing is run inside of my tests. Even a blank test with UIALogger.logMessage("Turn on edit mode") logs out nothing.

Any ideas? I'm on IOS7/Xcode5

http://cl.ly/image/271j2Y3m2I0S

Is it possible to customize the build command?

We currently need to set the architecture to i386 in order to run the application in the simulator, we set the flag "-arch i386" . Is there a way that we can customize the xcodebuild command to incorporate this?

Multiple connected devices only runs first listed device

Extracted from #72.

Steps to reproduce:

  1. Connect an iPad and an iPhone to host computer.
  2. Run bwoken with --family specifying iPad or iPhone.

Expected:

Bwoken runs the test on the specified family

Actual:

Bwoken only ever runs on the first device that was connected.

Install & configure bwoken in different folder

Hello,

May be I missed it while reading docs, but...
How can I install bwoken and it's folders structure in different folder, not in root folder (that contains .xproject file)

Thanks.

Any existing way to run a script before/after each test (A.K.A. setup/teardown)?

In unit testing frameworks (which admittedly bwoken is not) there are setup and tear down methods that can be implemented to run before and after each test. Is there such a mechanism in bwoken?

The scenario is this, and I'd be quite surprised that I'm the first to run up against it: I need to reset (or delete my app) before/after some tests so that he app starts in a known state. If I don't have this sort of thing, it makes trying to script tests pretty much useless since I still need manual steps to clear the simulator (put it in a known state) before the tests can be run.

Does bwoken all ready provide such a hook? If not, how are others dealing with putting the application into a known state before running tests? I don't see how you could do any sort of reliable tests without having a known starting state.

Thanks for your thoughts!

Instruments Usage Error

I have problem with using bwoken.
When I use "rake" command after installation of bwoken, this text is displayed in the terminal:

Instruments Usage Error : The specified template 'file://localhost/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate' does not exist.
instruments, version 4.5 (4523)
usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]]

I am using:
bwoken 1.1.0
ruby 1.9.3 (using rvm)
Xcode 4.5 (4G182) (with command line tools installed)
Mac OS X 10.8.2

Do you have a solution for this, please?

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.