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:
parent
6cd734aec9
commit
9b85b6d7e0
|
@ -9,6 +9,9 @@ class WebratController < ApplicationController
|
||||||
def form
|
def form
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def buttons
|
||||||
|
end
|
||||||
|
|
||||||
def submit
|
def submit
|
||||||
render :text => "OK <a href='/' id='link_id'>Test Link Text</a>"
|
render :text => "OK <a href='/' id='link_id'>Test Link Text</a>"
|
||||||
end
|
end
|
||||||
|
|
|
@ -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 %>
|
|
@ -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.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
|
||||||
webrat.show_params "/show_params", :action => "show_params"
|
webrat.show_params "/show_params", :action => "show_params"
|
||||||
|
|
||||||
|
webrat.buttons "/buttons", :action => "buttons"
|
||||||
webrat.root :action => "form"
|
webrat.root :action => "form"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue