added integration tests for all cases of click_button (by id, by html, by value, by alt for buttons and inputs of types image, button and submit)

This commit is contained in:
Matthias Marschall 2009-05-29 12:07:10 +02:00 committed by mike.gaffney
parent 6cd734aec9
commit 9b85b6d7e0
4 changed files with 95 additions and 0 deletions

View File

@ -9,6 +9,9 @@ class WebratController < ApplicationController
def form
end
def buttons
end
def submit
render :text => "OK <a href='/' id='link_id'>Test Link Text</a>"
end

View File

@ -0,0 +1,11 @@
<h1 id='form_title' class='form title'>Webrat Buttons Form</h1>
<% form_tag submit_path do %>
<input type="button" id="input_button_id" value="input_button_value">
<input type="submit" id="input_submit_id" value="input_submit_value">
<input type="image" id="input_image_id" value="input_image_value" alt="input_image_alt" src="">
<button type="button" id="button_button_id" value="button_button_value">button_button_text</button>
<button type="submit" id="button_submit_id" value="button_submit_value">button_submit_text</button>
<button type="image" id="button_image_id" value="button_image_value">button_image_text</button>
<% end %>

View File

@ -9,6 +9,7 @@ ActionController::Routing::Routes.draw do |map|
webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
webrat.show_params "/show_params", :action => "show_params"
webrat.buttons "/buttons", :action => "buttons"
webrat.root :action => "form"
end
end

View File

@ -0,0 +1,80 @@
require 'test_helper'
class ButtonClickTest < ActionController::IntegrationTest
# <button type="button" ...>
test "should click button with type button by id" do
visit buttons_path
click_button "button_button_id"
end
test "should click button with type button by value" do
visit buttons_path
click_button "button_button_value"
end
test "should click button with type button by html" do
visit buttons_path
click_button "button_button_text"
end
# <button type="submit" ...>
test "should click button with type submit by id" do
visit buttons_path
click_button "button_submit_id"
end
test "should click button with type submit by value" do
visit buttons_path
click_button "button_submit_value"
end
test "should click button with type submit by html" do
visit buttons_path
click_button "button_submit_text"
end
# <button type="image" ...>
test "should click button with type image by id" do
visit buttons_path
click_button "button_image_id"
end
test "should click button with type image by value" do
visit buttons_path
click_button "button_image_value"
end
test "should click button with type image by html" do
visit buttons_path
click_button "button_image_text"
end
# <input type="button" ...>
test "should click image with type button by id" do
visit buttons_path
click_button "input_button_id"
end
test "should click input with type button by value" do
visit buttons_path
click_button "input_button_value"
end
# <input type="submit" ...>
test "should click input with type submit by id" do
visit buttons_path
click_button "input_submit_id"
end
test "should click input with type submit by value" do
visit buttons_path
click_button "input_submit_value"
end
# <input type="image" ...>
test "should click input with type image by id" do
visit buttons_path
click_button "input_image_id"
end
test "should click input with type image by value" do
visit buttons_path
click_button "input_image_value"
end
test "should click input with type image by alt" do
visit buttons_path
click_button "input_image_alt"
end
end