druid-ts 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +59 -0
  3. data/Gemfile +1 -0
  4. data/druid.gemspec +1 -0
  5. data/features/area.feature +1 -0
  6. data/features/audio.feature +1 -0
  7. data/features/canvas.feature +1 -0
  8. data/features/checkbox.feature +2 -0
  9. data/features/div.feature +1 -0
  10. data/features/element.feature +15 -0
  11. data/features/file_field.feature +2 -0
  12. data/features/form.feature +1 -0
  13. data/features/generic_elements.feature +5 -0
  14. data/features/heading.feature +6 -0
  15. data/features/hidden_field.feature +1 -0
  16. data/features/html/images/img_pulpit.jpg +0 -0
  17. data/features/html/static_elements.html +19 -1
  18. data/features/image.feature +1 -0
  19. data/features/label.feature +1 -0
  20. data/features/list_item.feature +1 -0
  21. data/features/multi_elements.feature +7 -0
  22. data/features/ordered_list.feature +1 -0
  23. data/features/paragraph.feature +1 -0
  24. data/features/radio_button.feature +2 -0
  25. data/features/select_list.feature +2 -2
  26. data/features/span.feature +2 -1
  27. data/features/step_definations/element_steps.rb +25 -0
  28. data/features/step_definations/generic_element_steps.rb +12 -0
  29. data/features/step_definations/multi_elements_steps.rb +5 -0
  30. data/features/support/page.rb +37 -2
  31. data/features/table.feature +1 -0
  32. data/features/table_cell.feature +1 -0
  33. data/features/text_area.feature +2 -0
  34. data/features/text_field.feature +2 -0
  35. data/features/unordered_list.feature +1 -0
  36. data/features/video.feature +1 -0
  37. data/lib/druid/accessors.rb +117 -84
  38. data/lib/druid/assist.rb +19 -1
  39. data/lib/druid/elements/canvas.rb +1 -1
  40. data/lib/druid/elements/check_box.rb +1 -1
  41. data/lib/druid/elements/element.rb +1 -1
  42. data/lib/druid/elements/file_field.rb +1 -1
  43. data/lib/druid/elements/radio_button.rb +1 -1
  44. data/lib/druid/elements/select_list.rb +1 -1
  45. data/lib/druid/elements/text_area.rb +3 -0
  46. data/lib/druid/locator_generator.rb +112 -58
  47. data/lib/druid/page_factory.rb +17 -83
  48. data/lib/druid/page_populator.rb +2 -1
  49. data/lib/druid/version.rb +1 -1
  50. data/spec/druid/druid_spec.rb +1 -1
  51. data/spec/druid/page_factory_spec.rb +12 -11
  52. data/spec/druid/page_populator_spec.rb +27 -0
  53. metadata +17 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fea63e0e39bb671b5e23a9be17e0b7e4f5dd947
4
- data.tar.gz: 774a427a1de59e651cf3e04fe3beb74e75e2d33b
3
+ metadata.gz: 223b927cff511fe3738931183652014d9fdbda26
4
+ data.tar.gz: 3a537221dd35b55e76e041c5843c9edc578e50ed
5
5
  SHA512:
6
- metadata.gz: e0cbcc12bd07002c104cd2917143d965c2d5a83d879f968afe4a787de343be843a962802985c0ed65b4f3ecf16776734dd3eaa70f3fa98a498dacddaeecdf90e
7
- data.tar.gz: 14fc2d10172626f055c285414c4100d81199378bb1eab28af47779ff3aa03f6d10d648b315d252d309d04a40e8c7b63a0f65be1bdd02291e5a4ab41c3b78e957
6
+ metadata.gz: 185b221ecef0f768a161ad3eeeb66d6f627050e264225942e12691fccba97cfd41f12043d60d0dfb1cc05d64d162c50d3b5d1908ff14dea9617bfdc2eb6df9a1
7
+ data.tar.gz: 3180f4ad4980423dcf9571a6a73ff9e7169758797a1dd9e9c3cafbab2fdc256cd5a8918bc3b159870ebb779fb7e9e4b30aaffc02703d7cd18552428f3da0055c
data/ChangeLog CHANGED
@@ -1,3 +1,62 @@
1
+ === 2017-01-19
2
+ * Enhancements
3
+ * Added elements method to accessor so one can generate methods for generic collections of elements
4
+ === Version 1.1.8/2017-01-18
5
+ * Enhancements
6
+ * Added ability to find elements using any valid attribute
7
+ * Updated populate_page_with to also check if the element is visible prior to setting value
8
+ * Added plural _elements methods for the following types:
9
+ * area
10
+ * canvas
11
+ * audio
12
+ * video
13
+ * svg
14
+ * Added basic element support for the following types:
15
+ * as
16
+ * blockquote
17
+ * body
18
+ * br
19
+ * caption
20
+ * col
21
+ * colgroup
22
+ * command
23
+ * data
24
+ * datalist
25
+ * del
26
+ * details
27
+ * dialog
28
+ * dl
29
+ * embed
30
+ * fieldset
31
+ * head
32
+ * hr
33
+ * ins
34
+ * keygen
35
+ * legend
36
+ * map
37
+ * menu
38
+ * meta
39
+ * meter
40
+ * object
41
+ * optgroup
42
+ * output
43
+ * param
44
+ * pre
45
+ * progress
46
+ * small
47
+ * strong
48
+ * style
49
+ * time
50
+ * title
51
+ * track
52
+ * Fixes
53
+ * Fixed issue when using the page and element accessors for html 5 elements
54
+ === 2017-01-17
55
+ * Enhancements
56
+ * Added :using_params parameter to both on_page and if_page methods
57
+ * Fixed issue with generic element calls
58
+ * Added support for the svg element
59
+ * Support label locators on TextArea, SelectList, RadioButton and FileField
1
60
  === Version-1.1.7/2017-01-16
2
61
  * Enhancements
3
62
  * Updated expected_element to use the global default element wait by default
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem 'rspec'
8
8
  gem 'cucumber'
9
9
  gem 'rack'
10
10
  gem 'net-http-persistent'
11
+ gem 'page_navigation'
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency "watir-webdriver", ">= 0.9.1"
23
+ s.add_dependency "page_navigation", ">= 0.10"
23
24
  s.add_development_dependency "rspec", ">= 3.4.0"
24
25
  s.add_development_dependency "cucumber", ">= 1.3.20"
25
26
  s.add_development_dependency "rack", ">= 1.0"
@@ -19,6 +19,7 @@ Feature: Area
19
19
  | name |
20
20
  | xpath |
21
21
  | index |
22
+ | css |
22
23
 
23
24
  Scenario: Getting the coordinates for the area
24
25
  When I retrieve the area element
@@ -19,6 +19,7 @@ Feature: Support for the audio element
19
19
  | name |
20
20
  | xpath |
21
21
  | index |
22
+ | css |
22
23
 
23
24
  Scenario Outline: Locating audios using multiple parameters
24
25
  When I search for the audio element by "<param1>" and "<param2>"
@@ -19,6 +19,7 @@ Feature: Support for the canvas element
19
19
  | name |
20
20
  | xpath |
21
21
  | index |
22
+ | css |
22
23
 
23
24
  Scenario: Determining the width and height of the canvas
24
25
  When I retrieve the canvas element
@@ -23,6 +23,8 @@ Feature: Check Box
23
23
  | xpath |
24
24
  | index |
25
25
  | value |
26
+ | label |
27
+ | css |
26
28
 
27
29
  Scenario: Retrieve a CheckBox
28
30
  When I retrieve a check box element
@@ -23,6 +23,7 @@ Feature: Div
23
23
  | name |
24
24
  | text |
25
25
  | title |
26
+ | css |
26
27
 
27
28
  Scenario: Getting the div element
28
29
  When I retrieve the div element
@@ -24,6 +24,7 @@ Feature: Elements
24
24
  And I should know it is equal to itself
25
25
  And I should know its' tag name is "a"
26
26
  And I should know the attribute "readonly" is false
27
+ And I should know the attribute "href" includes "success.html"
27
28
  And I should know its' value is ""
28
29
  And I should be able to click it
29
30
 
@@ -237,3 +238,17 @@ Feature: Elements
237
238
  When I retrieve a heading element
238
239
  And I scroll the heading element into view
239
240
  Then the heading element should be visible
241
+
242
+ Scenario: Expanding how we find elemnts to include non-stardard locators
243
+ When I retrieve a div using data-entity
244
+ Then I should know it exists
245
+ And I should know it is visible
246
+ And I should know the text is "found using data-entity"
247
+
248
+ Scenario: Accessing an HTML 5 element using the declaration
249
+ When I retrieve the figure uisng the declaration
250
+ Then I should see the figure contains an image
251
+
252
+ Scenario: Accessing an HTML 5 element using the element method
253
+ When I retrieve the figure using the element
254
+ Then I should see the figure contains an image
@@ -19,6 +19,8 @@ Feature: File Field
19
19
  | xpath |
20
20
  | title |
21
21
  | index |
22
+ | label |
23
+ | css |
22
24
 
23
25
  Scenario Outline: Locating file fields using multiple parameters
24
26
  When I search for the file field by "<param1>" and "<param2>"
@@ -18,6 +18,7 @@ Feature: Form
18
18
  | xpath |
19
19
  | index |
20
20
  | action |
21
+ | css |
21
22
 
22
23
  @multi
23
24
  Scenario Outline: Locating table using multiple parameters
@@ -22,3 +22,8 @@ Feature: Generic Elements
22
22
  Scenario: Getting the text from the details element
23
23
  When I get the text from the details
24
24
  Then the text should be "The summary The details"
25
+
26
+ Scenario: Getting properties from a svg element
27
+ When I get the svg element
28
+ Then the svg width should be "100"
29
+ And the svg height should be "100"
@@ -29,6 +29,7 @@ Feature: Headings
29
29
  | name |
30
30
  | xpath |
31
31
  | index |
32
+ | css |
32
33
 
33
34
  @multi
34
35
  Scenario Outline: Locating h1 using multiple parameters
@@ -56,6 +57,7 @@ Feature: Headings
56
57
  | name |
57
58
  | xpath |
58
59
  | index |
60
+ | css |
59
61
 
60
62
  @multi
61
63
  Scenario Outline: Locating h2 using multiple parameters
@@ -83,6 +85,7 @@ Feature: Headings
83
85
  | name |
84
86
  | xpath |
85
87
  | index |
88
+ | css |
86
89
 
87
90
  @multi
88
91
  Scenario Outline: Locating h3 using multiple parameters
@@ -111,6 +114,7 @@ Feature: Headings
111
114
  | name |
112
115
  | xpath |
113
116
  | index |
117
+ | css |
114
118
 
115
119
  @multi
116
120
  Scenario Outline: Locating h4 using multiple parameters
@@ -139,6 +143,7 @@ Feature: Headings
139
143
  | name |
140
144
  | xpath |
141
145
  | index |
146
+ | css |
142
147
 
143
148
  @locator
144
149
  Scenario: Finding a h5 dynamically
@@ -157,6 +162,7 @@ Feature: Headings
157
162
  | name |
158
163
  | xpath |
159
164
  | index |
165
+ | css |
160
166
 
161
167
  @locator
162
168
  Scenario: Finding a h6 dynamically
@@ -20,6 +20,7 @@ Feature: Hidden Fields
20
20
  | index |
21
21
  | text |
22
22
  | value |
23
+ | css |
23
24
 
24
25
  @multi
25
26
  Scenario Outline: Locating a hidden field using multiple parameters
@@ -6,13 +6,15 @@
6
6
  <p id="p_id" name="p_name" class="p_class">Static Elements Page</p>
7
7
  <label for="text_field_id">Text Field</label>
8
8
  <input id="text_field_id" name="text_field_name" class="text_field_class" title="text_field_title"
9
- size="40" type="text" />
9
+ data-field="title" size="40" type="text"/>
10
10
 
11
11
  <input id="hidden_field_id" name="hidden_field_name" class="hidden_field_class"
12
12
  size="40" type="hidden" value="12345" />
13
13
 
14
+ <label for="text_area_id">Text Area</label>
14
15
  <textarea rows="2" cols="20" id="text_area_id" class="text_area_class" name="text_area_name"></textarea>
15
16
 
17
+ <label for="sel_list_id">Select List</label>
16
18
  <select name="sel_list_name" id="sel_list_id" class="sel_list_class">
17
19
  <option value="option1">Test 1</option>
18
20
  <option value="option2">Test 2</option>
@@ -49,10 +51,16 @@
49
51
  Your Browser does not support the video tag.
50
52
  </video>
51
53
 
54
+ <svg width="100" height="100" id="the_svg">
55
+ <circle cx="50" cy="50" r="40" fill="red" stroke="blue" stroke-width="5" />
56
+ </svg>
57
+
52
58
  <a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title" >Google Search</a>
53
59
 
60
+ <label for="cb_id">Checkbox</label>
54
61
  <input id="cb_id" name="cb_name" class="cb_class" type="checkbox" value="1" />
55
62
 
63
+ <label for="milk_id">Radio</label>
56
64
  <input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br />
57
65
  <input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
58
66
 
@@ -60,6 +68,10 @@
60
68
  page-object rocks!
61
69
  </div>
62
70
 
71
+ <div data-entity="test">
72
+ found using data-entity
73
+ </div>
74
+
63
75
  <span id="span_id" name="span_name" class="span_class" title="span_title">
64
76
  My alert
65
77
  </span>
@@ -111,6 +123,8 @@
111
123
 
112
124
  <form id="form_id" class="form_class" name="form_name" action="/">
113
125
  </form>
126
+
127
+ <label for="file_field_id">File Field</label>
114
128
  <input type="file" name="file_field_name" id="file_field_id" class="file_field_class" title="file_field_title" />
115
129
 
116
130
  <ul id="ul_id" name="ul_name" class="ul_class">
@@ -159,5 +173,9 @@
159
173
  The details
160
174
  </details>
161
175
 
176
+ <figure id='figure_id'>
177
+ <img src="images/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
178
+ </figure>
179
+
162
180
  </body>
163
181
  </html>
@@ -22,6 +22,7 @@ Feature: Image
22
22
  | index |
23
23
  | alt |
24
24
  | src |
25
+ | css |
25
26
 
26
27
  @multi
27
28
  Scenario Outline: Locating an image using multiple parameters
@@ -28,6 +28,7 @@ Feature: Handling labels with page object
28
28
  | index |
29
29
  | name |
30
30
  | text |
31
+ | css |
31
32
 
32
33
  Scenario Outline: Locating lables using multiple parameters
33
34
  When I search for the label by "<param1>" and "<param2>"
@@ -20,6 +20,7 @@ Feature: List item
20
20
  | index |
21
21
  | name |
22
22
  | text |
23
+ | css |
23
24
 
24
25
  @multi
25
26
  Scenario Outline: Locating list items using multiple parameters
@@ -477,3 +477,10 @@ Feature: Multi Elements
477
477
  And the text of div 1 should be "Div 1"
478
478
  And the text of div 2 should be "Div 2"
479
479
  And the text of div 3 should be "Div 3"
480
+
481
+ Scenario: Selecting multiple generic element types
482
+ When I select the multiple elements with a tag label
483
+ Then I should have 3 labels
484
+ And the text for label 1 should be "Label 1"
485
+ And the text for label 2 should be "Label 2"
486
+ And the text for label 3 should be "Label 3"
@@ -22,6 +22,7 @@ Feature: Ordered list
22
22
  | xpath |
23
23
  | index |
24
24
  | name |
25
+ | css |
25
26
 
26
27
  @multi
27
28
  Scenario Outline: Locating ordered lists using multiple parameters
@@ -18,6 +18,7 @@ Feature: Paragraph
18
18
  | xpath |
19
19
  | index |
20
20
  | name |
21
+ | css |
21
22
 
22
23
  Scenario Outline: Locating paragraphs using multiple parameters
23
24
  When I search for the paragraph by "<param1>" and "<param2>"
@@ -25,6 +25,8 @@ Feature: Radio Buttons
25
25
  | xpath |
26
26
  | index |
27
27
  | value |
28
+ | label |
29
+ | css |
28
30
 
29
31
  Scenario: Retrieve a radio button
30
32
  When I retrieve a radio button
@@ -22,8 +22,8 @@ Feature: Select List
22
22
  | name |
23
23
  | xpath |
24
24
  | index |
25
- # | value |
26
- # | text |
25
+ | label |
26
+ | css |
27
27
 
28
28
  Scenario: Retrieve a select list
29
29
  When I retrieve a select list
@@ -21,7 +21,8 @@ Feature: Span
21
21
  | name |
22
22
  | text |
23
23
  | title |
24
-
24
+ | css |
25
+
25
26
  Scenario: Retrieve a Span
26
27
  When I retrieve a span element
27
28
  Then I should know it exists
@@ -142,3 +142,28 @@ end
142
142
  Then(/^the heading element should be visible$/) do
143
143
  expect(@element).to be_visible
144
144
  end
145
+
146
+ When(/^I retrieve a div using data\-entity$/) do
147
+ @element = @page.div_data_entity_element
148
+ end
149
+
150
+ Then(/^I should know the text is "([^"]*)"$/) do |text|
151
+ expect(@element.text).to eql text
152
+ end
153
+
154
+ When(/^I retrieve the figure uisng the declaration$/) do
155
+ @element = @page.figure_id_element
156
+ end
157
+
158
+ Then(/^I should see the figure contains an image$/) do
159
+ expect(@element.image_element).not_to be nil
160
+ end
161
+
162
+ When(/^I retrieve the figure using the element$/) do
163
+ @element = @page.figure_element(:id => 'figure_id')
164
+ end
165
+
166
+ Then(/^I should know the attribute "([^"]*)" includes "([^"]*)"$/) do |attribute, included|
167
+ @attr = @element.attribute(attribute)
168
+ expect(@attr).to include included
169
+ end
@@ -17,3 +17,15 @@ end
17
17
  When(/^I get the text from the details$/) do
18
18
  @text = @page.details_id
19
19
  end
20
+
21
+ When(/^I get the svg element$/) do
22
+ @svg= @page.svg_id_element
23
+ end
24
+
25
+ Then(/^the svg width should be "([^"]*)"$/) do |width|
26
+ expect(@svg.attribute('width')).to eql width
27
+ end
28
+
29
+ Then(/^the svg height should be "([^"]*)"$/) do |height|
30
+ expect(@svg.attribute('height')).to eql height
31
+ end
@@ -27,6 +27,7 @@ class MultiElementsPage
27
27
  paragraphs(:the_paragraphs, :class => 'p')
28
28
  labels(:the_labels, :class => 'label')
29
29
  file_fields(:the_file_fields, :class => 'file_field_class')
30
+ elements(:generic_label, :label, :css => '.label')
30
31
  divs(:block_divs) do |page|
31
32
  page.div_elements(:class => 'div')
32
33
  end
@@ -520,3 +521,7 @@ end
520
521
  When(/^I select the divs using a block$/) do
521
522
  @elements = @page.block_divs_elements
522
523
  end
524
+
525
+ When(/^I select the multiple elements with a tag label$/) do
526
+ @elements = @page.generic_label_elements
527
+ end