druid-ts 1.1.0 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1081889b9173a02ac8c5786c09771d230af18226
4
- data.tar.gz: da6be1406dcb433fde5f47d4a699abb5c80bf9d7
3
+ metadata.gz: 0761839c85ebc27e562492d11f392eabb1e83ad1
4
+ data.tar.gz: 9a877989108f681df87c3070f73493411c9c523a
5
5
  SHA512:
6
- metadata.gz: ebb267bdf529e1b094d287883bb3422ff5d41ab0377a6b3e4f6421a0205a0a7dadf74f7a7ee6bdff335ccdccdd21e85cd31da43b3e481e9684c1225c0ac794fd
7
- data.tar.gz: 79e0be33f4dfe5f136731d6b7c388e1dc3f69aa9c2680b8bbc3766518506e2d88b8b25167d703ae71e950817ba5181fd6d652d42e32358f3e8c295f0a4201487
6
+ metadata.gz: 1720a4b821b071d87def39202fcd896750dbcc15595a498e4a3368df3336ff15dbd93dab0ecf35bb394136d2044f59228abdf31f0058a7951243dbb9d198f1b9
7
+ data.tar.gz: a5e3e348aa25f5db0bad1cce67a5aa1c938008364d502e0db89210a6e2174e256a3b420efa4917dbe488bec2b3b36d4dbf341c07a0d850373d01ce9661de22e2
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ === Version 1.1.1 / 2016-12-13
2
+ * Enhancements
3
+ * Added ?_elements to ElementLocators so you can find all elements that match an identifier
4
+ * Added ?_elements to NestedElements so you can find all elements nested within others
5
+
6
+ === 2016-11-15
7
+ * Enhancements
8
+ * Added #navigate_to method to PageFactory to navigate to a page through previous pages
9
+ * Added routes to PageFactory to collect routes through the site
10
+ * Added #continue_navigation_to method to PageFactory which begins at @current_page
1
11
  ******1.1.0******
2
12
  === 2016-11-14
3
13
  * Enhancements
data/druid.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "druid-ts"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.version = Druid::VERSION
9
- s.date = '2016-06-07'
9
+ s.date = '2016-11-15'
10
10
  s.authors = ["Tim Sheng"]
11
11
  s.email = ["278570038@qq.com"]
12
12
  s.homepage = "http://github.com/timsheng/druid"
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f)}
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency "watir-webdriver", "0.9", ">= 0.9.1"
22
+ s.add_dependency "watir-webdriver", ">= 0.9.1"
23
23
  s.add_development_dependency "rspec", ">= 3.4.0"
24
24
  s.add_development_dependency "cucumber", ">= 1.3.20"
25
25
  end
@@ -0,0 +1,135 @@
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
+ <input class='textfield' size='40' type='text' value='text 1'/>
11
+ <input class='textfield' size='40' type='text' value='text 2'/>
12
+ <input class='textfield' size='40' type='text' value='text 3'/>
13
+
14
+ <input class="hiddenfield" size="40" type="hidden" value="hidden 1"/>
15
+ <input class="hiddenfield" size="40" type="hidden" value="hidden 2"/>
16
+ <input class="hiddenfield" size="40" type="hidden" value="hidden 3"/>
17
+
18
+ <textarea rows="2" cols="20" class="textarea">textarea 1</textarea>
19
+ <textarea rows="2" cols="20" class="textarea">textarea 2</textarea>
20
+ <textarea rows="2" cols="20" class="textarea">textarea 3</textarea>
21
+
22
+ <select class="selectlist">
23
+ <option value="selectlist 1">Option 1</option>
24
+ </select>
25
+ <select class="selectlist">
26
+ <option value="selectlist 2">Option 2</option>
27
+ </select>
28
+ <select class="selectlist">
29
+ <option value="selectlist 3">Option 3</option>
30
+ </select>
31
+
32
+ <a href="blah.html" class="link">link 1</a>
33
+ <a href="blah.html" class="link">link 2</a>
34
+ <a href="blah.html" class="link">link 3</a>
35
+
36
+ <input class="checkbox" type="checkbox" value="checkbox 1"/>
37
+ <input class="checkbox" type="checkbox" value="checkbox 2"/>
38
+ <input class="checkbox" type="checkbox" value="checkbox 3"/>
39
+
40
+ <input type="radio" class="radio" value="radio 1">
41
+ <input type="radio" class="radio" value="radio 2">
42
+ <input type="radio" class="radio" value="radio 3">
43
+
44
+ <div class="div">Div 1</div>
45
+ <div class="div">Div 2</div>
46
+ <div class="div">Div 3</div>
47
+
48
+ <span class="span">Span 1</span>
49
+ <span class="span">Span 2</span>
50
+ <span class="span">Span 3</span>
51
+
52
+ <table class="table" border='1'>
53
+ <tr>
54
+ <td class="td">Data 1</td>
55
+ <td class="td">Data 2</td>
56
+ <td class="td">Data 3</td>
57
+ </tr>
58
+ </table>
59
+
60
+ <table class="table" border='1'>
61
+ <tr>
62
+ <td>Data 4</td>
63
+ <td>Data 5</td>
64
+ <td>Data 6</td>
65
+ </tr>
66
+ </table>
67
+
68
+ <table class="table" border='1'>
69
+ <tr>
70
+ <td>Data 7</td>
71
+ <td>Data 8</td>
72
+ <td>Data 9</td>
73
+ </tr>
74
+ </table>
75
+
76
+ <img src="images/circle.png" class="image" alt="image 1">
77
+ <img src="images/circle.png" class="image" alt="image 2">
78
+ <img src="images/circle.png" class="image" alt="image 3">
79
+
80
+ <form method="get" class="form" action="form1"></form>
81
+ <form method="get" class="form" action="form2"></form>
82
+ <form method="get" class="form" action="form3"></form>
83
+
84
+ <ul class="ul">
85
+ <li class="li">Item One</li>
86
+ <li class="li">Item Two</li>
87
+ <li class="li">Item Three</li>
88
+ </ul>
89
+ <ul class="ul">
90
+ <li>Item Four</li>
91
+ </ul>
92
+ <ul class="ul">
93
+ <li>Item Five</li>
94
+ </ul>
95
+
96
+ <ol class="ol">
97
+ <li>Number One</li>
98
+ </ol>
99
+ <ol class="ol">
100
+ <li>Number Two</li>
101
+ </ol>
102
+ <ol class="ol">
103
+ <li>Number Three</li>
104
+ </ol>
105
+
106
+ <h1 class="h1">H1 One</h1>
107
+ <h1 class="h1">H1 Two</h1>
108
+ <h1 class="h1">H1 Three</h1>
109
+
110
+ <h2 class="h2">H2 One</h2>
111
+ <h2 class="h2">H2 Two</h2>
112
+ <h2 class="h2">H2 Three</h2>
113
+
114
+ <h3 class="h3">H3 One</h3>
115
+ <h3 class="h3">H3 Two</h3>
116
+ <h3 class="h3">H3 Three</h3>
117
+
118
+ <h4 class="h4">H4 One</h4>
119
+ <h4 class="h4">H4 Two</h4>
120
+ <h4 class="h4">H4 Three</h4>
121
+
122
+ <h5 class="h5">H5 One</h5>
123
+ <h5 class="h5">H5 Two</h5>
124
+ <h5 class="h5">H5 Three</h5>
125
+
126
+ <h6 class="h6">H6 One</h6>
127
+ <h6 class="h6">H6 Two</h6>
128
+ <h6 class="h6">H6 Three</h6>
129
+
130
+ <p class="p">Paragraph One</p>
131
+ <p class="p">Paragraph Two</p>
132
+ <p class="p">Paragraph Three</p>
133
+
134
+ </body>
135
+ </html>
@@ -0,0 +1,173 @@
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
+
14
+ Scenario: Selecting text_fields
15
+ When I select the text fields with class "textfield"
16
+ Then I should have 3 text fields
17
+ And the value of text field 1 should be "text 1"
18
+ And the value of text field 2 should be "text 2"
19
+ And the value of text field 3 should be "text 3"
20
+
21
+ Scenario: Selecting hidden_fields
22
+ When I select the hidden fields with class "hiddenfield"
23
+ Then I should have 3 hidden fields
24
+ And the value of hidden field 1 should be "hidden 1"
25
+ And the value of hidden field 2 should be "hidden 2"
26
+ And the value of hidden field 3 should be "hidden 3"
27
+
28
+ Scenario: Selecting text_areas
29
+ When I select the text areas with class "textarea"
30
+ Then I should have 3 text areas
31
+ And the value of text area 1 should be "textarea 1"
32
+ And the value of text area 2 should be "textarea 2"
33
+ And the value of text area 3 should be "textarea 3"
34
+
35
+ Scenario: Selecting select_lists
36
+ When I select the select lists with class "selectlist"
37
+ Then I should have 3 select lists
38
+ And the value of select list 1 should be "selectlist 1"
39
+ And the value of select list 2 should be "selectlist 2"
40
+ And the value of select list 3 should be "selectlist 3"
41
+
42
+ Scenario: Selecting links
43
+ When I select the link with class "link"
44
+ Then I should have 3 links
45
+ And the text of link 1 should be "link 1"
46
+ And the text of link 2 should be "link 2"
47
+ And the text of link 3 should be "link 3"
48
+
49
+ Scenario: Selecting checkboxes
50
+ When I select the check boxes with class "checkbox"
51
+ Then I should have 3 checkboxes
52
+ And the value of checkbox 1 should be "checkbox 1"
53
+ And the value of checkbox 2 should be "checkbox 2"
54
+ And the value of checkbox 3 should be "checkbox 3"
55
+
56
+ Scenario: Selecting radio buttons
57
+ When I select the radio buttons with class "radio"
58
+ Then I should have 3 radio buttons
59
+ And the value of radio button 1 should be "radio 1"
60
+ And the value of radio button 2 should be "radio 2"
61
+ And the value of radio button 3 should be "radio 3"
62
+
63
+ Scenario: Selecting divs
64
+ When I select the divs with class "div"
65
+ Then I should have 3 divs
66
+ And the text of div 1 should be "Div 1"
67
+ And the text of div 2 should be "Div 2"
68
+ And the text of div 3 should be "Div 3"
69
+
70
+ Scenario: Selecting spans
71
+ When I select the spans with class "span"
72
+ Then I should have 3 spans
73
+ And the text of span 1 should be "Span 1"
74
+ And the text of span 2 should be "Span 2"
75
+ And the text of span 3 should be "Span 3"
76
+
77
+ Scenario: Selecting tables
78
+ When I select the tables with class "table"
79
+ Then I should have 3 tables
80
+ And the first row first column for table 1 should have "Data 1"
81
+ And the first row first column for table 2 should have "Data 4"
82
+ And the first row first column for table 3 should have "Data 7"
83
+
84
+ Scenario: Selecting cells
85
+ When I select the cells with class "td"
86
+ Then I should have 3 cells
87
+ And the text for cell 1 should be "Data 1"
88
+ And the text for cell 2 should be "Data 2"
89
+ And the text for cell 3 should be "Data 3"
90
+
91
+ Scenario: Selecting images
92
+ When I select the images with class "image"
93
+ Then I should have 3 images
94
+ And the alt for image 1 should be "image 1"
95
+ And the alt for image 2 should be "image 2"
96
+ And the alt for image 3 should be "image 3"
97
+
98
+ Scenario: Selecting forms
99
+ When I select the forms with class "form"
100
+ Then I should have 3 forms
101
+ And the action for form 1 should be "form1"
102
+ And the action for form 2 should be "form2"
103
+ And the action for form 3 should be "form3"
104
+
105
+ Scenario: Selecting list items
106
+ When I select the list items with class "li"
107
+ Then I should have 3 list items
108
+ And the text for list item 1 should be "Item One"
109
+ And the text for list item 2 should be "Item Two"
110
+ And the text for list item 3 should be "Item Three"
111
+
112
+ Scenario: Selecting unordered lists
113
+ When I select the unordered lists with class "ul"
114
+ Then I should have 3 unordered lists
115
+ And the text for the first item in unordered list 1 should be "Item One"
116
+ And the text for the first item in unordered list 2 should be "Item Four"
117
+ And the text for the first item in unordered list 3 should be "Item Five"
118
+
119
+ Scenario: Selecting ordered lists
120
+ When I select the ordered lists with class "ol"
121
+ Then I should have 3 ordered lists
122
+ And the text for the first item in ordered list 1 should be "Number One"
123
+ And the text for the first item in ordered list 2 should be "Number Two"
124
+ And the text for the first item in ordered list 3 should be "Number Three"
125
+
126
+ Scenario: Selecting h1s
127
+ When I select the h1s with class "h1"
128
+ Then I should have 3 h1s
129
+ And the text for h1 1 should be "H1 One"
130
+ And the text for h1 2 should be "H1 Two"
131
+ And the text for h1 3 should be "H1 Three"
132
+
133
+ Scenario: Selecting h2s
134
+ When I select the h2s with class "h2"
135
+ Then I should have 3 h2s
136
+ And the text for h2 1 should be "H2 One"
137
+ And the text for h2 2 should be "H2 Two"
138
+ And the text for h2 3 should be "H2 Three"
139
+
140
+ Scenario: Selecting h3s
141
+ When I select the h3s with class "h3"
142
+ Then I should have 3 h3s
143
+ And the text for h3 1 should be "H3 One"
144
+ And the text for h3 2 should be "H3 Two"
145
+ And the text for h3 3 should be "H3 Three"
146
+
147
+ Scenario: Selecting h4s
148
+ When I select the h4s with class "h4"
149
+ Then I should have 3 h4s
150
+ And the text for h4 1 should be "H4 One"
151
+ And the text for h4 2 should be "H4 Two"
152
+ And the text for h4 3 should be "H4 Three"
153
+
154
+ Scenario: Selecting h5s
155
+ When I select the h5s with class "h5"
156
+ Then I should have 3 h5s
157
+ And the text for h5 1 should be "H5 One"
158
+ And the text for h5 2 should be "H5 Two"
159
+ And the text for h5 3 should be "H5 Three"
160
+
161
+ Scenario: Selecting h6s
162
+ When I select the h6s with class "h6"
163
+ Then I should have 3 h6s
164
+ And the text for h6 1 should be "H6 One"
165
+ And the text for h6 2 should be "H6 Two"
166
+ And the text for h6 3 should be "H6 Three"
167
+
168
+ Scenario: Selecting paragraphs
169
+ When I select the paragraphs with class "p"
170
+ Then I should have 3 paragraphs
171
+ And the text for paragraph 1 should be "Paragraph One"
172
+ And the text for paragraph 2 should be "Paragraph Two"
173
+ And the text for paragraph 3 should be "Paragraph Three"
@@ -0,0 +1,296 @@
1
+ class MultiElementsPage
2
+ include Druid
3
+ end
4
+
5
+ Given(/^I am on the multi elements page$/) do
6
+ @page = MultiElementsPage.new(@driver)
7
+ @page.navigate_to(UrlHelper.multi)
8
+ end
9
+
10
+ When(/^I select the buttons with class "([^"]*)"$/) do |class_name|
11
+ @elements = @page.button_elements(:class => class_name)
12
+ end
13
+
14
+ Then(/^I should have (\d+) buttons$/) do |num_buttons|
15
+ expect(@elements.size).to eql num_buttons.to_i
16
+ end
17
+
18
+ Then(/^the value of button (\d+) should be "([^"]*)"$/) do |button_num, value|
19
+ expect(@elements[button_num.to_i - 1].value).to eql value
20
+ end
21
+
22
+ When(/^I select the text fields with class "([^"]*)"$/) do |class_name|
23
+ @elements = @page.text_field_elements(:class => class_name)
24
+ end
25
+
26
+ Then(/^I should have (\d+) text fields$/) do |num_text_fields|
27
+ expect(@elements.size).to eql num_text_fields.to_i
28
+ end
29
+
30
+ Then(/^the value of text field (\d+) should be "([^"]*)"$/) do |text_field_num, value|
31
+ expect(@elements[text_field_num.to_i - 1].value).to eql value
32
+ end
33
+
34
+ When(/^I select the hidden fields with class "([^"]*)"$/) do |class_name|
35
+ @elements = @page.hidden_field_elements(:class => class_name)
36
+ end
37
+
38
+ Then(/^I should have (\d+) hidden fields$/) do |num_hidden_fields|
39
+ expect(@elements.size).to eql num_hidden_fields.to_i
40
+ end
41
+
42
+ Then(/^the value of hidden field (\d+) should be "([^"]*)"$/) do |hidden_field_num, value|
43
+ expect(@elements[hidden_field_num.to_i - 1].value).to eql value
44
+ end
45
+
46
+ When(/^I select the text areas with class "([^"]*)"$/) do |class_name|
47
+ @elements = @page.text_area_elements(:class => class_name)
48
+ end
49
+
50
+ Then(/^I should have (\d+) text areas$/) do |num_text_areas|
51
+ expect(@elements.size).to eql num_text_areas.to_i
52
+ end
53
+
54
+ Then(/^the value of text area (\d+) should be "([^"]*)"$/) do |text_area_num, value|
55
+ expect(@elements[text_area_num.to_i - 1].value).to eql value
56
+ end
57
+
58
+ When(/^I select the select lists with class "([^"]*)"$/) do |class_name|
59
+ @elements = @page.select_list_elements(:class => class_name)
60
+ end
61
+
62
+ Then(/^I should have (\d+) select lists$/) do |num_select_lists|
63
+ expect(@elements.size).to eql num_select_lists.to_i
64
+ end
65
+
66
+ Then(/^the value of select list (\d+) should be "([^"]*)"$/) do |select_list_num, value|
67
+ expect(@elements[select_list_num.to_i - 1].value).to eql value
68
+ end
69
+
70
+ When(/^I select the link with class "([^"]*)"$/) do |class_name|
71
+ @elements = @page.link_elements(:class => class_name)
72
+ end
73
+
74
+ Then(/^I should have (\d+) links$/) do |num_links|
75
+ expect(@elements.size).to eql num_links.to_i
76
+ end
77
+
78
+ Then(/^the text of link (\d+) should be "([^"]*)"$/) do |link_num, text|
79
+ expect(@elements[link_num.to_i - 1].text).to eql text
80
+ end
81
+
82
+ When(/^I select the check boxes with class "([^"]*)"$/) do |class_name|
83
+ @elements = @page.checkbox_elements(:class => class_name)
84
+ end
85
+
86
+ Then(/^I should have (\d+) checkboxes$/) do |num_checkboxes|
87
+ expect(@elements.size).to eql num_checkboxes.to_i
88
+ end
89
+
90
+ Then(/^the value of checkbox (\d+) should be "([^"]*)"$/) do |checkbox_num, value|
91
+ expect(@elements[checkbox_num.to_i - 1].value).to eql value
92
+ end
93
+
94
+ When(/^I select the radio buttons with class "([^"]*)"$/) do |class_name|
95
+ @elements = @page.radio_button_elements(:class => class_name)
96
+ end
97
+
98
+ Then(/^I should have (\d+) radio buttons$/) do |num_radio_buttons|
99
+ expect(@elements.size).to eql num_radio_buttons.to_i
100
+ end
101
+
102
+ Then(/^the value of radio button (\d+) should be "([^"]*)"$/) do |radio_button_num, value|
103
+ expect(@elements[radio_button_num.to_i - 1].value).to eql value
104
+ end
105
+
106
+ When(/^I select the divs with class "([^"]*)"$/) do |class_name|
107
+ @elements = @page.div_elements(:class => class_name)
108
+ end
109
+
110
+ Then(/^I should have (\d+) divs$/) do |num_divs|
111
+ expect(@elements.size).to eql num_divs.to_i
112
+ end
113
+
114
+ Then(/^the text of div (\d+) should be "([^"]*)"$/) do |div_num, text|
115
+ expect(@elements[div_num.to_i - 1].text).to eql text
116
+ end
117
+
118
+ When(/^I select the spans with class "([^"]*)"$/) do |class_name|
119
+ @elements = @page.span_elements(:class => class_name)
120
+ end
121
+
122
+ Then(/^I should have (\d+) spans$/) do |num_spans|
123
+ expect(@elements.size).to eql num_spans.to_i
124
+ end
125
+
126
+ Then(/^the text of span (\d+) should be "([^"]*)"$/) do |span_num, text|
127
+ expect(@elements[span_num.to_i - 1].text).to eql text
128
+ end
129
+
130
+ When(/^I select the tables with class "([^"]*)"$/) do |class_name|
131
+ @elements = @page.table_elements(:class => class_name)
132
+ end
133
+
134
+ Then(/^I should have (\d+) tables$/) do |num_tables|
135
+ expect(@elements.size).to eql num_tables.to_i
136
+ end
137
+
138
+ Then(/^the first row first column for table (\d+) should have "([^"]*)"$/) do |table_num, text|
139
+ expect(@elements[table_num.to_i - 1][0][0].text).to eql text
140
+ end
141
+
142
+ When(/^I select the cells with class "([^"]*)"$/) do |class_name|
143
+ @elements = @page.cell_elements(:class => class_name)
144
+ end
145
+
146
+ Then(/^I should have (\d+) cells$/) do |num_cells|
147
+ expect(@elements.size).to eql num_cells.to_i
148
+ end
149
+
150
+ Then(/^the text for cell (\d+) should be "([^"]*)"$/) do |cell_num, text|
151
+ expect(@elements[cell_num.to_i - 1].text).to eql text
152
+ end
153
+
154
+ When(/^I select the images with class "([^"]*)"$/) do |class_name|
155
+ @elements = @page.image_elements(:class => class_name)
156
+ end
157
+
158
+ Then(/^I should have (\d+) images$/) do |num_images|
159
+ expect(@elements.size).to eql num_images.to_i
160
+ end
161
+
162
+ Then(/^the alt for image (\d+) should be "([^"]*)"$/) do |image_num , alt|
163
+ expect(@elements[image_num.to_i - 1].attribute(:alt)).to eql alt
164
+ end
165
+
166
+ When(/^I select the forms with class "([^"]*)"$/) do |class_name|
167
+ @elements = @page.form_elements(:class => class_name)
168
+ end
169
+
170
+ Then(/^I should have (\d+) forms$/) do |num_forms|
171
+ expect(@elements.size).to eql num_forms.to_i
172
+ end
173
+
174
+ Then(/^the action for form (\d+) should be "([^"]*)"$/) do |form_num, action|
175
+ expect(@elements[form_num.to_i - 1].attribute(:action)).to match action
176
+ end
177
+
178
+ When(/^I select the list items with class "([^"]*)"$/) do |class_name|
179
+ @elements = @page.list_item_elements(:class => class_name)
180
+ end
181
+
182
+ Then(/^I should have (\d+) list items$/) do |num_list_items|
183
+ expect(@elements.size).to eql num_list_items.to_i
184
+ end
185
+
186
+ Then(/^the text for list item (\d+) should be "([^"]*)"$/) do |list_item_num, text|
187
+ expect(@elements[list_item_num.to_i - 1].text).to eql text
188
+ end
189
+
190
+ When(/^I select the unordered lists with class "([^"]*)"$/) do |class_name|
191
+ @elements = @page.unordered_list_elements(:class => class_name)
192
+ end
193
+
194
+ Then(/^I should have (\d+) unordered lists$/) do |num_unordered_list|
195
+ expect(@elements.size).to eql num_unordered_list.to_i
196
+ end
197
+
198
+ Then(/^the text for the first item in unordered list (\d+) should be "([^"]*)"$/) do |ul_num, text|
199
+ expect(@elements[ul_num.to_i - 1][0].text).to eql text
200
+ end
201
+
202
+ When(/^I select the ordered lists with class "([^"]*)"$/) do |class_name|
203
+ @elements = @page.ordered_list_elements(:class => class_name)
204
+ end
205
+
206
+ Then(/^I should have (\d+) ordered lists$/) do |num_ol|
207
+ expect(@elements.size).to eql num_ol.to_i
208
+ end
209
+
210
+ Then(/^the text for the first item in ordered list (\d+) should be "([^"]*)"$/) do |ol_num, text|
211
+ expect(@elements[ol_num.to_i - 1][0].text).to eql text
212
+ end
213
+
214
+ When(/^I select the h1s with class "([^"]*)"$/) do |class_name|
215
+ @elements = @page.h1_elements(:class => class_name)
216
+ end
217
+
218
+ Then(/^I should have (\d+) h1s$/) do |num_h1s|
219
+ expect(@elements.size).to eql num_h1s.to_i
220
+ end
221
+
222
+ Then(/^the text for h1 (\d+) should be "([^"]*)"$/) do |h1_num, text|
223
+ expect(@elements[h1_num.to_i - 1].text).to eql text
224
+ end
225
+
226
+ When(/^I select the h2s with class "([^"]*)"$/) do |class_name|
227
+ @elements = @page.h2_elements(:class => class_name)
228
+ end
229
+
230
+ Then(/^I should have (\d+) h2s$/) do |num_h2s|
231
+ expect(@elements.size).to eql num_h2s.to_i
232
+ end
233
+
234
+ Then(/^the text for h2 (\d+) should be "([^"]*)"$/) do |h2_num, text|
235
+ expect(@elements[h2_num.to_i - 1].text).to eql text
236
+ end
237
+
238
+ When(/^I select the h3s with class "([^"]*)"$/) do |class_name|
239
+ @elements = @page.h3_elements(:class => class_name)
240
+ end
241
+
242
+ Then(/^I should have (\d+) h3s$/) do |num_h3s|
243
+ expect(@elements.size).to eql num_h3s.to_i
244
+ end
245
+
246
+ Then(/^the text for h3 (\d+) should be "([^"]*)"$/) do |h3_num, text|
247
+ expect(@elements[h3_num.to_i - 1].text).to eql text
248
+ end
249
+
250
+ When(/^I select the h4s with class "([^"]*)"$/) do |class_name|
251
+ @elements = @page.h4_elements(:class => class_name)
252
+ end
253
+
254
+ Then(/^I should have (\d+) h4s$/) do |num_h4s|
255
+ expect(@elements.size).to eql num_h4s.to_i
256
+ end
257
+
258
+ Then(/^the text for h4 (\d+) should be "([^"]*)"$/) do |h4_num, text|
259
+ expect(@elements[h4_num.to_i - 1].text).to eql text
260
+ end
261
+
262
+ When(/^I select the h5s with class "([^"]*)"$/) do |class_name|
263
+ @elements = @page.h5_elements(:class => class_name)
264
+ end
265
+
266
+ Then(/^I should have (\d+) h5s$/) do |num_h5s|
267
+ expect(@elements.size).to eql num_h5s.to_i
268
+ end
269
+
270
+ Then(/^the text for h5 (\d+) should be "([^"]*)"$/) do |h5_num, text|
271
+ expect(@elements[h5_num.to_i - 1].text).to eql text
272
+ end
273
+
274
+ When(/^I select the h6s with class "([^"]*)"$/) do |class_name|
275
+ @elements = @page.h6_elements(:class => class_name)
276
+ end
277
+
278
+ Then(/^I should have (\d+) h6s$/) do |num_h6s|
279
+ expect(@elements.size).to eql num_h6s.to_i
280
+ end
281
+
282
+ Then(/^the text for h6 (\d+) should be "([^"]*)"$/) do |h6_num, text|
283
+ expect(@elements[h6_num.to_i - 1].text).to eql text
284
+ end
285
+
286
+ When(/^I select the paragraphs with class "([^"]*)"$/) do |class_name|
287
+ @elements = @page.paragraph_elements(:class => class_name)
288
+ end
289
+
290
+ Then(/^I should have (\d+) paragraphs$/) do |num_paragraphs|
291
+ expect(@elements.size).to eql num_paragraphs.to_i
292
+ end
293
+
294
+ Then(/^the text for paragraph (\d+) should be "([^"]*)"$/) do |paragraph_num, text|
295
+ expect(@elements[paragraph_num.to_i - 1].text).to eql text
296
+ end