Questions tagged [webrat]

Webrat is an acceptance testing library for Web applications written in Ruby.

Webrat is an acceptance testing tool for Ruby, which simulates a browser without JavaScript support. But it can also be combined with a web automation framework like Watir to implement browser based web automation tests.

183 questions
8
votes
4 answers

How do I test an image alt value using capybara?

I'm trying to define a step to test the value of alt text of an image using Capybara and CSS selectors. I wrote one for input values based on the readme examples: Then /^I should see a value of "([^\"]*)" within the "([^\"]*)" input$/ do…
kinet
  • 1,790
  • 3
  • 20
  • 32
7
votes
1 answer

webrat_steps.rb missing

I'm trying to work through http://railscasts.com/episodes/155-beginning-with-cucumber which basically teaches how to use Cucumber within Rails applications. I installed all missing gems and running rails g cucumber:install runs though without…
pagid
  • 13,559
  • 11
  • 78
  • 104
7
votes
3 answers

How to mock/stub a model in Cucumber tests

The scenario is as follows. My Order model has an after_create that contacts a remote payment gateway to retrieve a payment URL. In my Cucumber tests I don't want to perform this action, but return an arbitrary URL. My current cucumber tests looks…
Ariejan
  • 10,910
  • 6
  • 43
  • 40
6
votes
2 answers

Cucumber: find the input with label text X?

In Cucumber, I'm trying to create a step like this: Then I should see "Example business name" in the "Business name" input I'd like the "Business name" input to be defined as "the input whose label has text "Business name." Here's what I've got on…
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
5
votes
2 answers

Rails 3 integration testing - Using webrat fill_in not finding fields

I'm learning testing right now, but am having some issues with Webrat not finding form fields using fill_in even though I've verified it is on the correct page. Does Webrat work off of field names or ID's? I've tried using Ruby symbols and form…
iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
5
votes
1 answer

Cucumber, Webrat and Selenium NoMethodError in Rails 3

I'm having a problem using selenium. When I have a scenario which uses the "I should see foo within bar" web step from cucumber, I get the following error: NoMethodError: undefined method `within' for # It…
Magnus
  • 1,222
  • 1
  • 12
  • 25
5
votes
1 answer

How do I test DelayedJob with Cucumber?

We use DelayedJob to run some of our long running processes and would like to test with Cucumber/Webrat. Currently, we are calling Delayed::Job.work_off in a Ruby thread to get work done in the background, but are looking for a more robust…
Sean
  • 1,502
  • 3
  • 12
  • 20
5
votes
3 answers

WebRat+Selenium WebDriver: wait for ajax to be completed

We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is that this mechanism doesn't work with Ajax…
Bogdan Gusiev
  • 8,027
  • 16
  • 61
  • 81
5
votes
1 answer

Cucumber and/or Webrat hates  ?

I have a cucumber step that recently started failing when an   was added to my layout. If I take the   out, my tests all pass. When I put it back in, every test that uses the click_link method supplied by WebRat fails with the following…
Matt Grande
  • 11,964
  • 6
  • 62
  • 89
4
votes
5 answers

Cucumber: selecting an element from a table for deletion or addition

I have the following table in an application I am developing using ruby on rails: I want to create a test in cucumber where I select a user from the table and delete it or edit it. I don't know what is the step definition for that. I'd like to be…
Tiago Veloso
  • 8,513
  • 17
  • 64
  • 85
4
votes
3 answers

Cucumber/Webrat not following the redirect_to

I am running rails 3.0.0, rspec-rails 2.0.0.beta.20, webrat 0.7.2.beta.1, cucumber-rails 0.3.2 I have this scenario: Scenario: Given I am on the new account page And I fill in "Name" with "John Doe" When I press "Create" Then I should be on…
Cameron
  • 4,181
  • 9
  • 36
  • 40
4
votes
4 answers

How does rspec work with Rails 3 for integration tests?

What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34. an example: describe SomeApp it "should show the index page" visit "/" …
makevoid
  • 3,276
  • 2
  • 33
  • 29
4
votes
1 answer

How do I click on a specific button using cucumber/webrat when the name of the button starts with the same word?

I have the following html with multiple inputs: and would like to use cucumber to test clicking on the "Save" button. However, when I do…
zlog
  • 3,316
  • 4
  • 42
  • 82
4
votes
3 answers

Cucumber + webrat + selenium, how do I ignore hidden text?

I am using Cucumber, webrat and selenium to test a web application. I use 'I should see "something"' to verify changes. However, in many places, text to be verified only changes from hidden to visible (this might be caused by removing 'hidden' class…
Guoliang Cao
  • 507
  • 4
  • 11
4
votes
1 answer

Rails, RSpec and Webrat: Expected output matches rendered output but still getting error in view spec

I've just gotten started using BDD with RSpec/Cucumber/Webrat and Rails and I've run into some frustration trying to get my view spec to pass. First of all, I am running Ruby 1.9.1p129 with Rails 2.3.2, RSpec and RSpec-Rails 1.2.6, Cucumber 0.3.11,…
Anthony Burns
1
2
3
12 13