watir-webdriver 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +9 -0
- data/Gemfile +3 -3
- data/Rakefile +3 -28
- data/lib/watir-webdriver.rb +1 -0
- data/lib/watir-webdriver/version.rb +3 -0
- data/watir-webdriver.gemspec +23 -247
- metadata +34 -326
- data/VERSION +0 -1
- data/spec/watirspec/area_spec.rb +0 -77
- data/spec/watirspec/areas_spec.rb +0 -45
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -255
- data/spec/watirspec/buttons_spec.rb +0 -58
- data/spec/watirspec/checkbox_spec.rb +0 -276
- data/spec/watirspec/checkboxes_spec.rb +0 -47
- data/spec/watirspec/collections_spec.rb +0 -20
- data/spec/watirspec/dd_spec.rb +0 -127
- data/spec/watirspec/dds_spec.rb +0 -45
- data/spec/watirspec/del_spec.rb +0 -145
- data/spec/watirspec/dels_spec.rb +0 -45
- data/spec/watirspec/div_spec.rb +0 -221
- data/spec/watirspec/divs_spec.rb +0 -45
- data/spec/watirspec/dl_spec.rb +0 -137
- data/spec/watirspec/dls_spec.rb +0 -46
- data/spec/watirspec/dt_spec.rb +0 -127
- data/spec/watirspec/dts_spec.rb +0 -45
- data/spec/watirspec/element_spec.rb +0 -149
- data/spec/watirspec/em_spec.rb +0 -101
- data/spec/watirspec/ems_spec.rb +0 -46
- data/spec/watirspec/filefield_spec.rb +0 -156
- data/spec/watirspec/filefields_spec.rb +0 -46
- data/spec/watirspec/font_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -47
- data/spec/watirspec/frame_spec.rb +0 -144
- data/spec/watirspec/frames_spec.rb +0 -83
- data/spec/watirspec/hidden_spec.rb +0 -103
- data/spec/watirspec/hiddens_spec.rb +0 -46
- data/spec/watirspec/hn_spec.rb +0 -97
- data/spec/watirspec/hns_spec.rb +0 -42
- data/spec/watirspec/image_spec.rb +0 -208
- data/spec/watirspec/images_spec.rb +0 -45
- data/spec/watirspec/ins_spec.rb +0 -146
- data/spec/watirspec/inses_spec.rb +0 -45
- data/spec/watirspec/label_spec.rb +0 -81
- data/spec/watirspec/labels_spec.rb +0 -45
- data/spec/watirspec/li_spec.rb +0 -116
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/implementation.rb +0 -48
- data/spec/watirspec/lib/runner.rb +0 -83
- data/spec/watirspec/lib/server.rb +0 -194
- data/spec/watirspec/lib/watirspec.rb +0 -75
- data/spec/watirspec/link_spec.rb +0 -174
- data/spec/watirspec/links_spec.rb +0 -49
- data/spec/watirspec/lis_spec.rb +0 -45
- data/spec/watirspec/map_spec.rb +0 -80
- data/spec/watirspec/maps_spec.rb +0 -46
- data/spec/watirspec/meta_spec.rb +0 -24
- data/spec/watirspec/metas_spec.rb +0 -43
- data/spec/watirspec/ol_spec.rb +0 -90
- data/spec/watirspec/ols_spec.rb +0 -45
- data/spec/watirspec/option_spec.rb +0 -152
- data/spec/watirspec/p_spec.rb +0 -132
- data/spec/watirspec/pre_spec.rb +0 -116
- data/spec/watirspec/pres_spec.rb +0 -45
- data/spec/watirspec/ps_spec.rb +0 -45
- data/spec/watirspec/radio_spec.rb +0 -262
- data/spec/watirspec/radios_spec.rb +0 -46
- data/spec/watirspec/select_list_spec.rb +0 -335
- data/spec/watirspec/select_lists_spec.rb +0 -49
- data/spec/watirspec/span_spec.rb +0 -146
- data/spec/watirspec/spans_spec.rb +0 -45
- data/spec/watirspec/spec_helper.rb +0 -20
- data/spec/watirspec/strong_spec.rb +0 -93
- data/spec/watirspec/strongs_spec.rb +0 -46
- data/spec/watirspec/table_nesting_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -150
- data/spec/watirspec/tables_spec.rb +0 -47
- data/spec/watirspec/tbody_spec.rb +0 -97
- data/spec/watirspec/tbodys_spec.rb +0 -65
- data/spec/watirspec/td_spec.rb +0 -72
- data/spec/watirspec/tds_spec.rb +0 -60
- data/spec/watirspec/text_field_spec.rb +0 -283
- data/spec/watirspec/text_fields_spec.rb +0 -49
- data/spec/watirspec/tfoot_spec.rb +0 -92
- data/spec/watirspec/tfoots_spec.rb +0 -71
- data/spec/watirspec/thead_spec.rb +0 -92
- data/spec/watirspec/theads_spec.rb +0 -71
- data/spec/watirspec/tr_spec.rb +0 -88
- data/spec/watirspec/trs_spec.rb +0 -68
- data/spec/watirspec/ul_spec.rb +0 -80
- data/spec/watirspec/uls_spec.rb +0 -44
- data/spec/watirspec/window_switching_spec.rb +0 -164
data/spec/watirspec/em_spec.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Em" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the element exists" do
|
13
|
-
browser.em(:id, "important-id").should exist
|
14
|
-
browser.em(:class, "important-class").should exist
|
15
|
-
browser.em(:xpath, "//em[@id='important-id']").should exist
|
16
|
-
browser.em(:index, 0).should exist
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns the first em if given no args" do
|
20
|
-
browser.em.should exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "returns false if the element does not exist" do
|
24
|
-
browser.em(:id, "no_such_id").should_not exist
|
25
|
-
end
|
26
|
-
|
27
|
-
it "raises TypeError when 'what' argument is invalid" do
|
28
|
-
lambda { browser.em(:id, 3.14).exists? }.should raise_error(TypeError)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
32
|
-
lambda { browser.em(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Attribute methods
|
37
|
-
describe "#class_name" do
|
38
|
-
it "returns the class attribute if the element exists" do
|
39
|
-
browser.em(:id, "important-id").class_name.should == "important-class"
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises UnknownObjectException if the element does not exist" do
|
43
|
-
lambda { browser.em(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
|
44
|
-
lambda { browser.em(:title, "no_such_title").class_name }.should raise_error(UnknownObjectException)
|
45
|
-
lambda { browser.em(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
46
|
-
lambda { browser.em(:xpath, "//em[@id='no_such_id']").class_name }.should raise_error(UnknownObjectException)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#id" do
|
51
|
-
it "returns the id attribute if the element exists" do
|
52
|
-
browser.em(:class, 'important-class').id.should == "important-id"
|
53
|
-
end
|
54
|
-
|
55
|
-
it "raises UnknownObjectException if the element does not exist" do
|
56
|
-
lambda {browser.em(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
57
|
-
lambda {browser.em(:title, "no_such_id").id }.should raise_error(UnknownObjectException)
|
58
|
-
lambda {browser.em(:index, 1337).id }.should raise_error(UnknownObjectException)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#title" do
|
63
|
-
it "returns the title of the element" do
|
64
|
-
browser.em(:class, "important-class").title.should == "ergo cogito"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "#text" do
|
69
|
-
it "returns the text of the element" do
|
70
|
-
browser.em(:id, "important-id").text.should == "ergo cogito"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "raises UnknownObjectException if the element does not exist" do
|
74
|
-
lambda { browser.em(:id, "no_such_id").text }.should raise_error(UnknownObjectException)
|
75
|
-
lambda { browser.em(:title, "no_such_title").text }.should raise_error(UnknownObjectException)
|
76
|
-
lambda { browser.em(:index, 1337).text }.should raise_error(UnknownObjectException)
|
77
|
-
lambda { browser.em(:xpath, "//em[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe "#respond_to?" do
|
82
|
-
it "returns true for all attribute methods" do
|
83
|
-
browser.em(:index, 0).should respond_to(:id)
|
84
|
-
browser.em(:index, 0).should respond_to(:class_name)
|
85
|
-
browser.em(:index, 0).should respond_to(:style)
|
86
|
-
browser.em(:index, 0).should respond_to(:text)
|
87
|
-
browser.em(:index, 0).should respond_to(:title)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
# Manipulation methods
|
92
|
-
describe "#click" do
|
93
|
-
it "raises UnknownObjectException if the element does not exist" do
|
94
|
-
lambda { browser.em(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
95
|
-
lambda { browser.em(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
96
|
-
lambda { browser.em(:index, 1337).click }.should raise_error(UnknownObjectException)
|
97
|
-
lambda { browser.em(:xpath, "//em[@id='no_such_id']").click }.should raise_error(UnknownObjectException)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
data/spec/watirspec/ems_spec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Ems" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.ems(:class => "important-class").to_a.should == [browser.em(:class => "important-class")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of ems" do
|
20
|
-
browser.ems.length.should == 1
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the em at the given index" do
|
26
|
-
browser.ems[0].id.should == "important-id"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through ems correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.ems.each_with_index do |e, index|
|
35
|
-
e.text.should == browser.em(:index, index).text
|
36
|
-
e.id.should == browser.em(:index, index).id
|
37
|
-
e.class_name.should == browser.em(:index, index).class_name
|
38
|
-
|
39
|
-
count += 1
|
40
|
-
end
|
41
|
-
|
42
|
-
count.should > 0
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,156 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "FileField" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#exist?" do
|
11
|
-
it "returns true if the file field exists" do
|
12
|
-
browser.file_field(:id, 'new_user_portrait').should exist
|
13
|
-
browser.file_field(:id, /new_user_portrait/).should exist
|
14
|
-
browser.file_field(:name, 'new_user_portrait').should exist
|
15
|
-
browser.file_field(:name, /new_user_portrait/).should exist
|
16
|
-
browser.file_field(:class, 'portrait').should exist
|
17
|
-
browser.file_field(:class, /portrait/).should exist
|
18
|
-
browser.file_field(:index, 0).should exist
|
19
|
-
browser.file_field(:xpath, "//input[@id='new_user_portrait']").should exist
|
20
|
-
end
|
21
|
-
|
22
|
-
it "returns the first file field if given no args" do
|
23
|
-
browser.file_field.should exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns false if the file field doesn't exist" do
|
27
|
-
browser.file_field(:id, 'no_such_id').should_not exist
|
28
|
-
browser.file_field(:id, /no_such_id/).should_not exist
|
29
|
-
browser.file_field(:name, 'no_such_name').should_not exist
|
30
|
-
browser.file_field(:name, /no_such_name/).should_not exist
|
31
|
-
browser.file_field(:class, 'no_such_class').should_not exist
|
32
|
-
browser.file_field(:class, /no_such_class/).should_not exist
|
33
|
-
browser.file_field(:index, 1337).should_not exist
|
34
|
-
browser.file_field(:xpath, "//input[@id='no_such_id']").should_not exist
|
35
|
-
end
|
36
|
-
|
37
|
-
it "raises TypeError when 'what' argument is invalid" do
|
38
|
-
lambda { browser.file_field(:id, 3.14).exists? }.should raise_error(TypeError)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
42
|
-
lambda { browser.file_field(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Attribute methods
|
47
|
-
|
48
|
-
describe "#class_name" do
|
49
|
-
it "returns the class attribute if the text field exists" do
|
50
|
-
browser.file_field(:index, 0).class_name.should == "portrait"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "raises UnknownObjectException if the text field doesn't exist" do
|
54
|
-
lambda { browser.file_field(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "#id" do
|
59
|
-
it "returns the id attribute if the text field exists" do
|
60
|
-
browser.file_field(:index, 0).id.should == "new_user_portrait"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "raises UnknownObjectException if the text field doesn't exist" do
|
64
|
-
lambda { browser.file_field(:index, 1337).id }.should raise_error(UnknownObjectException)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "#name" do
|
69
|
-
it "returns the name attribute if the text field exists" do
|
70
|
-
browser.file_field(:index, 0).name.should == "new_user_portrait"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "raises UnknownObjectException if the text field doesn't exist" do
|
74
|
-
lambda { browser.file_field(:index, 1337).name }.should raise_error(UnknownObjectException)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe "#title" do
|
79
|
-
it "returns the title attribute if the text field exists" do
|
80
|
-
browser.file_field(:id, "new_user_portrait").title.should == "Smile!"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "#type" do
|
85
|
-
it "returns the type attribute if the text field exists" do
|
86
|
-
browser.file_field(:index, 0).type.should == "file"
|
87
|
-
end
|
88
|
-
|
89
|
-
it "raises UnknownObjectException if the text field doesn't exist" do
|
90
|
-
lambda { browser.file_field(:index, 1337).type }.should raise_error(UnknownObjectException)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "#respond_to?" do
|
95
|
-
it "returns true for all attribute methods" do
|
96
|
-
browser.file_field(:index, 0).should respond_to(:class_name)
|
97
|
-
browser.file_field(:index, 0).should respond_to(:id)
|
98
|
-
browser.file_field(:index, 0).should respond_to(:name)
|
99
|
-
browser.file_field(:index, 0).should respond_to(:title)
|
100
|
-
browser.file_field(:index, 0).should respond_to(:type)
|
101
|
-
browser.file_field(:index, 0).should respond_to(:value)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# Manipulation methods
|
106
|
-
|
107
|
-
describe "#set" do
|
108
|
-
it "is able to set a file path in the field and click the upload button and fire the onchange event" do
|
109
|
-
browser.goto("#{WatirSpec.host}/forms_with_input_elements.html")
|
110
|
-
|
111
|
-
path = File.expand_path(__FILE__)
|
112
|
-
element = browser.file_field(:name, "new_user_portrait")
|
113
|
-
|
114
|
-
element.set path
|
115
|
-
|
116
|
-
element.value.should include(File.basename(path)) # only some browser will return the full path
|
117
|
-
messages.first.should include(File.basename(path))
|
118
|
-
|
119
|
-
browser.button(:name, "new_user_submit").click
|
120
|
-
end
|
121
|
-
|
122
|
-
it "raises an error if the file does not exist" do
|
123
|
-
lambda {
|
124
|
-
browser.file_field.set('/tmp/unlikely-to-exist')
|
125
|
-
}.should raise_error(Errno::ENOENT)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
|
-
describe "#value=" do
|
131
|
-
it "is able to set a file path in the field and click the upload button and fire the onchange event" do
|
132
|
-
browser.goto("#{WatirSpec.host}/forms_with_input_elements.html")
|
133
|
-
|
134
|
-
path = File.expand_path(__FILE__)
|
135
|
-
element = browser.file_field(:name, "new_user_portrait")
|
136
|
-
|
137
|
-
element.value = path
|
138
|
-
element.value.should include(File.basename(path)) # only some browser will return the full path
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
not_compliant_on [:webdriver, :ie] do
|
143
|
-
it "does not raise an error if the file does not exist" do
|
144
|
-
browser.file_field.value = '/tmp/unlikely-to-exist'
|
145
|
-
browser.file_field.value.should == '/tmp/unlikely-to-exist'
|
146
|
-
end
|
147
|
-
|
148
|
-
it "does not alter its argument" do
|
149
|
-
value = '/foo/bar'
|
150
|
-
browser.file_field.value = value
|
151
|
-
value.should == '/foo/bar'
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "FileFields" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.file_fields(:class => "portrait").to_a.should == [browser.file_field(:class => "portrait")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the correct number of file fields" do
|
20
|
-
browser.file_fields.length.should == 2
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the file field at the given index" do
|
26
|
-
browser.file_fields[0].id.should == "new_user_portrait"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through file fields correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.file_fields.each_with_index do |f, index|
|
35
|
-
f.name.should == browser.file_field(:index, index).name
|
36
|
-
f.id.should == browser.file_field(:index, index).id
|
37
|
-
f.value.should == browser.file_field(:index, index).value
|
38
|
-
|
39
|
-
count += 1
|
40
|
-
end
|
41
|
-
|
42
|
-
count.should > 0
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
data/spec/watirspec/font_spec.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Font" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/font.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/29", :celerity do
|
11
|
-
it "finds the font element" do
|
12
|
-
browser.font(:index, 0).should exist
|
13
|
-
end
|
14
|
-
|
15
|
-
it "knows about the color attribute" do
|
16
|
-
browser.font(:index, 0).color.should == "#ff00ff"
|
17
|
-
end
|
18
|
-
|
19
|
-
it "knows about the face attribute" do
|
20
|
-
browser.font(:index, 0).face.should == "Helvetica"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "knows about the size attribute" do
|
24
|
-
browser.font(:index, 0).size.should == "12"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "finds all font elements" do
|
28
|
-
browser.fonts.size.should == 1
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
data/spec/watirspec/form_spec.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Form" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#exists?" do
|
11
|
-
it "returns true if the form exists" do
|
12
|
-
browser.form(:id, 'new_user').should exist
|
13
|
-
browser.form(:id, /new_user/).should exist
|
14
|
-
|
15
|
-
browser.form(:class, 'user').should exist
|
16
|
-
browser.form(:class, /user/).should exist
|
17
|
-
|
18
|
-
browser.form(:method, 'post').should exist
|
19
|
-
browser.form(:method, /post/).should exist
|
20
|
-
browser.form(:action, 'post_to_me').should exist
|
21
|
-
browser.form(:action, /to_me/).should exist
|
22
|
-
browser.form(:index, 0).should exist
|
23
|
-
browser.form(:xpath, "//form[@id='new_user']").should exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "returns the first form if given no args" do
|
27
|
-
browser.form.should exist
|
28
|
-
end
|
29
|
-
|
30
|
-
it "returns false if the form doesn't exist" do
|
31
|
-
browser.form(:id, 'no_such_id').should_not exist
|
32
|
-
browser.form(:id, /no_such_id/).should_not exist
|
33
|
-
|
34
|
-
browser.form(:class, 'no_such_class').should_not exist
|
35
|
-
browser.form(:class, /no_such_class/).should_not exist
|
36
|
-
|
37
|
-
browser.form(:method, 'no_such_method').should_not exist
|
38
|
-
browser.form(:method, /no_such_method/).should_not exist
|
39
|
-
browser.form(:action, 'no_such_action').should_not exist
|
40
|
-
browser.form(:action, /no_such_action/).should_not exist
|
41
|
-
browser.form(:index, 1337).should_not exist
|
42
|
-
browser.form(:xpath, "//form[@id='no_such_id']").should_not exist
|
43
|
-
end
|
44
|
-
|
45
|
-
it "raises TypeError when 'what' argument is invalid" do
|
46
|
-
lambda { browser.form(:id, 3.14).exists? }.should raise_error(TypeError)
|
47
|
-
end
|
48
|
-
|
49
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
50
|
-
lambda { browser.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#submit" do
|
55
|
-
not_compliant_on :celerity do
|
56
|
-
it "submits the form" do
|
57
|
-
browser.form(:id, "delete_user").submit
|
58
|
-
browser.text.should include("Semantic table")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|