druid-ts 1.1.4 → 1.1.5

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +27 -0
  3. data/cucumber.yml +6 -2
  4. data/features/area.feature +33 -0
  5. data/features/audio.feature +66 -0
  6. data/features/canvas.feature +35 -0
  7. data/features/element.feature +9 -0
  8. data/features/html/hover.html +11 -0
  9. data/features/html/planets.gif +0 -0
  10. data/features/html/static_elements.html +43 -0
  11. data/features/html/sun.gif +0 -0
  12. data/features/html/sun.html +7 -0
  13. data/features/list_item.feature +1 -0
  14. data/features/page_level_actions.feature +25 -0
  15. data/features/sample-app/public/04-Death_Becomes_Fur.mp4 +0 -0
  16. data/features/sample-app/public/04-Death_Becomes_Fur.oga +0 -0
  17. data/features/sample-app/public/movie.mp4 +0 -0
  18. data/features/sample-app/public/movie.ogg +0 -0
  19. data/features/select_list.feature +5 -1
  20. data/features/step_definations/area_steps.rb +23 -0
  21. data/features/step_definations/audio_steps.rb +31 -0
  22. data/features/step_definations/canvas_steps.rb +19 -0
  23. data/features/step_definations/element_steps.rb +23 -2
  24. data/features/step_definations/page_level_actions_steps.rb +35 -0
  25. data/features/step_definations/select_list_steps.rb +4 -0
  26. data/features/step_definations/table_steps.rb +4 -0
  27. data/features/step_definations/video_steps.rb +19 -0
  28. data/features/support/page.rb +38 -2
  29. data/features/support/persistent_browser.rb +2 -1
  30. data/features/support/url_helper.rb +4 -0
  31. data/features/table.feature +8 -0
  32. data/features/video.feature +59 -0
  33. data/lib/druid/accessors.rb +162 -26
  34. data/lib/druid/assist.rb +63 -0
  35. data/lib/druid/element_locators.rb +126 -0
  36. data/lib/druid/elements.rb +29 -24
  37. data/lib/druid/elements/area.rb +29 -0
  38. data/lib/druid/elements/audio.rb +9 -0
  39. data/lib/druid/elements/canvas.rb +22 -0
  40. data/lib/druid/elements/element.rb +15 -1
  41. data/lib/druid/elements/list_item.rb +4 -0
  42. data/lib/druid/elements/media.rb +45 -0
  43. data/lib/druid/elements/select_list.rb +7 -1
  44. data/lib/druid/elements/table_row.rb +1 -0
  45. data/lib/druid/elements/video.rb +17 -0
  46. data/lib/druid/nested_elements.rb +32 -0
  47. data/lib/druid/version.rb +1 -1
  48. data/spec/druid/accessors_spec.rb +77 -0
  49. data/spec/druid/element_locators_spec.rb +89 -0
  50. data/spec/druid/elements/area_spec.rb +33 -0
  51. data/spec/druid/elements/canvas_spec.rb +28 -0
  52. data/spec/druid/elements/list_item_spec.rb +1 -1
  53. data/spec/druid/elements/select_list_spec.rb +6 -0
  54. metadata +42 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6276d1b684e76f744b084e805f4deaba4b26a460
4
- data.tar.gz: 0292a33fda9f47366307003aa3f436f9ef00956f
3
+ metadata.gz: 27a03ffe5425a835025a1c02f08ef841cbd92c8e
4
+ data.tar.gz: 170750f300df8637c4f852a5cca633c807cda376
5
5
  SHA512:
6
- metadata.gz: add0a49296d0a8090293fd22665635a2c48f0acadc317ca3c1577d5fa34d155138733a9fac26f574d43e43375da70ee281636f9249f272d033ccf1992a520cb1
7
- data.tar.gz: dec9a28581e98915b5e608de1e3bb2c0568c477e528dcd59b334039ef6d05eed5c215524e731581802f9491ad71fcbf370e3660dfdcf96b9f1583ae98813f098
6
+ metadata.gz: 275f0bb2a55c1c8be2cc5b65caf00f2e979b9ce35fd32037ab843e6466226c08112faaed5c46028994d1021846ca842d5510ece3a30734977fdaf4ef419e1c65
7
+ data.tar.gz: 32f20dcb1f4c488119a9b7ea3fc0f4714c58b91064d967a748c05adcb3134266595d0a0a8104f7f97f320e9a2f9139ea463358655411fef03b8acc6215c2685a
data/ChangeLog CHANGED
@@ -1,7 +1,34 @@
1
+ === 2017-01-03
2
+ * Enhancement
3
+ * Added selected_values method to SelectList to get values of all selected elements
4
+ === Version v1.1.5/ 2016-12-31
5
+ * Enhancement
6
+ * Added method to get the id of an Element
7
+ === 2016-12-30
8
+ * Enhancement
9
+ * Added hover method to Element. Browser support is limited
1
10
  === 2016-12-28
2
11
  * Enhancement
3
12
  * Updated Table [] method to return a row that has matching partial text in any column
4
13
  * Updated TableRow [] method to return column that matching partial text in any column
14
+ * Added the following aliased methods to their corresponding Accessors method
15
+ a => link
16
+ hidden => hidden_field
17
+ img => image
18
+ li => list_item
19
+ ol => ordered_list
20
+ p => paragraph
21
+ radio => radio_button
22
+ select => select_list
23
+ td => cell
24
+ textarea => text_area
25
+ ul => unordered_list
26
+ * Added support for the following new elements
27
+ Area
28
+ Canvas
29
+ Audio
30
+ Video
31
+ * Added ability to find list_item by :text
5
32
  ===Version v1.1.4/ 2016-12-27
6
33
  * Enhancement
7
34
  * Added ability to find span's by title
data/cucumber.yml CHANGED
@@ -1,2 +1,6 @@
1
- watir: DRIVER=WATIR --no-source --color --format pretty
2
- default: DRIVER=WATIR --no-source --color --format pretty
1
+ <%
2
+ std_opts = "BROWSER=firefox --no-source --color --format pretty"
3
+ %>
4
+
5
+ default: DRIVER=WATIR <%= std_opts %>
6
+ watir: DRIVER=WATIR <%= std_opts %>
@@ -0,0 +1,33 @@
1
+ Feature: Area
2
+
3
+ Background:
4
+ Given I am on the static elements page
5
+
6
+ Scenario: Retrieve an area element
7
+ When I retrieve the area element
8
+ Then I should know it exists
9
+ And I should know it is visible
10
+
11
+ Scenario Outline: Locating areas on the page
12
+ When I search for the area by "<search_by>"
13
+ Then I should be able to click the area
14
+
15
+ Examples:
16
+ | search_by |
17
+ | id |
18
+ | class |
19
+ | name |
20
+ | xpath |
21
+ | index |
22
+
23
+ Scenario: Getting the coordinates for the area
24
+ When I retrieve the area element
25
+ Then I should see the coordinates are "0,0,82,126"
26
+
27
+ Scenario: Getting the shape for the area
28
+ When I retrieve the area element
29
+ Then I should see the shape are "rect"
30
+
31
+ Scenario: Getting the href from the area
32
+ When I retrieve the area element
33
+ Then I should see the href is "sun.html"
@@ -0,0 +1,66 @@
1
+ #Feature: Support for the audio element
2
+
3
+ #Background:
4
+ #Given I am on the static elements page
5
+
6
+ #Scenario: Finding an audio element
7
+ #When I retrieve the audio element
8
+ #Then I should know it exists
9
+ #And I should know it is visible
10
+
11
+ #Scenario Outline: Locating an audio element on the page
12
+ #When I search for the audio element by "<search_by>"
13
+ #Then I should know it is visible
14
+
15
+ #Examples:
16
+ #| search_by |
17
+ #| id |
18
+ #| class |
19
+ #| name |
20
+ #| xpath |
21
+ #| index |
22
+
23
+ #Scenario Outline: Locating audios using multiple parameters
24
+ #When I search for the audio element by "<param1>" and "<param2>"
25
+ #Then I should know it is visible
26
+
27
+ #Examples:
28
+ #| param1 | param2 |
29
+ #| class | index |
30
+ #| name | index |
31
+
32
+ #Scenario: Should know if it is autoplay
33
+ #When I retrieve the audio element
34
+ #Then I should know the audio is not autoplay
35
+
36
+ #Scenario: Should know if the controls are displayed
37
+ #When I retrieve the audio element
38
+ #Then I should know that the controls are displayed
39
+
40
+ #Scenario: Should know if it is paused
41
+ #When I retrieve the audio element
42
+ #Then I should know that the audio is paused
43
+
44
+ #Scenario: Should know its duration
45
+ #When I retrieve the audio element
46
+ #Then I should know that the duration is greater than 74 seconds
47
+
48
+ #Scenario: Should know its volume
49
+ #When I retrieve the audio element
50
+ #Then I should know that its volume is 1
51
+
52
+ #Scenario: Should know if it has ended
53
+ #When I retrieve the audio element
54
+ #Then I should know that it has not ended
55
+
56
+ #Scenario: Should know if it is seeking
57
+ #When I retrieve the audio element
58
+ #Then I should know that it is not seeking
59
+
60
+ #Scenario: Should know if it is in a loop
61
+ #When I retrieve the audio element
62
+ #Then I should know that it is not in a loop
63
+
64
+ #Scenario: Should know if it is muted
65
+ #When I retrieve the audio element
66
+ #Then I should know that it is muted
@@ -0,0 +1,35 @@
1
+ Feature: Support for the canvas element
2
+
3
+ Background:
4
+ Given I am on the static elements page
5
+
6
+ Scenario: Retrieve a canvas element
7
+ When I retrieve the canvas element
8
+ Then I should know it exists
9
+ And I should know it is visible
10
+
11
+ Scenario Outline: Locating a canvas on the page
12
+ When I search for the canvas by "<search_by>"
13
+ Then I should know it is visible
14
+
15
+ Examples:
16
+ | search_by |
17
+ | id |
18
+ | class |
19
+ | name |
20
+ | xpath |
21
+ | index |
22
+
23
+ Scenario: Determining the width and height of the canvas
24
+ When I retrieve the canvas element
25
+ Then I should see that the canvas width is "200"
26
+ And I should see that the canvas height is "100"
27
+
28
+ Scenario Outline: Locating canvases using multiple parameters
29
+ When I search for the canvas element by "<param1>" and "<param2>"
30
+ Then I should know it is visible
31
+
32
+ Examples:
33
+ | param1 | param2 |
34
+ | class | index |
35
+ | name | index |
@@ -222,3 +222,12 @@ Feature: Elements
222
222
  Scenario: Flashing an element
223
223
  When I retrieve a button element
224
224
  Then I should be able to flash it
225
+
226
+ Scenario: Hovering over an element
227
+ Given I am on the hover page
228
+ When I hover over the hello link
229
+ Then the font size should be "20px"
230
+
231
+ Scenario: Getting an element's id
232
+ When I retrieve a button element
233
+ Then I should know its id is "button_id"
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <style type ="text/css" media="screen">
4
+ a { font-size: 10px; }
5
+ a:hover { font-size: 20px; }
6
+ </style>
7
+ </head>
8
+ <body>
9
+ <a href="#">hello</a>
10
+ </body>
11
+ </html>
Binary file
@@ -24,6 +24,28 @@
24
24
  <option value="option3" selected="true">Test 3</option>
25
25
  </select>
26
26
 
27
+ <img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap"/>
28
+ <map id="map" name="planetmap">
29
+ <area id="area" name="area" class="area" shape="rect" coords="0,0,82,126" href="sun.html"/>
30
+ <area shape="circle" coords="90,58,3" href="mercur.html"/>
31
+ <area shape="circle" coords="124,58,8" href="venus.html"/>
32
+ </map>
33
+
34
+ <canvas id="canvas" name="canvas" class="canvas" width="200" height="100"></canvas>
35
+ <script type="text/javascript">
36
+ var c=document.getElementById('myCanvas');
37
+ var ctx=c.getContext('2d');
38
+ ctx.fillStyle="#FF0000";
39
+ ctx.fillRect=(0,0,150,75);
40
+ </script>
41
+
42
+ <audio controls id="audio" name="audio" class="audio">
43
+ <p>Your user agent does not support the HTML5 Audio element.</p>
44
+ </audio>
45
+
46
+ <video width="320" height="240" controls="controls" id="video" name="video" class="video">
47
+ Your Browser does not support the video tag.
48
+ </video>
27
49
 
28
50
  <a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title" >Google Search</a>
29
51
 
@@ -54,6 +76,25 @@
54
76
  </tr>
55
77
  </table>
56
78
 
79
+ <table id="table_with_thead_id" border='1'>
80
+ <thead>
81
+ <tr>
82
+ <th>Col1</th>
83
+ <th>Col2</th>
84
+ </tr>
85
+ </thead>
86
+ <tbody>
87
+ <tr>
88
+ <td>Data1</td>
89
+ <td>Data2</td>
90
+ </tr>
91
+ <tr>
92
+ <td>Data3</td>
93
+ <td>Data4</td>
94
+ </tr>
95
+ </tbody>
96
+ </table>
97
+
57
98
  <form method="get" action="success.html">
58
99
  <input id='button_id' name='button_name' class='button_class' type="submit" value="Click Me"/>
59
100
  <input id='button_image_id' type='image' src='images/submit.gif' alt='Submit'/>
@@ -84,7 +125,9 @@
84
125
  <a href="success.html">Hello</a>
85
126
 
86
127
  <input id=alert_button type=button onclick="alert('I am an alert')" value=Alert>
128
+ <input id=alert_button_that_reloads type=button onclick="alert('I am an alert'); location.reload()" value="Alert that Reloads">
87
129
  <input id=confirm_button type=button onclick="this.value = confirm('set the value')" value=Confirm>
130
+ <input id=confirm_button_that_reloads type=button onclick="if(confirm('set the value')) location.reload()" value="Confirm that Reloads">
88
131
  <input id=prompt_button type=button onclick="this.value = prompt('enter your name','John Doe')" value=Prompt>
89
132
 
90
133
  <h1 id="h1_id" class="h1_class" name="h1_name">h1's are cool</h1>
Binary file
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <head>
3
+ </head>
4
+ <body>
5
+ <p><img border="0" src="sun.gif" width="99" height="98"></p>
6
+ </body>
7
+ </html>
@@ -19,6 +19,7 @@ Feature: List item
19
19
  | xpath |
20
20
  | index |
21
21
  | name |
22
+ | text |
22
23
 
23
24
  @multi
24
25
  Scenario Outline: Locating list items using multiple parameters
@@ -51,16 +51,41 @@ Feature: Page level actions
51
51
  When I handle the alert
52
52
  Then I should be able to get the alert's message
53
53
 
54
+ Scenario: Handling possible alert popups
55
+ Given I am on the static elements page
56
+ When I handle the possible alert
57
+ Then I should be able to verify the popup didn't have a message
58
+
59
+ Scenario: Handling alert popups that reload the page
60
+ Given I am on the static elements page
61
+ When I handle the alert that reloads the page
62
+ Then I should be able to get the alert's message
63
+
54
64
  Scenario: Handling confirm popups
55
65
  Given I am on the static elements page
56
66
  When I handle the confirm
57
67
  Then I should be able to get the confirm's message
58
68
 
69
+ Scenario: Handling possible confirm popups
70
+ Given I am on the static elements page
71
+ When I handle the possible confirm
72
+ Then I should be able to verify the popup didn't have a message
73
+
74
+ Scenario: Handling confirm popups that reload the page
75
+ Given I am on the static elements page
76
+ When I handle the confirm that reloads the page
77
+ Then I should be able to get the confirm's message
78
+
59
79
  Scenario: Handling prompt popups
60
80
  Given I am on the static elements page
61
81
  When I handle the prompt
62
82
  Then I should be able to get the message and default value
63
83
 
84
+ Scenario: Handling possible prompt popups
85
+ Given I am on the static elements page
86
+ When I handle the possible prompt
87
+ Then I should be able to verify the popup didn't have a message
88
+
64
89
  Scenario: Attach to window using title
65
90
  Given I am on the static elements page
66
91
  When I open a second window
@@ -72,4 +72,8 @@ Feature: Select List
72
72
 
73
73
  Scenario: Selecting an option by its value
74
74
  When I select an option using the value "option2"
75
- Then the selected option should be "Test 2"
75
+ Then the selected option should be "Test 2
76
+
77
+ Scenario: Getting the value from a selected option
78
+ When I select an option using the value "option2"
79
+ Then the selected option should have a value of "option2"
@@ -0,0 +1,23 @@
1
+ When(/^I retrieve the area element$/) do
2
+ @element = @page.area_id_element
3
+ end
4
+
5
+ When(/^I search for the area by "([^"]*)"$/) do |how|
6
+ @how = how
7
+ end
8
+
9
+ Then(/^I should be able to click the area$/) do
10
+ @page.send("area_#{@how}")
11
+ end
12
+
13
+ Then(/^I should see the coordinates are "([^"]*)"$/) do |coords|
14
+ expect(@element.coords).to eql coords
15
+ end
16
+
17
+ Then(/^I should see the shape are "([^"]*)"$/) do |shape|
18
+ expect(@element.shape).to eql shape
19
+ end
20
+
21
+ Then(/^I should see the href is "([^"]*)"$/) do |href|
22
+ expect(@element.href).to include href
23
+ end
@@ -0,0 +1,31 @@
1
+ When(/^I retrieve the audio element$/) do
2
+ @element = @page.audio_id_element
3
+ end
4
+
5
+ When(/^I search for the audio element by "([^"]*)"$/) do |how|
6
+ @element = @page.send "audio_#{how}_element"
7
+ end
8
+
9
+ When(/^I search for the audio element by "([^"]*)" and "([^"]*)"$/) do |param1, param2|
10
+ @element = @page.send "audio_#{param1}_#{param2}_element"
11
+ end
12
+
13
+ Then(/^I should know the audio is not autoplay$/) do
14
+ expect(@element).not_to be_autoplay
15
+ end
16
+
17
+ Then(/^I should know that the controls are displayed$/) do
18
+ expect(@element).to have_controls
19
+ end
20
+
21
+ Then(/^I should know that the audio is paused$/) do
22
+ expect(@element).to be_paused
23
+ end
24
+
25
+ Then(/^I should know that the duration is greater than (\d+) seconds$/) do |duration|
26
+ expect(@element.duration).to be > duration.to_f
27
+ end
28
+
29
+ Then(/^I should know that its volume is (\d+)$/) do |volume|
30
+ expect(@element.volume).to eql volume.to_i
31
+ end
@@ -0,0 +1,19 @@
1
+ When(/^I retrieve the canvas element$/) do
2
+ @element = @page.canvas_id_element
3
+ end
4
+
5
+ When(/^I search for the canvas by "([^"]*)"$/) do |how|
6
+ @element = @page.send "canvas_#{how}_element"
7
+ end
8
+
9
+ Then(/^I should see that the canvas width is "([^"]*)"$/) do |width|
10
+ expect(@element.width).to eql width.to_i
11
+ end
12
+
13
+ Then(/^I should see that the canvas height is "([^"]*)"$/) do |height|
14
+ expect(@element.height).to eql height.to_i
15
+ end
16
+
17
+ When(/^I search for the canvas element by "([^"]*)" and "([^"]*)"$/) do |param1, param2|
18
+ @element = @page.send "canvas_#{param1}_#{param2}_element"
19
+ end