druid-ts 0.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +1 -0
  5. data/.travis.yml +1 -2
  6. data/ChangeLog +218 -0
  7. data/Gemfile +2 -1
  8. data/README.md +64 -7
  9. data/Rakefile +1 -1
  10. data/druid.gemspec +25 -0
  11. data/features/async.feature +18 -0
  12. data/features/button.feature +42 -1
  13. data/features/checkbox.feature +7 -1
  14. data/features/div.feature +6 -0
  15. data/features/element.feature +100 -0
  16. data/features/file_field.feature +35 -0
  17. data/features/form.feature +12 -6
  18. data/features/frames.feature +57 -0
  19. data/features/heading.feature +164 -0
  20. data/features/hidden_field.feature +6 -0
  21. data/features/html/async.html +18 -0
  22. data/features/html/frame_1.html +18 -0
  23. data/features/html/frame_2.html +16 -0
  24. data/features/html/frame_3.html +14 -0
  25. data/features/html/frames.html +12 -0
  26. data/features/html/iframes.html +12 -0
  27. data/features/html/modal.html +17 -0
  28. data/features/html/modal_1.html +38 -0
  29. data/features/html/modal_2.html +27 -0
  30. data/features/html/nested_elements.html +52 -0
  31. data/features/html/nested_frame_1.html +1 -0
  32. data/features/html/nested_frame_2.html +11 -0
  33. data/features/html/nested_frame_3.html +14 -0
  34. data/features/html/nested_frames.html +10 -0
  35. data/features/html/static_elements.html +29 -23
  36. data/features/image.feature +8 -0
  37. data/features/link.feature +5 -0
  38. data/features/list_item.feature +5 -0
  39. data/features/modal_dialog.feature +9 -0
  40. data/features/nested_elements.feature +105 -0
  41. data/features/ordered_list.feature +6 -0
  42. data/features/page_level_actions.feature +48 -0
  43. data/features/paragraph.feature +33 -0
  44. data/features/radio_button.feature +6 -0
  45. data/features/select_list.feature +6 -1
  46. data/features/span.feature +6 -1
  47. data/features/step_definations/async_steps.rb +63 -0
  48. data/features/step_definations/button_steps.rb +25 -1
  49. data/features/step_definations/checkbox_steps.rb +5 -1
  50. data/features/step_definations/div_steps.rb +6 -1
  51. data/features/step_definations/element_steps.rb +55 -1
  52. data/features/step_definations/file_field_steps.rb +27 -0
  53. data/features/step_definations/form_steps.rb +8 -0
  54. data/features/step_definations/frame_steps.rb +112 -0
  55. data/features/step_definations/heading_steps.rb +39 -0
  56. data/features/step_definations/hidden_field_steps.rb +7 -3
  57. data/features/step_definations/image_steps.rb +7 -3
  58. data/features/step_definations/link_steps.rb +8 -3
  59. data/features/step_definations/list_item_steps.rb +9 -1
  60. data/features/step_definations/modal_dialog_steps.rb +38 -0
  61. data/features/step_definations/nested_elements_steps.rb +196 -0
  62. data/features/step_definations/ordered_list_steps.rb +11 -3
  63. data/features/step_definations/page_level_actions_steps.rb +72 -0
  64. data/features/step_definations/paragraph_steps.rb +15 -0
  65. data/features/step_definations/radio_button_steps.rb +5 -1
  66. data/features/step_definations/select_list_steps.rb +10 -2
  67. data/features/step_definations/span_steps.rb +5 -1
  68. data/features/step_definations/table_cell_steps.rb +5 -1
  69. data/features/step_definations/table_steps.rb +17 -3
  70. data/features/step_definations/text_area_steps.rb +18 -2
  71. data/features/step_definations/text_field_steps.rb +9 -1
  72. data/features/step_definations/unordered_list_steps.rb +11 -3
  73. data/features/support/env.rb +0 -15
  74. data/features/support/hooks.rb +7 -0
  75. data/features/support/page.rb +98 -1
  76. data/features/support/persistent_browser.rb +15 -0
  77. data/features/support/url_helper.rb +24 -1
  78. data/features/table.feature +7 -0
  79. data/features/table_cell.feature +6 -0
  80. data/features/text_area.feature +11 -0
  81. data/features/text_field.feature +6 -1
  82. data/features/unordered_list.feature +6 -0
  83. data/lib/druid.rb +251 -3
  84. data/lib/druid/accessors.rb +446 -158
  85. data/lib/druid/assist.rb +394 -0
  86. data/lib/druid/core_ext/string.rb +5 -0
  87. data/lib/druid/element_locators.rb +405 -0
  88. data/lib/druid/elements.rb +28 -0
  89. data/lib/druid/elements/button.rb +6 -1
  90. data/lib/druid/elements/check_box.rb +26 -0
  91. data/lib/druid/elements/div.rb +3 -1
  92. data/lib/druid/elements/element.rb +170 -5
  93. data/lib/druid/elements/file_field.rb +18 -0
  94. data/lib/druid/elements/form.rb +11 -0
  95. data/lib/druid/elements/heading.rb +14 -0
  96. data/lib/druid/elements/hidden_field.rb +12 -2
  97. data/lib/druid/elements/image.rb +13 -0
  98. data/lib/druid/elements/link.rb +2 -0
  99. data/lib/druid/elements/list_item.rb +3 -1
  100. data/lib/druid/elements/option.rb +9 -0
  101. data/lib/druid/elements/ordered_list.rb +4 -5
  102. data/lib/druid/elements/paragraph.rb +9 -0
  103. data/lib/druid/elements/radio_button.rb +25 -0
  104. data/lib/druid/elements/select_list.rb +10 -1
  105. data/lib/druid/elements/span.rb +3 -1
  106. data/lib/druid/elements/table.rb +20 -1
  107. data/lib/druid/elements/table_cell.rb +7 -0
  108. data/lib/druid/elements/table_row.rb +5 -1
  109. data/lib/druid/elements/text_area.rb +15 -1
  110. data/lib/druid/elements/text_field.rb +11 -1
  111. data/lib/druid/elements/unordered_list.rb +5 -5
  112. data/lib/druid/nested_elements.rb +103 -0
  113. data/lib/druid/page_factory.rb +4 -4
  114. data/lib/druid/page_populator.rb +71 -0
  115. data/spec/druid/accessors_spec.rb +789 -0
  116. data/spec/druid/druid_spec.rb +130 -7
  117. data/spec/druid/element_locators_spec.rb +160 -0
  118. data/spec/druid/elements/button_spec.rb +31 -0
  119. data/spec/druid/elements/check_box_spec.rb +38 -0
  120. data/spec/druid/elements/div_spec.rb +19 -0
  121. data/spec/druid/elements/element_spec.rb +150 -0
  122. data/spec/druid/elements/file_field_spec.rb +27 -0
  123. data/spec/druid/elements/form_spec.rb +27 -0
  124. data/spec/druid/elements/heading_spec.rb +39 -0
  125. data/spec/druid/elements/hidden_field_spec.rb +24 -0
  126. data/spec/druid/elements/image_spec.rb +32 -0
  127. data/spec/druid/elements/link_spec.rb +26 -0
  128. data/spec/druid/elements/list_item_spec.rb +19 -0
  129. data/spec/druid/elements/option_spec.rb +10 -0
  130. data/spec/druid/elements/ordered_list_spec.rb +42 -0
  131. data/spec/druid/elements/page_factory_spec.rb +40 -0
  132. data/spec/druid/elements/paragraph_spec.rb +21 -0
  133. data/spec/druid/elements/radio_button_spec.rb +38 -0
  134. data/spec/druid/elements/select_list_spec.rb +37 -0
  135. data/spec/druid/elements/span_spec.rb +19 -0
  136. data/spec/druid/elements/table_cell_spec.rb +23 -0
  137. data/spec/druid/elements/table_row_spec.rb +41 -0
  138. data/spec/druid/elements/table_spec.rb +52 -0
  139. data/spec/druid/elements/text_area_spec.rb +31 -0
  140. data/spec/druid/elements/text_field_spec.rb +31 -0
  141. data/spec/druid/elements/unordered_list_spec.rb +42 -0
  142. data/spec/druid/nested_element_spec.rb +128 -0
  143. data/spec/druid/page_populator_spec.rb +92 -0
  144. data/spec/spec_helper.rb +2 -1
  145. metadata +147 -27
@@ -5,7 +5,7 @@ Feature: Check Box
5
5
  Background:
6
6
  Given I am on the static elements page
7
7
 
8
- Scenario: Selecting an element on the checkbox
8
+ Scenario: Selecting a checkbox
9
9
  When I select the First check box
10
10
  Then the First check box should be selected
11
11
  When I unselect the First check box
@@ -22,6 +22,7 @@ Feature: Check Box
22
22
  | name |
23
23
  | xpath |
24
24
  | index |
25
+ | value |
25
26
 
26
27
  Scenario: Retrieve a CheckBox
27
28
  When I retrieve a check box element
@@ -37,3 +38,8 @@ Feature: Check Box
37
38
  | param1 | param2 |
38
39
  | class | index |
39
40
  | name | index |
41
+
42
+ @locator
43
+ Scenario: Finding a check box dynamically
44
+ When I select the first check box while the script is executing
45
+ Then the First check box should be selected
@@ -21,6 +21,7 @@ Feature: Div
21
21
  | xpath |
22
22
  | index |
23
23
  | name |
24
+ | text |
24
25
 
25
26
  Scenario: Getting the div element
26
27
  When I retrieve the div element
@@ -36,3 +37,8 @@ Feature: Div
36
37
  | param1 | param2 |
37
38
  | class | index |
38
39
  | name | index |
40
+
41
+ @locator
42
+ Scenario: Finding a div dynamically
43
+ When I get the text from a div while the script is executing
44
+ Then the text should be "page-object rocks!"
@@ -3,6 +3,12 @@ Feature: Elements
3
3
  Background:
4
4
  Given I am on the static elements page
5
5
 
6
+ Scenario: Elements enbaled?
7
+ When I click an enabled button
8
+ Then it should know it is enabled
9
+ When I check a disabled button
10
+ Then it should know it is not enabled
11
+
6
12
  Scenario: Link element methods
7
13
  When I retrieve a link element
8
14
  Then I should know it exists
@@ -112,3 +118,97 @@ Feature: Elements
112
118
  And I should know its' tag name is "img"
113
119
  And I should know the attribute "readonly" is false
114
120
  And I should be able to click it
121
+
122
+ Scenario: Hidden Field element methods
123
+ When I retrieve the hidden field element
124
+ Then I should know it exists
125
+ And I should know it is not visible
126
+ And I should know its' text includes ""
127
+ And I should know its' value is "12345"
128
+ And I should know it is equal to itself
129
+ And I should know its' tag name is "input"
130
+ And I should know the attribute "readonly" is false
131
+
132
+ Scenario: Form element methods
133
+ When I locate the form
134
+ Then I should know it exists
135
+ And I should know it is visible
136
+ And I should know its' text includes ""
137
+ And I should know it is equal to itself
138
+ And I should know its' tag name is "form"
139
+ And I should know the attribute "readonly" is false
140
+ And I should know its' value is ""
141
+
142
+ Scenario: Text Area element methods
143
+ When I retrieve the text area
144
+ Then I should know it exists
145
+ And I should know it is visible
146
+ And I should know its' text includes ""
147
+ And I should know its' value is ""
148
+ And I should know it is equal to itself
149
+ And I should know its' tag name is "textarea"
150
+ And I should know the attribute "readonly" is false
151
+ And I should be able to click it
152
+
153
+ Scenario: List item element methods
154
+ When I retrieve a list item element
155
+ Then I should know it exists
156
+ And I should know it is visible
157
+ And I should know its' text is "Item One"
158
+ And I should know it is equal to itself
159
+ And I should know its' tag name is "li"
160
+ And I should know the attribute "readonly" is false
161
+ And I should be able to click it
162
+
163
+ Scenario: Unordered List element methods
164
+ When I retrieve a unordered list element
165
+ Then I should know it exists
166
+ And I should know it is visible
167
+ And I should know its' text includes "Item One"
168
+ And I should know its' text includes "Item Two"
169
+ And I should know its' text includes "Item Three"
170
+ And I should know it is equal to itself
171
+ And I should know its' tag name is "ul"
172
+ And I should know the attribute "readonly" is false
173
+ And I should be able to click it
174
+
175
+ Scenario: Ordered List element methods
176
+ When I retrieve a ordered list element
177
+ Then I should know it exists
178
+ And I should know it is visible
179
+ And I should know its' text includes "Number One"
180
+ And I should know its' text includes "Number Two"
181
+ And I should know its' text includes "Number Three"
182
+ And I should know it is equal to itself
183
+ And I should know its' tag name is "ol"
184
+ And I should know the attribute "readonly" is false
185
+ And I should be able to click it
186
+
187
+ Scenario: Clear an element
188
+ When I type "abcDEF" into the text field
189
+ Then the text field should contain "abcDEF"
190
+ When I clear the text field
191
+ Then the text field should contain ""
192
+
193
+ Scenario: Heading element methods
194
+ When I retrieve a heading element
195
+ Then I should know it exists
196
+ And I should know it is visible
197
+ And I should know its' text is "h1's are cool"
198
+ And I should know it is equal to itself
199
+ And I should know its' tag name is "h1"
200
+ And I should know the attribute "readonly" is false
201
+ And I should be able to click it
202
+
203
+ Scenario: Firing an event
204
+ When I set the focus to the test text_field using the onfocus event
205
+ Then I should see the onfocus text "changed by onfocus event"
206
+
207
+ Scenario: Setting focus on an element
208
+ When I set the focus on the test text_field
209
+ Then I should see the onfocus text "changed by onfocus event"
210
+
211
+ Scenario: Finding a parent element
212
+ When I find the child link element
213
+ And ask for the parent element
214
+ Then I should have a div parent
@@ -0,0 +1,35 @@
1
+ Feature: File Field
2
+
3
+ Background:
4
+ Given I am on the static elements page
5
+
6
+ Scenario: Setting the value on the file Field
7
+ When I set the file field to the step definition file
8
+ Then This filefield element should exist
9
+
10
+ Scenario Outline: Locating file fields on the Page
11
+ When I search for the file field by "<search_by>"
12
+ Then I should be able to set the file field
13
+
14
+ Examples:
15
+ | search_by |
16
+ | id |
17
+ | class |
18
+ | name |
19
+ | xpath |
20
+ | title |
21
+ | index |
22
+
23
+ Scenario Outline: Locating file fields using multiple parameters
24
+ When I search for the file field by "<param1>" and "<param2>"
25
+ Then I should be able to set the file field
26
+
27
+ Examples:
28
+ | param1 | param2 |
29
+ | class | index |
30
+ | name | index |
31
+
32
+ @locator
33
+ Scenario: Finding a file field dynamically
34
+ When I locate a file field while the script is executing
35
+ Then The file field should exist
@@ -17,13 +17,19 @@ Feature: Form
17
17
  | class |
18
18
  | xpath |
19
19
  | index |
20
+ | action |
20
21
 
21
22
  @multi
22
23
  Scenario Outline: Locating table using multiple parameters
23
- When I locate the form using "<param1>" and "<param2>"
24
- Then I should be able to submit the form
24
+ When I locate the form using "<param1>" and "<param2>"
25
+ Then I should be able to submit the form
26
+
27
+ Examples:
28
+ | param1 | param2 |
29
+ | class | index |
30
+ | name | index |
25
31
 
26
- Examples:
27
- | param1 | param2 |
28
- | class | index |
29
- | name | index |
32
+ @locator
33
+ Scenario: Finding a form dynamically
34
+ When I locate a form while the script is executing
35
+ Then I should be able to submit the form
@@ -0,0 +1,57 @@
1
+ Feature: Handling frames
2
+
3
+ Scenario: Accessing elements within the frame
4
+ Given I am on the frame elements page
5
+ When I type "page-object" into the text field for frame 2 using "id"
6
+ Then I should verify "page-object" is in the text field for frame 2 using "id"
7
+ When I type "page-object" into the text field for frame 2 using "name"
8
+ Then I should verify "page-object" is in the text field for frame 2 using "name"
9
+ When I type "page-object" into the text field for frame 2 using "index"
10
+ Then I should verify "page-object" is in the text field for frame 2 using "index"
11
+
12
+ Scenario: Switching between frames
13
+ Given I am on the frame elements page
14
+ When I type "page-object" into the text field for frame 2 using "id"
15
+ And I type "page-object" into the text field from frame 1 using "id"
16
+ Then I should verify "page-object" is in the text field for frame 2 using "id"
17
+ And I should verify "page-object" is in the text field for frame 1 using "id"
18
+
19
+ Scenario: Accessing elements within the iframe
20
+ Given I am on the iframe elements page
21
+ When I type "page-object" into the text field for frame 2 using "id"
22
+ Then I should verify "page-object" is in the text field for frame 2 using "id"
23
+ When I type "page-object" into the text field for frame 2 using "name"
24
+ Then I should verify "page-object" is in the text field for frame 2 using "name"
25
+ When I type "page-object" into the text field for frame 2 using "index"
26
+ Then I should verify "page-object" is in the text field for frame 2 using "index"
27
+
28
+ Scenario: Switching between iframes
29
+ Given I am on the iframe elements page
30
+ When I type "page-object" into the text field for frame 2 using "id"
31
+ And I type "page-object" into the text field from frame 1 using "id"
32
+ Then I should verify "page-object" is in the text field for frame 2 using "id"
33
+ And I should verify "page-object" is in the text field for frame 1 using "id"
34
+
35
+ Scenario: Nested frames
36
+ Given I am on the nested frame elements page
37
+ Then I should be able to click the link in the frame
38
+
39
+ Scenario: Identifying items in frames at runtime
40
+ Given I am on the frame elements page
41
+ When I type "page-object" into the text field from frame 1 identified dynamically
42
+ Then I should verify "page-object" in the text field for frame 1 identified dynamically
43
+
44
+ Scenario: Handling alerts inside frames
45
+ Given I am on the frame elements page
46
+ When I trigger an alert within a frame
47
+ Then I should be able to get the alert's message
48
+
49
+ Scenario: Handling confirms inside frames
50
+ Given I am on the frame elements page
51
+ When I trigger an confirm within a frame
52
+ Then I should be able to get the confirm's message
53
+
54
+ Scenario: Handling prompts inside frames
55
+ Given I am on the frame elements page
56
+ When I trigger an prompt within a frame
57
+ Then I should be able to get the message and default value
@@ -0,0 +1,164 @@
1
+ Feature: Headings
2
+
3
+ Background:
4
+ Given I am on the static elements page
5
+
6
+ Scenario: Getting the text of headings
7
+ When I get the text for the "h1" element
8
+ Then I should see "h1's are cool"
9
+ When I get the text for the "h2" element
10
+ Then I should see "h2's are cool"
11
+ When I get the text for the "h3" element
12
+ Then I should see "h3's are cool"
13
+ When I get the text for the "h4" element
14
+ Then I should see "h4's are cool"
15
+ When I get the text for the "h5" element
16
+ Then I should see "h5's are cool"
17
+ When I get the text for the "h6" element
18
+ Then I should see "h6's are cool"
19
+
20
+
21
+ Scenario Outline: Locating h1s on the Page
22
+ When I search for the heading1 by "<search_by>"
23
+ Then I should see "h1's are cool"
24
+
25
+ Examples:
26
+ | search_by |
27
+ | id |
28
+ | class |
29
+ | name |
30
+ | xpath |
31
+ | index |
32
+
33
+ @multi
34
+ Scenario Outline: Locating h1 using multiple parameters
35
+ When I locate the h1 using "<param1>" and "<param2>"
36
+ Then the text should be "h1's are cool"
37
+
38
+ Examples:
39
+ | param1 | param2 |
40
+ | class | index |
41
+ | name | index |
42
+
43
+ @locator
44
+ Scenario: Finding a h1 dynamically
45
+ When I locate a h1 while the script is executing
46
+ Then the text should be "h1's are cool"
47
+
48
+ Scenario Outline: Locating h2s on the Page
49
+ When I search for the heading2 by "<search_by>"
50
+ Then I should see "h2's are cool"
51
+
52
+ Examples:
53
+ | search_by |
54
+ | id |
55
+ | class |
56
+ | name |
57
+ | xpath |
58
+ | index |
59
+
60
+ @multi
61
+ Scenario Outline: Locating h2 using multiple parameters
62
+ When I locate the h2 using "<param1>" and "<param2>"
63
+ Then the text should be "h2's are cool"
64
+
65
+ Examples:
66
+ | param1 | param2 |
67
+ | class | index |
68
+ | name | index |
69
+
70
+ @locator
71
+ Scenario: Finding a h2 dynamically
72
+ When I locate a h2 while the script is executing
73
+ Then the text should be "h2's are cool"
74
+
75
+ Scenario Outline: Locating h3s on the Page
76
+ When I search for the heading3 by "<search_by>"
77
+ Then I should see "h3's are cool"
78
+
79
+ Examples:
80
+ | search_by |
81
+ | id |
82
+ | class |
83
+ | name |
84
+ | xpath |
85
+ | index |
86
+
87
+ @multi
88
+ Scenario Outline: Locating h3 using multiple parameters
89
+ When I locate the h3 using "<param1>" and "<param2>"
90
+ Then the text should be "h3's are cool"
91
+
92
+ Examples:
93
+ | param1 | param2 |
94
+ | class | index |
95
+ | name | index |
96
+
97
+ @locator
98
+ Scenario: Finding a h3 dynamically
99
+ When I locate a h3 while the script is executing
100
+ Then the text should be "h3's are cool"
101
+
102
+
103
+ Scenario Outline: Locating h4s on the Page
104
+ When I search for the heading4 by "<search_by>"
105
+ Then I should see "h4's are cool"
106
+
107
+ Examples:
108
+ | search_by |
109
+ | id |
110
+ | class |
111
+ | name |
112
+ | xpath |
113
+ | index |
114
+
115
+ @multi
116
+ Scenario Outline: Locating h4 using multiple parameters
117
+ When I locate the h4 using "<param1>" and "<param2>"
118
+ Then the text should be "h4's are cool"
119
+
120
+ Examples:
121
+ | param1 | param2 |
122
+ | class | index |
123
+ | name | index |
124
+
125
+
126
+ @locator
127
+ Scenario: Finding a h4 dynamically
128
+ When I locate a h4 while the script is executing
129
+ Then the text should be "h4's are cool"
130
+
131
+ Scenario Outline: Locating h5s on the Page
132
+ When I search for the heading5 by "<search_by>"
133
+ Then I should see "h5's are cool"
134
+
135
+ Examples:
136
+ | search_by |
137
+ | id |
138
+ | class |
139
+ | name |
140
+ | xpath |
141
+ | index |
142
+
143
+ @locator
144
+ Scenario: Finding a h5 dynamically
145
+ When I locate a h5 while the script is executing
146
+ Then the text should be "h5's are cool"
147
+
148
+
149
+ Scenario Outline: Locating h6s on the Page
150
+ When I search for the heading6 by "<search_by>"
151
+ Then I should see "h6's are cool"
152
+
153
+ Examples:
154
+ | search_by |
155
+ | id |
156
+ | class |
157
+ | name |
158
+ | xpath |
159
+ | index |
160
+
161
+ @locator
162
+ Scenario: Finding a h6 dynamically
163
+ When I locate a h6 while the script is executing
164
+ Then the text should be "h6's are cool"
@@ -21,6 +21,7 @@ Feature: Hidden Fields
21
21
  | tag_name |
22
22
  | index |
23
23
  | text |
24
+ | value |
24
25
 
25
26
  @multi
26
27
  Scenario Outline: Locating a hidden field using multiple parameters
@@ -31,3 +32,8 @@ Feature: Hidden Fields
31
32
  | param1 | param2 |
32
33
  | class | index |
33
34
  | name | index |
35
+
36
+ @locator
37
+ Scenario: Finding a hidden field dynamically
38
+ When I find a hidden field while the script is executing
39
+ Then hidden field element should contains "12345"