page-object 0.5.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +9 -0
- data/Gemfile +4 -0
- data/Guardfile +21 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/cucumber.yml +1 -2
- data/features/html/multi_elements.html +136 -0
- data/features/multi_elements.feature +175 -0
- data/features/step_definitions/multi_elements_steps.rb +297 -0
- data/features/support/url_helper.rb +4 -0
- data/lib/page-object/accessors.rb +1 -1
- data/lib/page-object/element_locators.rb +382 -1
- data/lib/page-object/nested_elements.rb +96 -0
- data/lib/page-object/page_factory.rb +89 -1
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +299 -250
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +247 -198
- data/lib/page-object/version.rb +1 -1
- data/page-object.gemspec +1 -1
- data/spec/page-object/element_locators_spec.rb +590 -143
- data/spec/page-object/page_factory_spec.rb +65 -8
- metadata +20 -13
data/ChangeLog
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== Version 0.6 / 2012-1-10
|
2
|
+
* Enhancements
|
3
|
+
* Added ?_elements methods to ElementLocator so you can find all elements that match an identifier
|
4
|
+
* Added ?_elements methods to NestedElements so you can find all elements nested within others
|
5
|
+
* Added #navigate_to to PageFactory to navigate to a page through previous pages
|
6
|
+
* Added #continue_navigation_to to PageFactory which begins at @current_page
|
7
|
+
* Added routes to PageFactory to collect routes through the site
|
8
|
+
* Updated to use selenium-webdriver 2.16.0
|
9
|
+
|
1
10
|
=== Version 0.5.5 / 2011-12-27
|
2
11
|
* Enhancements
|
3
12
|
* Added ability to find Checkbox by :value
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
features_to_run = 'features'
|
5
|
+
|
6
|
+
guard 'rspec', :cli => '--color --format Fuubar' do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
9
|
+
watch(%r{^lib/page-object/platforms/(.+)/.+\.rb$}) do |m|
|
10
|
+
["spec/page-object/platforms/#{m[1]}/", "spec/page-object/page-object_spec.rb"]
|
11
|
+
end
|
12
|
+
watch('spec/spec_helper.rb') { "spec" }
|
13
|
+
end
|
14
|
+
|
15
|
+
guard 'cucumber', :notification => true, :all_after_pass => false, :all_on_start => false, :cli => '--profile default' do
|
16
|
+
watch(%r{^features/.+\.feature$})
|
17
|
+
watch(%r{^features/support/.+$}) { features_to_run }
|
18
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
19
|
+
watch(%r{^lib/.+\.rb$}) { features_to_run }
|
20
|
+
watch(%r{^cucumber.yml$}) { features_to_run }
|
21
|
+
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
data/cucumber.yml
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
std_opts = "--no-source --color --format Cucumber::Formatter::Fuubar"
|
3
3
|
%>
|
4
4
|
|
5
|
-
default: DRIVER=WATIR <%= std_opts %>
|
5
|
+
default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
|
6
6
|
watir: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
|
7
7
|
selenium: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
|
8
|
-
autotest: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
|
9
8
|
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Multi Elements Page</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<input class='button' type="submit" value="Button 1"/>
|
7
|
+
<input class='button' type="submit" value="Button 2"/>
|
8
|
+
<input class='button' type="submit" value="Button 3"/>
|
9
|
+
|
10
|
+
|
11
|
+
<input class="textfield" size="40" type="text" value="text 1"/>
|
12
|
+
<input class="textfield" size="40" type="text" value="text 2"/>
|
13
|
+
<input class="textfield" size="40" type="text" value="text 3"/>
|
14
|
+
|
15
|
+
<input class="hiddenfield" size="40" type="hidden" value="hidden 1"/>
|
16
|
+
<input class="hiddenfield" size="40" type="hidden" value="hidden 2"/>
|
17
|
+
<input class="hiddenfield" size="40" type="hidden" value="hidden 3"/>
|
18
|
+
|
19
|
+
<textarea rows="2" cols="20" class="textarea">textarea 1</textarea>
|
20
|
+
<textarea rows="2" cols="20" class="textarea">textarea 2</textarea>
|
21
|
+
<textarea rows="2" cols="20" class="textarea">textarea 3</textarea>
|
22
|
+
|
23
|
+
<select class="selectlist">
|
24
|
+
<option value="selectlist 1">Option 1</option>
|
25
|
+
</select>
|
26
|
+
<select class="selectlist">
|
27
|
+
<option value="selectlist 2">Option 2</option>
|
28
|
+
</select>
|
29
|
+
<select class="selectlist">
|
30
|
+
<option value="selectlist 3">Option 3</option>
|
31
|
+
</select>
|
32
|
+
|
33
|
+
<a href="blah.html" class="link">link 1</a>
|
34
|
+
<a href="blah.html" class="link">link 2</a>
|
35
|
+
<a href="blah.html" class="link">link 3</a>
|
36
|
+
|
37
|
+
<input class="checkbox" type="checkbox" value="checkbox 1"/>
|
38
|
+
<input class="checkbox" type="checkbox" value="checkbox 2"/>
|
39
|
+
<input class="checkbox" type="checkbox" value="checkbox 3"/>
|
40
|
+
|
41
|
+
<input type="radio" class="radio" value="radio 1">
|
42
|
+
<input type="radio" class="radio" value="radio 2">
|
43
|
+
<input type="radio" class="radio" value="radio 3">
|
44
|
+
|
45
|
+
<div class="div">Div 1</div>
|
46
|
+
<div class="div">Div 2</div>
|
47
|
+
<div class="div">Div 3</div>
|
48
|
+
|
49
|
+
<span class="span">Span 1</span>
|
50
|
+
<span class="span">Span 2</span>
|
51
|
+
<span class="span">Span 3</span>
|
52
|
+
|
53
|
+
<table class="table" border='1'>
|
54
|
+
<tr>
|
55
|
+
<td class="td">Data 1</td>
|
56
|
+
<td class="td">Data 2</td>
|
57
|
+
<td class="td">Data 3</td>
|
58
|
+
</tr>
|
59
|
+
</table>
|
60
|
+
|
61
|
+
<table class="table" border='1'>
|
62
|
+
<tr>
|
63
|
+
<td>Data 4</td>
|
64
|
+
<td>Data 5</td>
|
65
|
+
<td>Data 6</td>
|
66
|
+
</tr>
|
67
|
+
</table>
|
68
|
+
|
69
|
+
<table class="table" border='1'>
|
70
|
+
<tr>
|
71
|
+
<td>Data 7</td>
|
72
|
+
<td>Data 8</td>
|
73
|
+
<td>Data 9</td>
|
74
|
+
</tr>
|
75
|
+
</table>
|
76
|
+
|
77
|
+
<img src="images/circle.png" class="image", alt="image 1">
|
78
|
+
<img src="images/circle.png" class="image", alt="image 2">
|
79
|
+
<img src="images/circle.png" class="image", alt="image 3">
|
80
|
+
|
81
|
+
<form method="get" class="form" action="form1"></form>
|
82
|
+
<form method="get" class="form" action="form2"></form>
|
83
|
+
<form method="get" class="form" action="form3"></form>
|
84
|
+
|
85
|
+
<ul class="ul">
|
86
|
+
<li class="li">Item One</li>
|
87
|
+
<li class="li">Item Two</li>
|
88
|
+
<li class="li">Item Three</li>
|
89
|
+
</ul>
|
90
|
+
<ul class="ul">
|
91
|
+
<li>Item Four</li>
|
92
|
+
</ul>
|
93
|
+
<ul class="ul">
|
94
|
+
<li>Item Five</li>
|
95
|
+
</ul>
|
96
|
+
|
97
|
+
<ol class="ol">
|
98
|
+
<li>Number One</li>
|
99
|
+
</ol>
|
100
|
+
<ol class="ol">
|
101
|
+
<li>Number Two</li>
|
102
|
+
</ol>
|
103
|
+
<ol class="ol">
|
104
|
+
<li>Number Three</li>
|
105
|
+
</ol>
|
106
|
+
|
107
|
+
<h1 class="h1">H1 One</h1>
|
108
|
+
<h1 class="h1">H1 Two</h1>
|
109
|
+
<h1 class="h1">H1 Three</h1>
|
110
|
+
|
111
|
+
<h2 class="h2">H2 One</h2>
|
112
|
+
<h2 class="h2">H2 Two</h2>
|
113
|
+
<h2 class="h2">H2 Three</h2>
|
114
|
+
|
115
|
+
<h3 class="h3">H3 One</h3>
|
116
|
+
<h3 class="h3">H3 Two</h3>
|
117
|
+
<h3 class="h3">H3 Three</h3>
|
118
|
+
|
119
|
+
<h4 class="h4">H4 One</h4>
|
120
|
+
<h4 class="h4">H4 Two</h4>
|
121
|
+
<h4 class="h4">H4 Three</h4>
|
122
|
+
|
123
|
+
<h5 class="h5">H5 One</h5>
|
124
|
+
<h5 class="h5">H5 Two</h5>
|
125
|
+
<h5 class="h5">H5 Three</h5>
|
126
|
+
|
127
|
+
<h6 class="h6">H6 One</h6>
|
128
|
+
<h6 class="h6">H6 Two</h6>
|
129
|
+
<h6 class="h6">H6 Three</h6>
|
130
|
+
|
131
|
+
<p class="p">Paragraph One</p>
|
132
|
+
<p class="p">Paragraph Two</p>
|
133
|
+
<p class="p">Paragraph Three</p>
|
134
|
+
|
135
|
+
</body>
|
136
|
+
</html>
|
@@ -0,0 +1,175 @@
|
|
1
|
+
Feature: Multi Elements
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the multi elements page
|
5
|
+
|
6
|
+
Scenario: Selecting buttons
|
7
|
+
When I select the buttons with class "button"
|
8
|
+
Then I should have 3 buttons
|
9
|
+
And the value of button 1 should be "Button 1"
|
10
|
+
And the value of button 2 should be "Button 2"
|
11
|
+
And the value of button 3 should be "Button 3"
|
12
|
+
|
13
|
+
Scenario: Selecting text_fields
|
14
|
+
When I select the text fields with class "textfield"
|
15
|
+
Then I should have 3 text fields
|
16
|
+
And the value of text field 1 should be "text 1"
|
17
|
+
And the value of text field 2 should be "text 2"
|
18
|
+
And the value of text field 3 should be "text 3"
|
19
|
+
|
20
|
+
Scenario: Selecting hidden_fields
|
21
|
+
When I select the hidden fields with class "hiddenfield"
|
22
|
+
Then I should have 3 hidden fields
|
23
|
+
And the value of hidden field 1 should be "hidden 1"
|
24
|
+
And the value of hidden field 2 should be "hidden 2"
|
25
|
+
And the value of hidden field 3 should be "hidden 3"
|
26
|
+
|
27
|
+
Scenario: Selecting text_areas
|
28
|
+
When I select the text areas with class "textarea"
|
29
|
+
Then I should have 3 text areas
|
30
|
+
And the value of text area 1 should be "textarea 1"
|
31
|
+
And the value of text area 2 should be "textarea 2"
|
32
|
+
And the value of text area 3 should be "textarea 3"
|
33
|
+
|
34
|
+
Scenario: Selecting select_lists
|
35
|
+
When I select the select lists with class "selectlist"
|
36
|
+
Then I should have 3 select lists
|
37
|
+
And the value of select list 1 should be "selectlist 1"
|
38
|
+
And the value of select list 2 should be "selectlist 2"
|
39
|
+
And the value of select list 3 should be "selectlist 3"
|
40
|
+
|
41
|
+
Scenario: Selecting links
|
42
|
+
When I select the link with class "link"
|
43
|
+
Then I should have 3 links
|
44
|
+
And the text of link 1 should be "link 1"
|
45
|
+
And the text of link 2 should be "link 2"
|
46
|
+
And the text of link 3 should be "link 3"
|
47
|
+
|
48
|
+
Scenario: Selecting checkboxes
|
49
|
+
When I select the check boxes with class "checkbox"
|
50
|
+
Then I should have 3 checkboxes
|
51
|
+
And the value of checkbox 1 should be "checkbox 1"
|
52
|
+
And the value of checkbox 2 should be "checkbox 2"
|
53
|
+
And the value of checkbox 3 should be "checkbox 3"
|
54
|
+
|
55
|
+
Scenario: Selecting radio buttons
|
56
|
+
When I select the radio button with class "radio"
|
57
|
+
Then I should have 3 radio buttons
|
58
|
+
And the value of radio button 1 should be "radio 1"
|
59
|
+
And the value of radio button 2 should be "radio 2"
|
60
|
+
And the value of radio button 3 should be "radio 3"
|
61
|
+
|
62
|
+
Scenario: Selecting divs
|
63
|
+
When I select the div with class "div"
|
64
|
+
Then I should have 3 divs
|
65
|
+
And the text of div 1 should be "Div 1"
|
66
|
+
And the text of div 2 should be "Div 2"
|
67
|
+
And the text of div 3 should be "Div 3"
|
68
|
+
|
69
|
+
Scenario: Selecting spans
|
70
|
+
When I select the spans with class "span"
|
71
|
+
Then I should have 3 spans
|
72
|
+
And the text of span 1 should be "Span 1"
|
73
|
+
And the text of span 2 should be "Span 2"
|
74
|
+
And the text of span 3 should be "Span 3"
|
75
|
+
|
76
|
+
Scenario: Selecting tables
|
77
|
+
When I select the tables with class "table"
|
78
|
+
Then I should have 3 tables
|
79
|
+
And the first row first column for table 1 should have "Data 1"
|
80
|
+
And the first row first column for table 2 should have "Data 4"
|
81
|
+
And the first row first column for table 3 should have "Data 7"
|
82
|
+
|
83
|
+
Scenario: Selecting cells
|
84
|
+
When I select the cells with class "td"
|
85
|
+
Then I should have 3 cells
|
86
|
+
And the text for cell 1 should be "Data 1"
|
87
|
+
And the text for cell 2 should be "Data 2"
|
88
|
+
And the text for cell 3 should be "Data 3"
|
89
|
+
|
90
|
+
Scenario: Selecting images
|
91
|
+
When I select the images with class "image"
|
92
|
+
Then I should have 3 images
|
93
|
+
And the alt for image 1 should be "image 1"
|
94
|
+
And the alt for image 2 should be "image 2"
|
95
|
+
And the alt for image 3 should be "image 3"
|
96
|
+
|
97
|
+
Scenario: Selecting forms
|
98
|
+
When I select the forms with class "form"
|
99
|
+
Then I should have 3 forms
|
100
|
+
And the action for form 1 should be "form1"
|
101
|
+
And the action for form 2 should be "form2"
|
102
|
+
And the action for form 3 should be "form3"
|
103
|
+
|
104
|
+
Scenario: Selecting list items
|
105
|
+
When I select the list items with class "li"
|
106
|
+
Then I should have 3 list items
|
107
|
+
And the text for list item 1 should be "Item One"
|
108
|
+
And the text for list item 2 should be "Item Two"
|
109
|
+
And the text for list item 3 should be "Item Three"
|
110
|
+
|
111
|
+
Scenario: Selecting unordered lists
|
112
|
+
When I select the unordered list with class "ul"
|
113
|
+
Then I should have 3 unordered lists
|
114
|
+
And the text for the first item in unordered list 1 should be "Item One"
|
115
|
+
And the text for the first item in unordered list 2 should be "Item Four"
|
116
|
+
And the text for the first item in unordered list 3 should be "Item Five"
|
117
|
+
|
118
|
+
Scenario: Selecting ordered lists
|
119
|
+
When I select the ordered lists with class "ol"
|
120
|
+
Then I should have 3 ordered lists
|
121
|
+
And the text for the first item in ordered list 1 should be "Number One"
|
122
|
+
And the text for the first item in ordered list 2 should be "Number Two"
|
123
|
+
And the text for the first item in ordered list 3 should be "Number Three"
|
124
|
+
|
125
|
+
Scenario: Selecting h1s
|
126
|
+
When I select the h1s with class "h1"
|
127
|
+
Then I should have 3 h1s
|
128
|
+
And the text for h1 1 should be "H1 One"
|
129
|
+
And the text for h1 2 should be "H1 Two"
|
130
|
+
And the text for h1 3 should be "H1 Three"
|
131
|
+
|
132
|
+
Scenario: Selecting h2s
|
133
|
+
When I select the h2s with the class "h2"
|
134
|
+
Then I should have 3 h2s
|
135
|
+
And the text for h2 1 should be "H2 One"
|
136
|
+
And the text for h2 2 should be "H2 Two"
|
137
|
+
And the text for h2 3 should be "H2 Three"
|
138
|
+
|
139
|
+
Scenario: Selecting h3s
|
140
|
+
When I select the h3s with the class "h3"
|
141
|
+
Then I should have 3 h3s
|
142
|
+
And the text for h3 1 should be "H3 One"
|
143
|
+
And the text for h3 2 should be "H3 Two"
|
144
|
+
And the text for h3 3 should be "H3 Three"
|
145
|
+
|
146
|
+
Scenario: Selecting h4s
|
147
|
+
When I select the h4s with the class "h4"
|
148
|
+
Then I should have 3 h4s
|
149
|
+
And the text for H4 1 should be "H4 One"
|
150
|
+
And the text for H4 2 should be "H4 Two"
|
151
|
+
And the text for H4 3 should be "H4 Three"
|
152
|
+
|
153
|
+
Scenario: Selecting h5s
|
154
|
+
When I select the h5s with the class "h5"
|
155
|
+
Then I should have 3 h5s
|
156
|
+
And the text for H5 1 should be "H5 One"
|
157
|
+
And the text for H5 2 should be "H5 Two"
|
158
|
+
And the text for H5 3 should be "H5 Three"
|
159
|
+
|
160
|
+
Scenario: Selecting h6s
|
161
|
+
When I select the h6s with the class "h6"
|
162
|
+
Then I should have 3 h6s
|
163
|
+
And the text for H6 1 should be "H6 One"
|
164
|
+
And the text for H6 2 should be "H6 Two"
|
165
|
+
And the text for H6 3 should be "H6 Three"
|
166
|
+
|
167
|
+
Scenario: Selecting paragraphs
|
168
|
+
When I select the paragraph with class "p"
|
169
|
+
Then I should have 3 paragraphs
|
170
|
+
And the text for paragraph 1 should be "Paragraph One"
|
171
|
+
And the text for paragraph 2 should be "Paragraph Two"
|
172
|
+
And the text for paragraph 3 should be "Paragraph Three"
|
173
|
+
|
174
|
+
|
175
|
+
|
@@ -0,0 +1,297 @@
|
|
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
|
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
|
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
|
46
|
+
|
47
|
+
When /^I select the text areas with class "([^\"]*)"$/ do |class_name|
|
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
|
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
|
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
|
+
|
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
|
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
|
+
|
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
|
+
|
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
|
126
|
+
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|