Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 306 lines (229 sloc) 9.498 kb
423f2e6 @cheezy added button_elements method to ElementLocators
cheezy authored
1 class MultiElementsPage
2 include PageObject
3 end
4
5
6 Given /^I am on the multi elements page$/ do
7 @page = MultiElementsPage.new(@browser)
8 @page.navigate_to(UrlHelper.multi)
9 end
10
11 When /^I select the buttons with class "([^\"]*)"$/ do |class_name|
12 @elements = @page.button_elements(:class => class_name)
13 end
14
15 Then /^I should have (\d+) buttons$/ do |num_buttons|
16 @elements.size.should == num_buttons.to_i
17 end
18
19 Then /^the value of button (\d+) should be "([^\"]*)"$/ do |button_num, value|
20 @elements[button_num.to_i - 1].value.should == value
21 end
f29f21d @cheezy added method to find all text fields based on locator
cheezy authored
22
23 When /^I select the text fields with class "([^\"]*)"$/ do |class_name|
24 @elements = @page.text_field_elements(:class => class_name)
25 end
26
27 Then /^I should have (\d+) text fields$/ do |num_text_fields|
28 @elements.size.should == num_text_fields.to_i
29 end
30
31 Then /^the value of text field (\d+) should be "([^\"]*)"$/ do |text_field_num, value|
32 @elements[text_field_num.to_i - 1].value.should == value
33 end
5d9e8a1 @cheezy added hidden_field_elements to ElementLocators
cheezy authored
34
35 When /^I select the hidden fields with class "([^\"]*)"$/ do |class_name|
36 @elements = @page.hidden_field_elements(:class => class_name)
37 end
38
39 Then /^I should have (\d+) hidden fields$/ do |num_hidden_fields|
40 @elements.size.should == num_hidden_fields.to_i
41 end
42
43 Then /^the value of hidden field (\d+) should be "([^\"]*)"$/ do |hidden_field_num, value|
44 @elements[hidden_field_num.to_i - 1].value.should == value
45 end
388af48 @cheezy added text_area_elements to ElementLocator
cheezy authored
46
eba3b0c @cheezy added select_list_elements to ElementLocators
cheezy authored
47 When /^I select the text areas with class "([^\"]*)"$/ do |class_name|
388af48 @cheezy added text_area_elements to ElementLocator
cheezy authored
48 @elements = @page.text_area_elements(:class => class_name)
49 end
50
51 Then /^I should have (\d+) text areas$/ do |num_text_areas|
52 @elements.size.should == num_text_areas.to_i
53 end
54
55 Then /^the value of text area (\d+) should be "([^\"]*)"$/ do |text_area_num, value|
56 @elements[text_area_num.to_i - 1].value.should == value
57 end
eba3b0c @cheezy added select_list_elements to ElementLocators
cheezy authored
58
59 When /^I select the select lists with class "([^\"]*)"$/ do |class_name|
60 @elements = @page.select_list_elements(:class => class_name)
61 end
62
63 Then /^I should have (\d+) select lists$/ do |num_select_lists|
64 @elements.size.should == num_select_lists.to_i
65 end
66
67 Then /^the value of select list (\d+) should be "([^\"]*)"$/ do |select_list_num, value|
68 @elements[select_list_num.to_i - 1].value.should == value
69 end
6daaef9 @cheezy added link_elements to ElementLocators
cheezy authored
70
71 When /^I select the link with class "([^\"]*)"$/ do |link_class|
72 @elements = @page.link_elements(:class => link_class)
73 end
74
75 Then /^I should have (\d+) links$/ do |num_links|
76 @elements.size.should == num_links.to_i
77 end
78
79 Then /^the text of link (\d+) should be "([^\"]*)"$/ do |link_num, text|
80 @elements[link_num.to_i - 1].text.should == text
81 end
82
8aee14d @cheezy Added checkbox_elements to ElementLocators
cheezy authored
83 When /^I select the check boxes with class "([^\"]*)"$/ do |class_name|
84 @elements = @page.checkbox_elements(:class => class_name)
85 end
86
87 Then /^I should have (\d+) checkboxes$/ do |num_checkboxes|
88 @elements.size.should == num_checkboxes.to_i
89 end
90
91 Then /^the value of checkbox (\d+) should be "([^\"]*)"$/ do |checkbox_num, value|
92 @elements[checkbox_num.to_i - 1].value.should == value
93 end
63b73bc @cheezy added radio_button_elements to ElementLocator
cheezy authored
94
95 When /^I select the radio button with class "([^\"]*)"$/ do |class_name|
96 @elements = @page.radio_button_elements(:class => class_name)
97 end
98
99 Then /^I should have (\d+) radio buttons$/ do |num_radio_buttons|
100 @elements.size.should == num_radio_buttons.to_i
101 end
102
103 Then /^the value of radio button (\d+) should be "([^\"]*)"$/ do |radio_button_num, value|
104 @elements[radio_button_num.to_i - 1].value.should == value
105 end
106
0f54f93 @cheezy added div_elements to ElementLocator
cheezy authored
107 When /^I select the div with class "([^\"]*)"$/ do |class_name|
108 @elements = @page.div_elements(:class => class_name)
109 end
110
111 Then /^I should have (\d+) divs$/ do |num_divs|
112 @elements.size.should == num_divs.to_i
113 end
114
115 Then /^the text of div (\d+) should be "([^\"]*)"$/ do |div_num, text|
116 @elements[div_num.to_i - 1].text.should == text
117 end
118
8965774 @cheezy added span_elements to ElementLocators
cheezy authored
119 When /^I select the spans with class "([^\"]*)"$/ do |class_name|
120 @elements = @page.span_elements(:class => class_name)
121 end
122
123 Then /^I should have (\d+) spans$/ do |num_spans|
124 @elements.size.should == num_spans.to_i
125 end
0f54f93 @cheezy added div_elements to ElementLocator
cheezy authored
126
8965774 @cheezy added span_elements to ElementLocators
cheezy authored
127 Then /^the text of span (\d+) should be "([^\"]*)"$/ do |span_num, text|
128 @elements[span_num.to_i - 1].text.should == text
129 end
6941f26 @cheezy Added cell_elements to ElementLocators
cheezy authored
130
131 When /^I select the tables with class "([^\"]*)"$/ do |class_name|
132 @elements = @page.table_elements(:class => class_name)
133 end
134
135 Then /^I should have (\d+) tables$/ do |num_tables|
136 @elements.size.should == num_tables.to_i
137 end
138
139 Then /^the first row first column for table (\d+) should have "([^\"]*)"$/ do |table_num, text|
140 @elements[table_num.to_i - 1][0][0].text.should == text
141 end
142
143 When /^I select the cells with class "([^\"]*)"$/ do |cell_class|
144 @elements = @page.cell_elements(:class => cell_class)
145 end
146
147 Then /^I should have (\d+) cells$/ do |num_cells|
148 @elements.size.should == num_cells.to_i
149 end
150
151 Then /^the text for cell (\d+) should be "([^\"]*)"$/ do |cell_num, text|
152 @elements[cell_num.to_i - 1].text.should == text
153 end
d3f6c8a @cheezy Added image_elements to ElementLocators
cheezy authored
154
155 When /^I select the images with class "([^\"]*)"$/ do |class_name|
156 @elements = @page.image_elements(:class => class_name)
157 end
158
159 Then /^I should have (\d+) images$/ do |num_images|
160 @elements.size.should == num_images.to_i
161 end
162
163 Then /^the alt for image (\d+) should be "([^\"]*)"$/ do |image_num, alt|
164 @elements[image_num.to_i - 1].attribute(:alt).should == alt
165 end
01d2a27 @cheezy added form_elements to ElementLocators
cheezy authored
166
167 When /^I select the forms with class "([^\"]*)"$/ do |class_name|
168 @elements = @page.form_elements(:class => class_name)
169 end
170
171 Then /^I should have (\d+) forms$/ do |number|
172 @elements.size.should == number.to_i
173 end
174
175 Then /^the action for form (\d+) should be "([^\"]*)"$/ do |form_number, action|
176 @elements[form_number.to_i-1].attribute(:action).should match action
177 end
54bd501 @cheezy Added #list_item_elements to ElementLocator
cheezy authored
178
179 When /^I select the list items with class "([^\"]*)"$/ do |class_name|
180 @elements = @page.list_item_elements(:class => class_name)
181 end
182
183 Then /^I should have (\d+) list items$/ do |num_list_items|
184 @elements.size.should == num_list_items.to_i
185 end
186
187 Then /^the text for list item (\d+) should be "([^\"]*)"$/ do |list_item_num, text|
188 @elements[list_item_num.to_i - 1].text.should == text
189 end
f79496c @cheezy Added unordered_list_elements to ElementLocators
cheezy authored
190
191 When /^I select the unordered list with class "([^\"]*)"$/ do |class_name|
192 @elements = @page.unordered_list_elements(:class => class_name)
193 end
194
195 Then /^I should have (\d+) unordered lists$/ do |num_unordered_lists|
196 @elements.size.should == num_unordered_lists.to_i
197 end
198
199 Then /^the text for the first item in unordered list (\d+) should be "([^\"]*)"$/ do |ul_num, text|
200 @elements[ul_num.to_i - 1][0].text.should == text
201 end
3095d22 @cheezy Added ordered_list_elements to ElementLocator
cheezy authored
202
203 When /^I select the ordered lists with class "([^\"]*)"$/ do |class_name|
204 @elements = @page.ordered_list_elements(:class => class_name)
205 end
206
207 Then /^I should have (\d+) ordered lists$/ do |num_ol|
208 @elements.size.should == num_ol.to_i
209 end
210
211 Then /^the text for the first item in ordered list (\d+) should be "([^\"]*)"$/ do |ol_num, text|
212 @elements[ol_num.to_i - 1][0].text.should == text
213 end
aa6dc9b @cheezy added h1_elements to ElementLocator
cheezy authored
214
215 When /^I select the h1s with class "([^\"]*)"$/ do |class_name|
216 @elements = @page.h1_elements(:class => class_name)
217 end
218
219 Then /^I should have (\d+) h1s$/ do |num_h1s|
220 @elements.size.should == num_h1s.to_i
221 end
222
223 Then /^the text for h1 (\d+) should be "([^\"]*)"$/ do |h1_num, text|
224 @elements[h1_num.to_i - 1].text.should == text
225 end
ba73f0b @cheezy added h2_elements
cheezy authored
226
227 When /^I select the h2s with the class "([^\"]*)"$/ do |class_name|
228 @elements = @page.h2_elements(:class => class_name)
229 end
230
231 Then /^I should have (\d+) h2s$/ do |num_h2s|
232 @elements.size.should == num_h2s.to_i
233 end
234
235 Then /^the text for h2 (\d+) should be "([^\"]*)"$/ do |h2_num, text|
236 @elements[h2_num.to_i - 1].text.should == text
237 end
9cf5a32 @cheezy added h3_elements
cheezy authored
238
239 When /^I select the h3s with the class "([^\"]*)"$/ do |class_name|
240 @elements = @page.h3_elements(:class => class_name)
241 end
242
243 Then /^I should have (\d+) h3s$/ do |num_h3s|
244 @elements.size.should == num_h3s.to_i
245 end
246
247 Then /^the text for h3 (\d+) should be "([^\"]*)"$/ do |h3_num, text|
248 @elements[h3_num.to_i - 1].text.should == text
249 end
ed11803 @cheezy Added h4_elements to ElementLocator
cheezy authored
250
251 When /^I select the h4s with the class "([^\"]*)"$/ do |class_name|
252 @elements = @page.h4_elements(:class => class_name)
253 end
254
255 Then /^I should have (\d+) h4s$/ do |num_h4s|
256 @elements.size.should == num_h4s.to_i
257 end
258
259 Then /^the text for H4 (\d+) should be "([^\"]*)"$/ do |h4_num, text|
260 @elements[h4_num.to_i - 1].text.should == text
261 end
aff81a5 @cheezy Added h5_elements to ElementLocator
cheezy authored
262
263 When /^I select the h5s with the class "([^\"]*)"$/ do |class_name|
264 @elements = @page.h5_elements(:class => class_name)
265 end
266
267 Then /^I should have (\d+) h5s$/ do |num_h5s|
268 @elements.size.should == num_h5s.to_i
269 end
270
271 Then /^the text for H5 (\d+) should be "([^\"]*)"$/ do |h5_num, text|
272 @elements[h5_num.to_i - 1].text.should == text
273 end
87f992d @cheezy Added h6_elements to ElementLocator
cheezy authored
274
275 When /^I select the h6s with the class "([^\"]*)"$/ do |class_name|
276 @elements = @page.h6_elements(:class => class_name)
277 end
278
279 Then /^I should have (\d+) h6s$/ do |num_h6s|
280 @elements.size.should == num_h6s.to_i
281 end
282
283 Then /^the text for H6 (\d+) should be "([^\"]*)"$/ do |h6_num, text|
284 @elements[h6_num.to_i - 1].text.should == text
285 end
1ad3ca4 @cheezy added paragraph_elements to ElementLocators
cheezy authored
286
287 When /^I select the paragraph with class "([^\"]*)"$/ do |class_name|
288 @elements = @page.paragraph_elements(:class => class_name)
289 end
290
291 Then /^I should have (\d+) paragraphs$/ do |num_paragraphs|
292 @elements.size.should == num_paragraphs.to_i
293 end
294
295 Then /^the text for paragraph (\d+) should be "([^\"]*)"$/ do |para_num, text|
296 @elements[para_num.to_i - 1].text.should == text
297 end
7cafb0d @cheezy added default empty hash parameter for button_elements element locator
cheezy authored
298
299 Then /^I should be able to find (\d+) buttons using no identifier$/ do |num_buttons|
300 @page.button_elements.size.should == num_buttons.to_i
301 end
1660eaa @cheezy added empty hash as default parameter to text_field_elements
cheezy authored
302
303 Then /^I should be able to find (\d+) text fields using no identifier$/ do |num_text_fields|
304 @page.text_field_elements.size.should == num_text_fields.to_i
305 end
Something went wrong with that request. Please try again.