druid-s 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +27 -0
- data/ChangeLog +541 -0
- data/Gemfile +8 -0
- data/README.md +78 -0
- data/Rakefile +33 -0
- data/cucumber.yml +6 -0
- data/druid.gemspec +30 -0
- data/features/area.feature +33 -0
- data/features/async.feature +16 -0
- data/features/audio.feature +61 -0
- data/features/bold.feature +20 -0
- data/features/button.feature +81 -0
- data/features/canvas.feature +34 -0
- data/features/checkbox.feature +48 -0
- data/features/div.feature +45 -0
- data/features/element.feature +281 -0
- data/features/file_field.feature +38 -0
- data/features/form.feature +37 -0
- data/features/frames.feature +76 -0
- data/features/generic_elements.feature +29 -0
- data/features/heading.feature +160 -0
- data/features/hidden_field.feature +39 -0
- data/features/html/async.html +31 -0
- data/features/html/frame_1.html +18 -0
- data/features/html/frame_2.html +16 -0
- data/features/html/frame_3.html +14 -0
- data/features/html/frames.html +12 -0
- data/features/html/hover.html +11 -0
- data/features/html/iframes.html +12 -0
- data/features/html/images/circle.png +0 -0
- data/features/html/images/img_pulpit.jpg +0 -0
- data/features/html/modal.html +17 -0
- data/features/html/modal_1.html +38 -0
- data/features/html/modal_2.html +27 -0
- data/features/html/multi_elements.html +145 -0
- data/features/html/nested_elements.html +75 -0
- data/features/html/nested_frame_1.html +1 -0
- data/features/html/nested_frame_2.html +11 -0
- data/features/html/nested_frame_3.html +14 -0
- data/features/html/nested_frames.html +10 -0
- data/features/html/planets.gif +0 -0
- data/features/html/static_elements.html +203 -0
- data/features/html/success.html +8 -0
- data/features/html/sun.gif +0 -0
- data/features/html/sun.html +7 -0
- data/features/image.feature +47 -0
- data/features/italic.feature +20 -0
- data/features/javascript.feature +28 -0
- data/features/label.feature +43 -0
- data/features/link.feature +56 -0
- data/features/list_item.feature +37 -0
- data/features/modal_dialog.feature +9 -0
- data/features/multi_elements.feature +498 -0
- data/features/nested_elements.feature +121 -0
- data/features/ordered_list.feature +46 -0
- data/features/page_level_actions.feature +116 -0
- data/features/paragraph.feature +33 -0
- data/features/populate_page_with.feature +25 -0
- data/features/radio_button.feature +51 -0
- data/features/radio_button_group.feature +28 -0
- data/features/sample-app/public/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/sample-app/public/04-Death_Becomes_Fur.oga +0 -0
- data/features/sample-app/public/audio_video.html +19 -0
- data/features/sample-app/public/jquery-1.3.2.js +4376 -0
- data/features/sample-app/public/jquery.html +28 -0
- data/features/sample-app/public/movie.mp4 +0 -0
- data/features/sample-app/public/movie.ogg +0 -0
- data/features/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/features/sample-app/public/prototype.html +32 -0
- data/features/sample-app/sample_app.rb +35 -0
- data/features/section.feature +132 -0
- data/features/select_list.feature +84 -0
- data/features/span.feature +43 -0
- data/features/step_definations/area_steps.rb +23 -0
- data/features/step_definations/async_steps.rb +80 -0
- data/features/step_definations/audio_steps.rb +47 -0
- data/features/step_definations/bold_steps.rb +11 -0
- data/features/step_definations/button_steps.rb +52 -0
- data/features/step_definations/canvas_steps.rb +19 -0
- data/features/step_definations/checkbox_steps.rb +39 -0
- data/features/step_definations/div_steps.rb +28 -0
- data/features/step_definations/element_steps.rb +217 -0
- data/features/step_definations/file_field_steps.rb +31 -0
- data/features/step_definations/form_steps.rb +23 -0
- data/features/step_definations/frame_steps.rb +189 -0
- data/features/step_definations/generic_element_steps.rb +31 -0
- data/features/step_definations/heading_steps.rb +39 -0
- data/features/step_definations/hidden_field_steps.rb +27 -0
- data/features/step_definations/image_steps.rb +35 -0
- data/features/step_definations/italic_steps.rb +11 -0
- data/features/step_definations/javasript_steps.rb +52 -0
- data/features/step_definations/label_steps.rb +19 -0
- data/features/step_definations/link_steps.rb +42 -0
- data/features/step_definations/list_item_steps.rb +24 -0
- data/features/step_definations/modal_dialog_steps.rb +38 -0
- data/features/step_definations/multi_elements_steps.rb +557 -0
- data/features/step_definations/nested_elements_steps.rb +219 -0
- data/features/step_definations/ordered_list_steps.rb +49 -0
- data/features/step_definations/page_level_actions_steps.rb +172 -0
- data/features/step_definations/page_traversal_steps.rb +4 -0
- data/features/step_definations/paragraph_steps.rb +19 -0
- data/features/step_definations/populate_page_with_steps.rb +3 -0
- data/features/step_definations/radio_button_group_steps.rb +32 -0
- data/features/step_definations/radio_button_steps.rb +31 -0
- data/features/step_definations/section_steps.rb +271 -0
- data/features/step_definations/select_list_steps.rb +91 -0
- data/features/step_definations/span_steps.rb +23 -0
- data/features/step_definations/table_cell_steps.rb +27 -0
- data/features/step_definations/table_row_steps.rb +23 -0
- data/features/step_definations/table_steps.rb +109 -0
- data/features/step_definations/text_area_steps.rb +39 -0
- data/features/step_definations/text_field_steps.rb +39 -0
- data/features/step_definations/unordered_list_steps.rb +27 -0
- data/features/step_definations/video_steps.rb +27 -0
- data/features/support/ajax_test_environment.rb +26 -0
- data/features/support/audio_video_page.rb +23 -0
- data/features/support/env.rb +5 -0
- data/features/support/hooks.rb +3 -0
- data/features/support/page.rb +372 -0
- data/features/support/persistent_browser.rb +58 -0
- data/features/support/targets/firefox14_osx.rb +5 -0
- data/features/support/targets/firefox14_windows7.rb +5 -0
- data/features/support/url_helper.rb +50 -0
- data/features/table.feature +127 -0
- data/features/table_cell.feature +42 -0
- data/features/table_row.feature +30 -0
- data/features/text_area.feature +44 -0
- data/features/text_field.feature +53 -0
- data/features/unordered_list.feature +46 -0
- data/features/video.feature +66 -0
- data/lib/druid/accessors.rb +1082 -0
- data/lib/druid/assist.rb +653 -0
- data/lib/druid/element_locators.rb +21 -0
- data/lib/druid/elements/area.rb +9 -0
- data/lib/druid/elements/audio.rb +9 -0
- data/lib/druid/elements/bold.rb +8 -0
- data/lib/druid/elements/button.rb +12 -0
- data/lib/druid/elements/canvas.rb +9 -0
- data/lib/druid/elements/check_box.rb +9 -0
- data/lib/druid/elements/div.rb +9 -0
- data/lib/druid/elements/element.rb +187 -0
- data/lib/druid/elements/file_field.rb +9 -0
- data/lib/druid/elements/form.rb +9 -0
- data/lib/druid/elements/heading.rb +14 -0
- data/lib/druid/elements/hidden_field.rb +9 -0
- data/lib/druid/elements/image.rb +9 -0
- data/lib/druid/elements/italic.rb +9 -0
- data/lib/druid/elements/label.rb +8 -0
- data/lib/druid/elements/link.rb +9 -0
- data/lib/druid/elements/list_item.rb +9 -0
- data/lib/druid/elements/media.rb +11 -0
- data/lib/druid/elements/option.rb +9 -0
- data/lib/druid/elements/ordered_list.rb +29 -0
- data/lib/druid/elements/paragraph.rb +9 -0
- data/lib/druid/elements/radio_button.rb +9 -0
- data/lib/druid/elements/select_list.rb +30 -0
- data/lib/druid/elements/span.rb +9 -0
- data/lib/druid/elements/table.rb +92 -0
- data/lib/druid/elements/table_cell.rb +11 -0
- data/lib/druid/elements/table_row.rb +50 -0
- data/lib/druid/elements/text_area.rb +10 -0
- data/lib/druid/elements/text_field.rb +11 -0
- data/lib/druid/elements/unordered_list.rb +32 -0
- data/lib/druid/elements/video.rb +8 -0
- data/lib/druid/elements.rb +55 -0
- data/lib/druid/javascript/angularjs.rb +12 -0
- data/lib/druid/javascript/jquery.rb +12 -0
- data/lib/druid/javascript/prototype.rb +12 -0
- data/lib/druid/javascript/yui.rb +19 -0
- data/lib/druid/javascript_framework_facade.rb +76 -0
- data/lib/druid/locator_generator.rb +181 -0
- data/lib/druid/nested_elements.rb +56 -0
- data/lib/druid/page_factory.rb +115 -0
- data/lib/druid/page_populator.rb +104 -0
- data/lib/druid/section_collection.rb +17 -0
- data/lib/druid/version.rb +3 -0
- data/lib/druid.rb +452 -0
- data/spec/druid/accessors_spec.rb +1209 -0
- data/spec/druid/druid_spec.rb +295 -0
- data/spec/druid/element_locators_spec.rb +750 -0
- data/spec/druid/elements/bold_spec.rb +12 -0
- data/spec/druid/elements/button_spec.rb +23 -0
- data/spec/druid/elements/check_box_spec.rb +14 -0
- data/spec/druid/elements/div_spec.rb +10 -0
- data/spec/druid/elements/element_spec.rb +250 -0
- data/spec/druid/elements/file_field_spec.rb +13 -0
- data/spec/druid/elements/form_spec.rb +18 -0
- data/spec/druid/elements/heading_spec.rb +30 -0
- data/spec/druid/elements/hidden_field_spec.rb +10 -0
- data/spec/druid/elements/image_spec.rb +23 -0
- data/spec/druid/elements/itatic_spec.rb +11 -0
- data/spec/druid/elements/label_spec.rb +10 -0
- data/spec/druid/elements/link_spec.rb +10 -0
- data/spec/druid/elements/list_item_spec.rb +10 -0
- data/spec/druid/elements/media_spec.rb +12 -0
- data/spec/druid/elements/option_spec.rb +21 -0
- data/spec/druid/elements/ordered_list_spec.rb +38 -0
- data/spec/druid/elements/page_factory_spec.rb +40 -0
- data/spec/druid/elements/paragraph_spec.rb +12 -0
- data/spec/druid/elements/radio_button_spec.rb +14 -0
- data/spec/druid/elements/select_list_spec.rb +51 -0
- data/spec/druid/elements/span_spec.rb +10 -0
- data/spec/druid/elements/table_cell_spec.rb +14 -0
- data/spec/druid/elements/table_row_spec.rb +34 -0
- data/spec/druid/elements/table_spec.rb +47 -0
- data/spec/druid/elements/text_area_spec.rb +13 -0
- data/spec/druid/elements/text_field_spec.rb +22 -0
- data/spec/druid/elements/unordered_list_spec.rb +39 -0
- data/spec/druid/javascript_framework_facade_spec.rb +59 -0
- data/spec/druid/nested_element_spec.rb +128 -0
- data/spec/druid/page_factory_spec.rb +235 -0
- data/spec/druid/page_populator_spec.rb +173 -0
- data/spec/druid/page_section_spec.rb +70 -0
- data/spec/spec_helper.rb +9 -0
- metadata +517 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
class Container
|
|
2
|
+
include Druid
|
|
3
|
+
|
|
4
|
+
link(:section_link)
|
|
5
|
+
button(:section_button)
|
|
6
|
+
text_field(:section_text_field)
|
|
7
|
+
hidden_field(:section_hidden_field)
|
|
8
|
+
text_area(:section_text_area)
|
|
9
|
+
select_list(:section_select_list)
|
|
10
|
+
file_field(:section_file_field)
|
|
11
|
+
checkbox(:section_checkbox)
|
|
12
|
+
radio_button(:section_radio_button)
|
|
13
|
+
div(:section_div)
|
|
14
|
+
span(:section_span)
|
|
15
|
+
table(:section_table)
|
|
16
|
+
cell(:section_cell) { |page| page.section_table_element.cell_element(:index => 1) }
|
|
17
|
+
image(:section_image)
|
|
18
|
+
form(:section_form)
|
|
19
|
+
ordered_list(:section_ordered_list)
|
|
20
|
+
unordered_list(:section_unordered_list)
|
|
21
|
+
list_item(:section_list_item) { |page| page.section_ordered_list_element.list_item_element }
|
|
22
|
+
h1(:section_h1)
|
|
23
|
+
h2(:section_h2)
|
|
24
|
+
h3(:section_h3)
|
|
25
|
+
h4(:section_h4)
|
|
26
|
+
h5(:section_h5)
|
|
27
|
+
h6(:section_h6)
|
|
28
|
+
paragraph(:section_paragraph)
|
|
29
|
+
|
|
30
|
+
unordered_list(:outside_section, :id => 'outer')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class InputSection
|
|
34
|
+
include Druid
|
|
35
|
+
|
|
36
|
+
def value
|
|
37
|
+
root.value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class SectionElementsPage
|
|
42
|
+
include Druid
|
|
43
|
+
|
|
44
|
+
page_section(:container, Container, :id => 'div_id')
|
|
45
|
+
page_sections(:page_inputs, InputSection, :tag_name => 'input')
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
Given(/^I am on the section elements page$/) do
|
|
49
|
+
@page = SectionElementsPage.new(@driver)
|
|
50
|
+
@page.navigate_to(UrlHelper.nested_elements)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
When(/^I get the text from the section$/) do
|
|
54
|
+
@text = @page.container.text
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
Then(/^the text should include "([^"]*)"$/) do |expected_text|
|
|
58
|
+
expect(@text).to include expected_text
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
When(/^I access an element that is outside of the section$/) do
|
|
62
|
+
@element = @page.container.outside_section_element
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Then(/^I should see that is doesn't exist in the section$/) do
|
|
66
|
+
expect(@element.exist?).to be false
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
When(/^I search for a link located in a section$/) do
|
|
70
|
+
@link = @page.container.section_link_element
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Then(/^I should be able to click the section link$/) do
|
|
74
|
+
@link.click
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
When(/^I search for a button located in a section$/) do
|
|
78
|
+
@button = @page.container.section_button_element
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Then(/^I should be able to click the section button$/) do
|
|
82
|
+
@button.click
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
When(/^I search for a text field located in a section$/) do
|
|
86
|
+
@text_field = @page.container.section_text_field_element
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
Then(/^I should be able to type "([^"]*)" in the section text field$/) do |value|
|
|
90
|
+
@text_field.value = value
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
When(/^I search for a hidden field located in a section$/) do
|
|
94
|
+
@hidden_field = @page.container.section_hidden_field_element
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
Then(/^I should be able to see that the section hidden field contains "([^"]*)"$/) do |value|
|
|
98
|
+
expect(@hidden_field.value).to eql value
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
When(/^I search for a text area located in a section$/) do
|
|
102
|
+
@text_area = @page.container.section_text_area_element
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
Then(/^I should be able to type "([^"]*)" in the section text area$/) do |value|
|
|
106
|
+
@text_area.value = value
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
When(/^I search for a select list located in a section$/) do
|
|
110
|
+
@select_list = @page.container.section_select_list_element
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
Then(/^I should be able to select "([^"]*)" in the section select list$/) do |value|
|
|
114
|
+
@select_list.select value
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
When(/^I search for a file field located in a section$/) do
|
|
118
|
+
@ff = @page.container.section_file_field_element
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
Then(/^I should be able to set the section file field$/) do
|
|
122
|
+
@ff.value = __FILE__
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
When(/^I search for a checkbox located in a section$/) do
|
|
126
|
+
@checkbox = @page.container.section_checkbox_element
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
Then(/^I should be able to check the section checkbox$/) do
|
|
130
|
+
@checkbox.check
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
When(/^I search for a radio button located in a section$/) do
|
|
134
|
+
@radio = @page.container.section_radio_button_element
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
Then(/^I should be able to select the section radio button$/) do
|
|
138
|
+
@radio.select
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
When(/^I search for a div located in a section$/) do
|
|
142
|
+
@div = @page.container.section_div_element
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
Then(/^I should see the text "([^"]*)" in the section div$/) do |value|
|
|
146
|
+
expect(@div.text).to eql value
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
When(/^I search for a span located in a section$/) do
|
|
150
|
+
@span = @page.container.section_span_element
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
Then(/^I should see the text "([^"]*)" in the section span$/) do |value|
|
|
154
|
+
expect(@span.text).to eql value
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
When(/^I search for a table located in a section$/) do
|
|
158
|
+
@table = @page.container.section_table_element
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
Then(/^the data for row "([^"]*)" of the section table should be "([^"]*)" and "([^"]*)"$/) do |row, col1, col2|
|
|
162
|
+
table_row = @table[row.to_i - 1]
|
|
163
|
+
expect(table_row[0].text).to eql col1
|
|
164
|
+
expect(table_row[1].text).to eql col2
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
When(/^I search the second table cell located in a table in a section$/) do
|
|
168
|
+
@cell = @page.container.section_cell_element
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
Then(/^the section table cell should contain "([^"]*)"$/) do |value|
|
|
172
|
+
expect(@cell.text).to eql value
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
When(/^I search for an image located in a section$/) do
|
|
176
|
+
@image = @page.container.section_image_element
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
Then(/^the section image should be "([^"]*)" pixels wide$/) do |width|
|
|
180
|
+
expect(@image.width).to eql width.to_i
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
Then(/^the section image should be "([^"]*)" pixels tall$/) do |height|
|
|
184
|
+
expect(@image.height).to eql height.to_i
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
When(/^I search for a form located in a section$/) do
|
|
188
|
+
@form = @page.container.section_form_element
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
Then(/^I should be able to submit the section form$/) do
|
|
192
|
+
@form.submit
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
When(/^I search for an ordered list located in a section$/) do
|
|
196
|
+
@list = @page.container.section_ordered_list_element
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
Then(/^the first section list items text should be "([^"]*)"$/) do |value|
|
|
200
|
+
expect(@list[0].text).to eql value
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
When(/^I search for an unordered list located in a section$/) do
|
|
204
|
+
@list = @page.container.section_unordered_list_element
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
When(/^I search for a list item section in an ordered list in a section$/) do
|
|
208
|
+
@li = @page.container.section_list_item_element
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
Then(/^I should see the section list items text should be "([^"]*)"$/) do |value|
|
|
212
|
+
expect(@li.text).to eql value
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
When(/^I search for a h(\d+) located in a section$/) do |num|
|
|
216
|
+
@header = @page.container.send "section_h#{num}_element"
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
Then(/^I should see the section h(\d+)s text should be "([^"]*)"$/) do |num, value|
|
|
220
|
+
expect(@header.text).to eql value
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
When(/^I search for a paragraph located in a section$/) do
|
|
224
|
+
@paragraph = @page.container.section_paragraph_element
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
Then(/^I should see the section paragraphs text should be "([^"]*)"$/) do |value|
|
|
228
|
+
expect(@paragraph.text).to eql value
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
When(/^I select multiple sections$/) do
|
|
232
|
+
@sections = @page.page_inputs
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
Then(/^I should have a section collection containing the sections$/) do
|
|
236
|
+
expect(@sections).to be_instance_of Druid::SectionCollection
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
Then(/^I can access any index of that collection of sections$/) do
|
|
240
|
+
expect(@sections[0]).to be_a(Druid)
|
|
241
|
+
expect(@sections[-1]).to be_a(Druid)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
When(/^I search by a specific value of the section$/) do
|
|
245
|
+
@element = @sections.find_by(:value => 'LeanDog')
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
Then(/^I will find the first section with that value$/) do
|
|
249
|
+
expect(@element).to be_a(Druid)
|
|
250
|
+
expect(@element.value). to eq 'LeanDog'
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
When(/^I filter by a specific value of the sections$/) do
|
|
254
|
+
@elements = @sections.select_by(:value => /\w+/)
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
Then(/^I will find all sections with that value$/) do
|
|
258
|
+
expect(@elements).to be_a Druid::SectionCollection
|
|
259
|
+
@elements.map(&:value).each do |element|
|
|
260
|
+
expect(element).to match(/\w+/)
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
When(/^I have a page section$/) do
|
|
265
|
+
@section = @page.container
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
Then(/^methods called on the section are passed to the root if missing$/) do
|
|
269
|
+
expect { @section.present? }.not_to raise_error
|
|
270
|
+
expect(@section.present?).to be true
|
|
271
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
When(/^I select "(.*?)" from the select list$/) do |item|
|
|
2
|
+
@page.select_list_id = item
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^the current item should be "(.*?)"$/) do |expected_item|
|
|
6
|
+
expect(@page.select_list_id).to eql expected_item
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I locate the select list by "(.*?)"$/) do |how|
|
|
10
|
+
@how = how
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/^I should be able to select "(.*?)"$/) do |item|
|
|
14
|
+
@page.send "select_list_#{@how}=".to_sym, item
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then(/^the value for the selected item should be "(.*?)"$/) do |expected_item|
|
|
18
|
+
expect(@page.send "select_list_#{@how}".to_sym).to eql expected_item
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When(/^I retrieve a select list$/) do
|
|
22
|
+
@element = @page.select_list_id_element
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
When(/^I search for the select list by "(.*?)"$/) do |how|
|
|
26
|
+
@how = how
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^option "(.*?)" should contain "(.*?)"$/) do |opt_num, text|
|
|
30
|
+
@element = @page.send "select_list_#{@how}_element".to_sym
|
|
31
|
+
expect(@element[opt_num.to_i - 1].text).to eql text
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Then(/^each option should contain "(.*?)"$/) do |text|
|
|
35
|
+
@element.options.each do |option|
|
|
36
|
+
expect(option.text).to include text
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
When(/^I search for the select list bys "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
41
|
+
@how = "#{param1}_#{param2}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
When(/^I find a select list while the script is executing$/) do
|
|
45
|
+
@select_list = @page.select_list_element(:id => "sel_list_id")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Then(/^I should be able to select "(.*?)" from the list$/) do |value|
|
|
49
|
+
@select_list.select value
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Then(/^I should see that the select list exists$/) do
|
|
53
|
+
expect(@page.select_list_id?).to be true
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
Then(/^the selected option should be "(.*)"$/) do |text|
|
|
57
|
+
expect(@page.select_list_element(:id => 'sel_list_id').selected_options[0]).to eql text
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
Then(/^the select list should include "([^"]*)"$/) do |text|
|
|
61
|
+
expect(@page.select_list_id_element).to include text
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Then(/^the select list should know that "([^"]*)" is selected$/) do |text|
|
|
65
|
+
expect(@page.select_list_id_element.selected?(text)).to be true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Then(/^the value for the option should be "([^"]*)"$/) do |value|
|
|
69
|
+
@element = @page.send "select_list_#{@how}_element".to_sym
|
|
70
|
+
expect(@element.value).to eql value
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
When(/^I clear multiple select list$/) do
|
|
74
|
+
@page.select_list_multiple_element.clear
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
Then(/^multiple select list should have no selected options$/) do
|
|
78
|
+
expect(@page.select_list_multiple_element.selected_options).to be_empty
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
When(/^I select an option using the value "([^"]*)"$/) do |value|
|
|
82
|
+
@page.select_list_id_element.select_value(value)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
Then(/^the selected option should have a value of "([^"]*)"$/) do |value|
|
|
86
|
+
expect(@page.select_list_id_element.selected_values[0]).to eql value
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
Then(/^cleared multiple select list should return nil for value$/) do
|
|
90
|
+
expect(@page.select_list_multiple).to be nil
|
|
91
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
When(/^I get the text from the span$/) do
|
|
2
|
+
@text = @page.span_id
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^I locate the span by "(.*?)"$/) do |how|
|
|
6
|
+
@text = @page.send "span_#{how}".to_sym
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I retrieve a span element$/) do
|
|
10
|
+
@element = @page.span_id_element
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I search for the span by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
14
|
+
@text = @page.send "span_#{param1}_#{param2}".to_sym
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I get the text from a span while the script is executing$/) do
|
|
18
|
+
@text = @page.span_element(:id => 'span_id').text
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then(/^I should see that the span exists$/) do
|
|
22
|
+
expect(@page.span_id?).to be true
|
|
23
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
When(/^I retrieve the data from the table cell$/) do
|
|
2
|
+
@cell_text = @page.cell_id
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^the cell data should be '(.*?)'$/) do |expected_text|
|
|
6
|
+
expect(@cell_text).to eql expected_text
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I locate the table cell by "(.*?)"$/) do |how|
|
|
10
|
+
@cell_text = @page.send "cell_#{how}".to_sym
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I retrieve table cell$/) do
|
|
14
|
+
@element = @page.cell_id_element
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I retrieve a table cell element by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
18
|
+
@cell_text = @page.send "cell_#{param1}_#{param2}".to_sym
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When(/^I retrieve a table cell element while the script is executing$/) do
|
|
22
|
+
@cell_text = @page.cell_element(:id => 'cell_id').text
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then(/^I should see that the cell exists$/) do
|
|
26
|
+
expect(@page.cell_id?).to be true
|
|
27
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
When(/^I retrieve the data from the table row$/) do
|
|
2
|
+
@row_data = @page.tr_id
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^the row data should be "([^"]*)"$/) do |expected|
|
|
6
|
+
expect(@row_data).to eql expected
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I search for the table row by "([^"]*)"$/) do |how|
|
|
10
|
+
@row_data = @page.send "tr_#{how}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I retrieve a table row element by "([^"]*)" and "([^"]*)"$/) do |param1, param2|
|
|
14
|
+
@row_data = @page.send "tr_#{param1}_#{param2}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I retrieve a table row element while the script is executing$/) do
|
|
18
|
+
@row_data = @page.row_element(:id => 'tr_id').text
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then(/^I should see that the row exists$/) do
|
|
22
|
+
expect(@page.tr_id?).to be true
|
|
23
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
When(/^I retrieve a table element$/) do
|
|
2
|
+
@element = @page.table_id_element
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^I retrieve a table element by "(.*?)"$/) do |how|
|
|
6
|
+
@element = @page.send "table_#{how}_element".to_sym
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Then(/^the data for row "(.*?)" should be "(.*?)" and "(.*?)"$/) do |row, col1, col2|
|
|
10
|
+
row = (row.to_i - 1) if row.to_i > 0
|
|
11
|
+
table_row = @element[row]
|
|
12
|
+
expect(table_row[0].text).to eql col1
|
|
13
|
+
expect(table_row[1].text).to eql col2
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Then(/^the table should have "(.*?)" rows$/) do |number|
|
|
17
|
+
expect(@element.rows).to eql number.to_i
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Then(/^each row should contain "(.*?)"$/) do |text|
|
|
21
|
+
@element.each do |row|
|
|
22
|
+
expect(row.text).to include text
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Then(/^row "(.*?)" should have "(.*?)" columns$/) do |row, cols|
|
|
27
|
+
expect(@element[row.to_i - 1].columns).to eql cols.to_i
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Then(/^each column should contain "(.*?)"$/) do |text|
|
|
31
|
+
row = @element[0]
|
|
32
|
+
row.each do |column|
|
|
33
|
+
expect(column.text).to include text
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
When(/^I retrieve a table element bys "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
38
|
+
@element = @page.send "table_#{param1}_#{param2}_element".to_sym
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
When(/^I retrieve a table element while the script is executing$/) do
|
|
42
|
+
@element = @page.table_element(:id => 'table_id')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Then(/^the data for the first row should be "([^"]*)" and "([^"]*)"$/) do |col1, col2|
|
|
46
|
+
expect(@element.first_row[0].text).to eql col1
|
|
47
|
+
expect(@element.first_row[1].text).to eql col2
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Then(/^the data for the last row should be "([^"]*)" and "([^"]*)"$/) do |col1, col2|
|
|
51
|
+
expect(@element.last_row[0].text).to eql col1
|
|
52
|
+
expect(@element.last_row[1].text).to eql col2
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
Then(/^I should see that the table exists$/) do
|
|
56
|
+
expect(@page.table_id?).to be true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
Then(/^the data for column "([^"]*)" and row "([^"]*)" should be "([^"]*)"$/) do |column, row, value|
|
|
60
|
+
expect(@element[row.to_i - 1][column].text).to eql value
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
Then(/^the data for row "([^"]*)" and column "([^"]*)" should be "([^"]*)"$/) do |row, column, value|
|
|
64
|
+
expect(@element[row][column].text).to eql value
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
Then(/^the data for row "([^"]*)" should be nil$/) do |row|
|
|
68
|
+
expect(@element[row]).to be_nil
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Then(/^the data for row "([^"]*)" and column "([^"]*)" should be nil$/) do |row, column|
|
|
72
|
+
expect(@element[row][column]).to be_nil
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
When(/^I retrieve a table with thead element$/) do
|
|
76
|
+
@element = @page.table_with_thead_id_element
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
Then(/^I should see the text includes "([^"]*)" when I retrieve it by "([^"]*)"$/) do |text, how|
|
|
80
|
+
expect(@page.send("table_#{how}")).to include text
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
Then(/^the data for the second row should be "([^"]*)" and "([^"]*)"$/) do |col1, col2|
|
|
84
|
+
expect(@element[1][0].text).to eql col1
|
|
85
|
+
expect(@element[1][1].text).to eql col2
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
Then(/^the table should be like the expected one$/) do |expected_table|
|
|
89
|
+
expect(expected_table.diff!@element.hashes).to be_nil
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
When(/^I retrieve a table element with regex characters$/) do
|
|
93
|
+
@element = @page.table_with_regex_element
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
When(/^I ask for the column values for "([^"]*)"$/) do |header|
|
|
97
|
+
@values = @page.table_id_element.column_values(header)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
Then(/^I should receive:$/) do |table|
|
|
101
|
+
expect(@values.size).to eql 2
|
|
102
|
+
table.hashes.each do |hsh|
|
|
103
|
+
expect(@values).to include hsh['values']
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
When(/^I ask for the column values for column (\d+)$/) do |index|
|
|
108
|
+
@values = @page.table_id_element.column_values(index.to_i)
|
|
109
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
When(/^I type "(.*?)" into the text area$/) do |text|
|
|
2
|
+
@page.text_area_id = text
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^the text area should contain "(.*?)"$/) do |text|
|
|
6
|
+
expect(@page.text_area_id).to eql text
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I locate the text area by "(.*?)"$/) do |how|
|
|
10
|
+
@element = @page.send "text_area_#{how}_element".to_sym
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/^I should be able to type "(.*?)" into the area$/) do |text|
|
|
14
|
+
@element.send_keys text
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I search for the text area by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
18
|
+
@element = @page.send "text_area_#{param1}_#{param2}_element".to_sym
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When(/^I retrieve the text area$/) do
|
|
22
|
+
@element = @page.text_area_id_element
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
When(/^I find a text area while the script is executing$/) do
|
|
26
|
+
@text_area = @page.text_area_element(:id => "text_area_id")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^I should be able to type "(.*?)" into the area element$/) do |value|
|
|
30
|
+
@text_area.value = value
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
When(/^I clear the text area$/) do
|
|
34
|
+
@page.text_area_id_element.clear
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Then(/^I should see that the text area exists$/) do
|
|
38
|
+
expect(@page.text_area_id?).to be true
|
|
39
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
When(/^I type "(.*?)" into the text field$/) do |text|
|
|
2
|
+
@page.text_field_id = text
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/^the text field should contain "(.*?)"$/) do |expected_text|
|
|
6
|
+
expect(@page.text_field_id).to include expected_text
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I locate the text field by "(.*?)"$/) do |how|
|
|
10
|
+
@how = how
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/^I should be able to type "(.*?)" into the field$/) do |value|
|
|
14
|
+
@page.send "text_field_#{@how}=".to_sym, value
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I retrieve a text field$/) do
|
|
18
|
+
@element = @page.text_field_id_element
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When(/^I search for the text field by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
22
|
+
@how = "#{param1}_#{param2}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
When(/^I find a text field while the script is executing$/) do
|
|
26
|
+
@text_field = @page.text_field_element(:id => 'text_field_id')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^I should be able to type "(.*?)" into the field element$/) do |value|
|
|
30
|
+
@text_field.value = value
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Then(/^I should see that the text field exists$/) do
|
|
34
|
+
expect(@page.text_field_id?).to be true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
When(/^I append "([^"]*)" to the text field$/) do |text|
|
|
38
|
+
@page.text_field_id_element.append text
|
|
39
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
When(/^I get the first item from the unordered list$/) do
|
|
2
|
+
@element = @page.ul_id_element[0]
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^I locate the unordered list by "(.*?)"$/) do |how|
|
|
6
|
+
@list = @page.send "ul_#{how}_element".to_sym
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I search for the unordered list by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
10
|
+
@list = @page.send "ul_#{param1}_#{param2}_element".to_sym
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I retrieve a unordered list element$/) do
|
|
14
|
+
@element = @page.ul_id_element
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I search for the unordered list while the script is executing$/) do
|
|
18
|
+
@list = @page.unordered_list_element(:id => 'ul_id')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then(/^I should see that the unordered list exists$/) do
|
|
22
|
+
expect(@page.ul_id?).to be true
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then(/^the text for the unordered list should contain "([^"]*)"$/) do |text|
|
|
26
|
+
expect(@page.send("ul_id")).to include text
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
When(/^I retrieve the video element$/) do
|
|
2
|
+
@element = @avpage.video_id_element
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^I search for the video element by "([^"]*)"$/) do |how|
|
|
6
|
+
@element = @avpage.send "video_#{how}_element"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I search for the video element by "([^"]*)" and "([^"]*)"$/) do |param1, param2|
|
|
10
|
+
@element = @avpage.send "video_#{param1}_#{param2}_element"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/^I should know the video is not autoplay$/) do
|
|
14
|
+
expect(@element).not_to be_autoplay
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then(/^I should know that the video is paused$/) do
|
|
18
|
+
expect(@element).to be_paused
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then(/^I should know that its height is (\d+) pixels$/) do |height|
|
|
22
|
+
@element.height.should == height.to_i
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then(/^I should knot what its width is (\d+) pixels$/) do |width|
|
|
26
|
+
@element.width.should == width.to_i
|
|
27
|
+
end
|