GithubHelp home page GithubHelp logo

langalex / culerity Goto Github PK

View Code? Open in Web Editor NEW
259.0 259.0 37.0 1.07 MB

Culerity integrates Cucumber and Celerity in order to test your application's full stack including Javascript. Your Rails app doesn't have to run in JRuby.

Home Page: http://groups.google.com/group/culerity-dev

License: MIT License

JavaScript 1.43% Ruby 98.57%

culerity's People

Contributors

akahn avatar baconpat avatar bmabey avatar caius avatar dcrec1 avatar drnic avatar ebertech avatar fidothe avatar jason-o-matic avatar jdewind avatar jnicklas avatar langalex avatar mourdok avatar myabc avatar pvelder avatar roidrage avatar slavik112211 avatar tmak 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

culerity's Issues

Doctype being removed

When I use culerity to run javascript features in cucumber I've noticed it changes my HTML5 doctype to

This is causing all my calls to validate the markup to fail.

Culerity generators in Rails 3

Hi there,

I'm trying to run Culerity in Rails 3 (beta 4) but can't run the generators as rails g doesn't find any. This makes sense as the generator mechanism changed in Rails 3.

So I'm wondering, is Culerity Rails 3 compatible and am I missing something?

Thanks!

Error thrown when trying to interact with a confirm dialog

Hi,

I am trying to test a link which displays a confirm dialog when clicked. Using the following syntax which I found in the celerity documentation...

$browser.confirm(true) do
$browser.link(:text, /#{link}/).click
end

throws the following error...

NoMethodError: undefined method `remove_listener' for #Celerity::Browser:0x3c32fb80 (Culerity::CulerityException)

New gem release for Capybara compatibility

Any chance of cutting a new gem release soon? Culerity 0.2.3 doesn't work with Capybara, but the current HEAD of master (commit 218f631) does work.

It would make using Capybara a bit easy if we could just do "sudo gem install culerity", but right now one has to clone the repo and build a custom version based on HEAD.

Cheers,
Wincent

"Then I should see..." steps fail if text is contained in paragraph tags and not div tags

When writing a simple test to create a user and log into the app, everything was working correctly until a "Then I should see..." step, which was looking for a flash notice saying "Login successful!" The step was failing, but physically logging into the app showed that the flash notice was definitely there, as did viewing the page's source at the time of logging in. On a whim, I changed the tags enclosing the notice from

tags to

tags, and the test passed.

I'm not sure why this would (or should) matter. Do "Then I should see..." steps fail with

tags? Do they fail with anything but

tags?

Third party APIs

I've just switched to culerity/celerity from webrat, and although it was a little painful to update all 200 scenarios it's almost all working except for one problem. My app is using a third party payment provider, and I was stubbing out things like credit card valid, and the different responses before running certain scenarios. Obviously this no longer works. Is there any solution?

common_celerity_steps.rb doesn't emulate webrat_steps.rb fully

Culerity comes with the some handy steps like:

When /I fill in "(.*)" with "(.*)"/ do |value, field|
  $browser.text_field(:id, find_label(field).for).set(value)
end

This allows users to use their existing features, which formerly ran in Webrat, in Celerity.

However, Webrat's fill_in method accepts either the text of a form element's label or a form element's name attribute. Culerity's version of this only accepts the text from the label. In order for common_celerity_steps.rb to truly stand in for webrat_steps.rb, these step definitions need to take either a label name or a form element's name.

The step in common_celerity_steps.rb would then look like:
When /I fill in "(.)" with "(.)"/ do |value, field|
begin
$browser.text_field(:name, field).set(value)
rescue Celerity::Exception::UnknownObjectException
$browser.text_field(:id, find_label(field).for).set(value)
end
end

What are people's thoughts on this approach?

Culerity should only have development dependency on cucumber and rspec

The Rakefile should have this:

gem.add_development_dependency 'cucumber' 
gem.add_development_dependency 'rspec' 

Otherwise people can't use Culerity unless they have both RSpec and Cucumber installed, and that shouldn't be a requirement. (I'm trying to verify that Cucumber+Culerity works in pure Test::Unit mode by uninstalling RSpec, and this hard dependency makes it hard for me to test that).

Culerity not working with regular JRuby

I'm trying to get Culerity working with a regular installation of JRuby (installed with apt-get on Ubuntu).

I followed all steps in the rdoc, fired up rake culerity:rails:start and I still get the following error:

/usr/lib/jruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require': no such file to load -- culerity/celerity_server (LoadError) from /usr/lib/jruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from /var/lib/gems/1.8/gems/culerity-0.2.12/lib/start_celerity.rb:2

AAHHHH!!!!!!
Any ideas? Thanks...

select_list().options returns RemoteProxy object

I'm trying to get the list of <option>s in a <select>. This is what currently happens:

>> $browser.select_list(:id, "select_id").options
=> #<Culerity::RemoteObjectProxy:0x2158784 @remote_object_id=78, @io=#<IO:0x21a5fd4>

Testing using Celerity under jirb it should be returning an Array object.

irb(main):020:0> b.select_list(:id, "select_id").options
=> ["One", "Two", "Three"]

What I expect is for Culerity to return the array Celerity is returning.

Nailgun support

Currently JVM startup time makes for a very frustrating feedback loop when running Culerity over a small number of scenarios (often just one). JRuby 1.5 has Nailgun support and I'd love to use this with Culerity! It'd make a huge difference to a lot of features I work on.

Cannot pass in a block to tablerow.each

Hi,

For celerity's table row object, there's a each method where I can pass in a block to be excuted on its table cells. But Culerity throws a "LocalJumpError: yield called out of block" exception. Is there a workaround?

culerity hangs on exit

Hi

Here's the specs of what I'm running
ruby 1.8.7
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [x86_64-java]
culerity 0.2.14

When the scenarios end cucumber hangs in the at_exit in culerity_steps on:

$server.close if $server

I looked at the code and $server is the result of an IO.popen extened with the ServerCommands module but closing on an IO doesn't seem to make sense since it's still running. I changed it to

$server.exit_server if $server

which sends the exit command. Should this be changed in the generator? Am I the only one experiencing this sort of thing?

Broken pipe with RVM (or whatever)

i am trying to get rails cucumber tests working with rvm. i experimented with various versions of culerity, celertiy, cucumber and rails, but nothing seems to work...

maybee anybody has seen this:

[2010-09-23 23:37:40] ERROR Errno::EPIPE: Broken pipe
/Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:30:in write' /Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:30:inprint'
/Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:30:in tail_log' /Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rails-2.3.4/lib/rails/rack/log_tailer.rb:18:incall'
/Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rack-1.0.1/lib/rack/content_length.rb:13:in call' /Users/nofail/.rvm/gems/ruby-1.8.7-p302@tolingo-site/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:inservice'

the only thing i found was a discussion on stackoverflow: http://stackoverflow.com/questions/3445002/error-errnoepipe-broken-pipe-with-culerity

this is the (j)ruby versions i use:
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.4.0]
jruby 1.5.2 (ruby 1.8.7 patchlevel 249) (2010-08-20 1c5e29d) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]

step 'When I follow "[link]"' finds wrong link, with celerity -v=0.7.7 and above

background:
-culerity -v=0.2.10
-jruby -v=1.5.0
-ruby -v=ruby 1.8.7 (2009-06-12 patchlevel 174)
-rails -v=2.3.5

behaviour:
-the step does not fail it just finds wrong link
-if I add a "puts _link.absolute_url" to the step the problem becomes obvious

workaround:
-using celerity -v=0.7.6

is somebody able to reproduce this?

Regards

IO.popen("script/server") makes the Rails app sad

So I've been using Culerity for my complex MongoDB-driven Rails app for a few days now. Love the concept. Love it -- I think it's the sanest Javascript Cucumber integration I've yet seen. (Granted, that's in a field of fairly insane competitors.) But I was having major problems keeping it up and running during my BDD cycle, especially when using autospec for automatic feature testing.

The behavior I saw was that it would run once just fine, and then on the second and subsequent runs I'd get a consistent error on every Celerity step:

NativeException: org.apache.commons.httpclient.NoHttpResponseException: The server localhost failed to respond (Culerity::CulerityException)

This happened on both Webrick and Thin. (I'm using Ruby 1.9 so Mongrel is out.) Thin was also throwing an interesting yet dramatic exception:

/opt/local/lib/ruby/gems/1.9.1/gems/thin-1.2.5/lib/thin/logging.rb:28:in `write': Broken pipe - <STDOUT> (Errno::EPIPE)

After a fair amount of experimentation and headbanging, I found the problem: both the Rake task and the Culerity steps' built-in $rails_server invocations are using IO.popen to start the Rails app. Which means that STDIN and STDOUT are both being captured and held by the Ruby process that invokes it. This makes sense for the Celerity server, which has to be communicated with; but the Rails server is just supposed to sit there. You never do anything with the IO object except retrieve its pid. This causes problems when the process that started it ends, leaving the Rails process orphaned with no input or output. (Hence the Broken pipe - <STDOUT> error I saw with Thin.)

The fix to this is really simple: use Kernel.spawn to start the Rails server. The spawn method returns immediately with the pid value, and doesn't interfere with the child's in/out in any way. For extra cleanness, use the -d option to script/server to detach its output and keep it from interfering with Cucumber output in that shell.

This seems to work fine in my own app, so I'll be forking Culerity right now and submitting this to you shortly as a pull request. While I'm at it, I'll set up Thin as a viable server option and address issue #16 about the pid file location. (Thin seems to solve some other problems I was having with Webrick in Culerity, possibly related to startup time or request speed.)

browser object

This is not really an "issue" per se, just a suggestion. Have you ever thought about doing a little extra meta-programming to get rid of all the $browser objects in the step definitions?

Just an idea.

Culerity, Capybara and Ruby 1.9.2

Hi there

I've read on the Capybara Readme https://github.com/aslakhellesoy/capybara that Culerity does not currently work with Ruby 1.9.x.

I have tried to run it anyway and am getting the following exception:

Celerity::Exception::UnexpectedPageException: / (Culerity::CulerityException)
./features/step_definitions/web_steps.rb:29:in block (2 levels) in <top (required)>' ./features/step_definitions/web_steps.rb:14:inwith_scope'
./features/step_definitions/web_steps.rb:28:in /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/' features/backlog.feature:44:inAnd I am signed in as "John"'

Does Celerity support Ruby 1.9.2?

Matt

Error thrown when running under Snow Leopard (Culerity::CulerityException - SocketError)

Running culerity-based features causes a Culerity::CulerityException, or SocketError, to be thrown.

You can see the little project I used to test this here: http://github.com/kfitzpatrick/mess_around_with_culerity

It's a little sloppy, but if you run the tests you'll see the error.

There are more details below. Please let me know if you have more questions. I'd be very happy to help debug this.

  • Kevin Fitzpatrick (kfitzpatrick) & Dennis Rogenius (denro)

Found on :
Mac OS X 10.6.1
MacBook Pro
jruby 1.4.0RC2 (ruby 1.8.7 patchlevel 174) (2009-10-21 7e77f32) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

Associated Gems:
culerity (0.2.3) - from gemcutter.org

Note: We also tried this with the previous version of culerity 0.1.5

JRuby Gems tried with both:
celerity (0.7.4) - from gemcutter.org
and
jarib-celerity (0.0.7.1)


Here is the stacktrace that occurs directly before the first step of each scenario:

SocketError: initialize: name or service not known (Culerity::CulerityException)
/Library/Ruby/Gems/1.8/gems/culerity-0.2.3/lib/culerity/remote_object_proxy.rb:54:in process_result' /Library/Ruby/Gems/1.8/gems/culerity-0.2.3/lib/culerity/remote_object_proxy.rb:40:insend_remote'
/Library/Ruby/Gems/1.8/gems/culerity-0.2.3/lib/culerity/remote_object_proxy.rb:25:in method_missing' /Library/Ruby/Gems/1.8/gems/culerity-0.2.3/lib/culerity/remote_browser_proxy.rb:7:ininitialize'
./features/step_definitions/common_celerity_steps.rb:7:in new' ./features/step_definitions/common_celerity_steps.rb:7:inBefore'

.each not working on a links collection

In irb I try to loop over a list of all the links on the Google homepage:

server = Culerity::run_server
browser = Culerity::RemoteBrowserProxy.new server
browser.goto("http://www.google.com")
browser.links.each do |link|
   link.inspect
end

The each block throws the following error:

warning: multiple values for a block parameter (0 for 1)
    from /Users/john/.bundle/ruby/1.8/gems/culerity-0.2.10/lib/culerity/remote_object_proxy.rb:65
=> 28

It seems Culerity is forwarding the method in the remote_object_proxy where it fails for some reason.

Using Rails 3 beta 4.

Can we have a mailing list?

There are a couple of us actively developing culerity at the moment. Github's inbox nor issues systems are best for chatting + having permanent log. Can we have a google group etc?

Exception invoking jsxGet_length (Culerity::CulerityException

This is my first time using Culerity. Celerity seems to be working by itself. script/server -e test -p 3001 seems to be receiving the request, but then something bad happens:

[root@zvm trunk]# cucumber features/homepage.feature
Using the default profile...
WARNING: No DRb server is running. Running features locally:
/var/zvents/zvents/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
.May 19, 2010 6:30:32 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'http://connect.facebook.net/en_US/all.js', but got 'application/x-javascript'.
F-

(::) failed steps (::)

NativeException: com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxGet_length (Culerity::CulerityException)
com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:527:in run' net/sourceforge/htmlunit/corejs/javascript/Context.java:537:incall'
net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in call' com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java:457:incallFunction'
com/gargoylesoftware/htmlunit/html/HtmlPage.java:910:in executeJavaScriptFunctionIfPossible' com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:159:inexecuteEventListeners'
com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java:216:in executeBubblingListeners' com/gargoylesoftware/htmlunit/javascript/host/Node.java:645:infireEvent'
com/gargoylesoftware/htmlunit/html/HtmlElement.java:887:in run' net/sourceforge/htmlunit/corejs/javascript/Context.java:537:incall'
net/sourceforge/htmlunit/corejs/javascript/ContextFactory.java:538:in call' com/gargoylesoftware/htmlunit/html/HtmlElement.java:892:infireEvent'
com/gargoylesoftware/htmlunit/html/HtmlPage.java:1154:in executeEventHandlersIfNeeded' com/gargoylesoftware/htmlunit/html/HtmlPage.java:200:ininitialize'
com/gargoylesoftware/htmlunit/WebClient.java:427:in loadWebResponseInto' com/gargoylesoftware/htmlunit/WebClient.java:303:ingetPage'
com/gargoylesoftware/htmlunit/WebClient.java:376:in getPage' features/homepage.feature:10:inWhen I am on the homepage'

Failing Scenarios:
cucumber features/homepage.feature:7 # Scenario: Visit homepage

Culerity fails if JRuby is not in a standard path

It would be nice to be able to specify the path where JRuby is located. I've installed JRuby using RVM, and because the path to JRuby is not in a standard location Culerity.run_server will fail. For some reason, saying rvm use jruby; which ruby doesn't work so I don't know of a way of figuring out where JRuby is located programmatically in this case. Thus the need to specify the path manually.

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.