forked from brynary/webrat
/
button_click_test.rb
80 lines (73 loc) · 2.16 KB
/
button_click_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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