capybara selenium and JavaScript Destroy

Posted by dorelal on Stack Overflow See other posts from Stack Overflow or by dorelal
Published on 2010-05-13T16:06:22Z Indexed on 2010/05/30 20:22 UTC
Read the original article Hit count: 529

I am using rails 2.3.5 and this is what I did. I have latest cucumber, cucumber-rails and capybara installed.

rails demo
cd demo
ruby script/generate cucumber --rspec --capybara
ruby script/generate feature post title:string body:text published:boolean
ruby script/generate scaffold post title:string body:text published:boolean
rake db:migrate
rake cucumber

All the tests are passing. Now I want to test using Javascript.

At this time this is how scenario looks like

  Scenario: Delete post
    Given the following posts:
      |title|body|published|
      |title 1|body 1|false|
      |title 2|body 2|true|
      |title 3|body 3|false|
      |title 4|body 4|true|
    When I delete the 3rd post
    Then I should see the following posts:
      |Title|Body|Published|
      |title 1|body 1|false|
      |title 2|body 2|true|
      |title 4|body 4|true|

I added @javascript at the top.

Now when I run rake cucumber then I see a confirmation page. But nothing happens until I click.

What do I need to do so that OK is clicked automatically and test proceeds ahead.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about selenium