Testing javascript prompt popups with Culerity
4 October 2009 in Ruby on Rails, TestingSolution
And /^I test the prompt/ do $browser.webclient.send_remote(:setPromptHandler) ... {"lambda {'god help me if this worked'}"} And %Q{I follow "hi"} Then %Q{I should see "god help me if this worked"} end
In my previous post, I chronicled the pains of testing javascript popups with Celerity. I thought I had solved my problem until I tried to implement a real test in Cucumber. In my project, I am running standard ruby, but Celerity is jruby. Because you probably don’t want to convert your project to jruby just so you can test javascript a library named Culerity lets you run Celerity without having to run your rails app in jruby. It starts up a separate jruby server process and shells out commands on your behalf. This works pretty well, except of course, when testing javascript prompt popups.
Again, the code in the documentation doesn’t seem to work as advertised, so I had to struggle again with a fix. I’m not going to go into why this works - I’m not totally sure myself. I just want to give you the solution so you won’t have to go through this all over again. I am your testing martyr:
And /^I test the prompt/ do $browser.webclient.send_remote(:setPromptHandler) . . . {"lambda {'god help me if this worked'}"} And %Q{I follow "hi"} Then %Q{I should see "god help me if this worked"} end
Hope that helps someone!
No comments yet.
Leave a comment
Tweets
- study: "In 2 years, work perf of high school recruited devs indistinguishable from more experienced peers"(paraphrase)http://tcrn.ch/daXoHA (link)
- Attention Software Developers: We better be rich before we turn 50 http://tcrn.ch/daXoHA :( (link)
- @integrum was mentioned in the devshow podcast #14 for its hiring practice of having developers download a project from Git and re-factor. (link)
- @supairish good point! (link)
- Like the unobtrusive js in Rails 3 but stuck on 2.3.dumb? Just include Rv3 jquery adapter (a .js file) in ur project! http://bit.ly/bqjVGH (link)
- Introducing netrecorder, my first ruby gem.
3 January 2010 - How to build a ruby gem and host it on gemcutter
3 January 2010 - DEMO!
18 December 2009 - It puts the lotion on its skin
14 December 2009 - Cucumber Code Ratio
14 December 2009
- Tobi:
^^ shit, ok now I see it's not your fault, its (my... - Tobi:
Thanks for this great writeup! btw. you missed... - Chris Young:
Thanks for letting me know. I updated the link.... - maxjgon:
The link of the project in Github is broken!... - Chris Young:
Oh I see . . . Maybe I should check out this so-c...