druid-ts 0.0.1 → 1.1.0
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 +4 -4
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +1 -2
- data/ChangeLog +218 -0
- data/Gemfile +2 -1
- data/README.md +64 -7
- data/Rakefile +1 -1
- data/druid.gemspec +25 -0
- data/features/async.feature +18 -0
- data/features/button.feature +42 -1
- data/features/checkbox.feature +7 -1
- data/features/div.feature +6 -0
- data/features/element.feature +100 -0
- data/features/file_field.feature +35 -0
- data/features/form.feature +12 -6
- data/features/frames.feature +57 -0
- data/features/heading.feature +164 -0
- data/features/hidden_field.feature +6 -0
- data/features/html/async.html +18 -0
- data/features/html/frame_1.html +18 -0
- data/features/html/frame_2.html +16 -0
- data/features/html/frame_3.html +14 -0
- data/features/html/frames.html +12 -0
- data/features/html/iframes.html +12 -0
- data/features/html/modal.html +17 -0
- data/features/html/modal_1.html +38 -0
- data/features/html/modal_2.html +27 -0
- data/features/html/nested_elements.html +52 -0
- data/features/html/nested_frame_1.html +1 -0
- data/features/html/nested_frame_2.html +11 -0
- data/features/html/nested_frame_3.html +14 -0
- data/features/html/nested_frames.html +10 -0
- data/features/html/static_elements.html +29 -23
- data/features/image.feature +8 -0
- data/features/link.feature +5 -0
- data/features/list_item.feature +5 -0
- data/features/modal_dialog.feature +9 -0
- data/features/nested_elements.feature +105 -0
- data/features/ordered_list.feature +6 -0
- data/features/page_level_actions.feature +48 -0
- data/features/paragraph.feature +33 -0
- data/features/radio_button.feature +6 -0
- data/features/select_list.feature +6 -1
- data/features/span.feature +6 -1
- data/features/step_definations/async_steps.rb +63 -0
- data/features/step_definations/button_steps.rb +25 -1
- data/features/step_definations/checkbox_steps.rb +5 -1
- data/features/step_definations/div_steps.rb +6 -1
- data/features/step_definations/element_steps.rb +55 -1
- data/features/step_definations/file_field_steps.rb +27 -0
- data/features/step_definations/form_steps.rb +8 -0
- data/features/step_definations/frame_steps.rb +112 -0
- data/features/step_definations/heading_steps.rb +39 -0
- data/features/step_definations/hidden_field_steps.rb +7 -3
- data/features/step_definations/image_steps.rb +7 -3
- data/features/step_definations/link_steps.rb +8 -3
- data/features/step_definations/list_item_steps.rb +9 -1
- data/features/step_definations/modal_dialog_steps.rb +38 -0
- data/features/step_definations/nested_elements_steps.rb +196 -0
- data/features/step_definations/ordered_list_steps.rb +11 -3
- data/features/step_definations/page_level_actions_steps.rb +72 -0
- data/features/step_definations/paragraph_steps.rb +15 -0
- data/features/step_definations/radio_button_steps.rb +5 -1
- data/features/step_definations/select_list_steps.rb +10 -2
- data/features/step_definations/span_steps.rb +5 -1
- data/features/step_definations/table_cell_steps.rb +5 -1
- data/features/step_definations/table_steps.rb +17 -3
- data/features/step_definations/text_area_steps.rb +18 -2
- data/features/step_definations/text_field_steps.rb +9 -1
- data/features/step_definations/unordered_list_steps.rb +11 -3
- data/features/support/env.rb +0 -15
- data/features/support/hooks.rb +7 -0
- data/features/support/page.rb +98 -1
- data/features/support/persistent_browser.rb +15 -0
- data/features/support/url_helper.rb +24 -1
- data/features/table.feature +7 -0
- data/features/table_cell.feature +6 -0
- data/features/text_area.feature +11 -0
- data/features/text_field.feature +6 -1
- data/features/unordered_list.feature +6 -0
- data/lib/druid.rb +251 -3
- data/lib/druid/accessors.rb +446 -158
- data/lib/druid/assist.rb +394 -0
- data/lib/druid/core_ext/string.rb +5 -0
- data/lib/druid/element_locators.rb +405 -0
- data/lib/druid/elements.rb +28 -0
- data/lib/druid/elements/button.rb +6 -1
- data/lib/druid/elements/check_box.rb +26 -0
- data/lib/druid/elements/div.rb +3 -1
- data/lib/druid/elements/element.rb +170 -5
- data/lib/druid/elements/file_field.rb +18 -0
- data/lib/druid/elements/form.rb +11 -0
- data/lib/druid/elements/heading.rb +14 -0
- data/lib/druid/elements/hidden_field.rb +12 -2
- data/lib/druid/elements/image.rb +13 -0
- data/lib/druid/elements/link.rb +2 -0
- data/lib/druid/elements/list_item.rb +3 -1
- data/lib/druid/elements/option.rb +9 -0
- data/lib/druid/elements/ordered_list.rb +4 -5
- data/lib/druid/elements/paragraph.rb +9 -0
- data/lib/druid/elements/radio_button.rb +25 -0
- data/lib/druid/elements/select_list.rb +10 -1
- data/lib/druid/elements/span.rb +3 -1
- data/lib/druid/elements/table.rb +20 -1
- data/lib/druid/elements/table_cell.rb +7 -0
- data/lib/druid/elements/table_row.rb +5 -1
- data/lib/druid/elements/text_area.rb +15 -1
- data/lib/druid/elements/text_field.rb +11 -1
- data/lib/druid/elements/unordered_list.rb +5 -5
- data/lib/druid/nested_elements.rb +103 -0
- data/lib/druid/page_factory.rb +4 -4
- data/lib/druid/page_populator.rb +71 -0
- data/spec/druid/accessors_spec.rb +789 -0
- data/spec/druid/druid_spec.rb +130 -7
- data/spec/druid/element_locators_spec.rb +160 -0
- data/spec/druid/elements/button_spec.rb +31 -0
- data/spec/druid/elements/check_box_spec.rb +38 -0
- data/spec/druid/elements/div_spec.rb +19 -0
- data/spec/druid/elements/element_spec.rb +150 -0
- data/spec/druid/elements/file_field_spec.rb +27 -0
- data/spec/druid/elements/form_spec.rb +27 -0
- data/spec/druid/elements/heading_spec.rb +39 -0
- data/spec/druid/elements/hidden_field_spec.rb +24 -0
- data/spec/druid/elements/image_spec.rb +32 -0
- data/spec/druid/elements/link_spec.rb +26 -0
- data/spec/druid/elements/list_item_spec.rb +19 -0
- data/spec/druid/elements/option_spec.rb +10 -0
- data/spec/druid/elements/ordered_list_spec.rb +42 -0
- data/spec/druid/elements/page_factory_spec.rb +40 -0
- data/spec/druid/elements/paragraph_spec.rb +21 -0
- data/spec/druid/elements/radio_button_spec.rb +38 -0
- data/spec/druid/elements/select_list_spec.rb +37 -0
- data/spec/druid/elements/span_spec.rb +19 -0
- data/spec/druid/elements/table_cell_spec.rb +23 -0
- data/spec/druid/elements/table_row_spec.rb +41 -0
- data/spec/druid/elements/table_spec.rb +52 -0
- data/spec/druid/elements/text_area_spec.rb +31 -0
- data/spec/druid/elements/text_field_spec.rb +31 -0
- data/spec/druid/elements/unordered_list_spec.rb +42 -0
- data/spec/druid/nested_element_spec.rb +128 -0
- data/spec/druid/page_populator_spec.rb +92 -0
- data/spec/spec_helper.rb +2 -1
- metadata +147 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
When(/^I get the first item from the ordered list$/) do
|
|
2
|
-
@element = @page.
|
|
2
|
+
@element = @page.ol_id_element[0]
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
Then(/^the list item's text should be "(.*?)"$/) do |text|
|
|
@@ -7,7 +7,7 @@ Then(/^the list item's text should be "(.*?)"$/) do |text|
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
When(/^I locate the ordered list by "(.*?)"$/) do |how|
|
|
10
|
-
@list = @page.send "ol_#{how}
|
|
10
|
+
@list = @page.send "ol_#{how}_element"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
When(/^I get the first item from the list$/) do
|
|
@@ -25,9 +25,17 @@ Then(/^each item should contain "(.*?)"$/) do |text|
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
When(/^I search for the ordered list by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
28
|
-
@list = @page.send "ol_#{param1}_#{param2}
|
|
28
|
+
@list = @page.send "ol_#{param1}_#{param2}_element"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
Then(/^the list items text should be "(.*?)"$/) do |expected_text|
|
|
32
32
|
expect(@element.text).to eql expected_text
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
When(/^I retrieve a ordered list element$/) do
|
|
36
|
+
@element = @page.ol_id_element
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
When(/^I search for the ordered list while the script is executing$/) do
|
|
40
|
+
@list = @page.ordered_list_element(:id => 'ol_id')
|
|
41
|
+
end
|
|
@@ -46,3 +46,75 @@ Then(/^the page should have the title "(.*?)" using on_page with block$/) do |te
|
|
|
46
46
|
# expect(page.title).to include text
|
|
47
47
|
# end
|
|
48
48
|
end
|
|
49
|
+
|
|
50
|
+
Then(/^I should be able to wait for a block to return true$/) do
|
|
51
|
+
@page.google_search_id
|
|
52
|
+
@page.wait_until(10, "too long to display page") do
|
|
53
|
+
@page.text.include? 'Success'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
When(/^I handle the alert$/) do
|
|
58
|
+
@msg = @page.alert do
|
|
59
|
+
@page.alert_button
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
Then(/^I should be able to get the alert's message$/) do
|
|
64
|
+
expect(@msg).to eql "I am an alert"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
When(/^I handle the confirm$/) do
|
|
68
|
+
@msg = @page.confirm(true) do
|
|
69
|
+
@page.confirm_button
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Then(/^I should be able to get the confirm's message$/) do
|
|
74
|
+
expect(@msg).to eql "set the value"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
When(/^I handle the prompt$/) do
|
|
78
|
+
@msg = @page.prompt("Tim") do
|
|
79
|
+
@page.prompt_button
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
Then(/^I should be able to get the message and default value$/) do
|
|
84
|
+
expect(@msg).to eql "enter your name"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
When(/^I open a second window$/) do
|
|
88
|
+
@page.open_window
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
class SecondPage
|
|
92
|
+
include Druid
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
Then(/^I should be able to attach to page object using title$/) do
|
|
96
|
+
@second_page = SecondPage.new(@driver)
|
|
97
|
+
@second_page.attach_to_window(:title => "Success")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
Then(/^I should be able to attach to page object using url$/) do
|
|
101
|
+
@second_page = SecondPage.new(@driver)
|
|
102
|
+
@second_page.attach_to_window(:url => "success.html")
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
Then(/^I should be able to attach to page object using index$/) do
|
|
106
|
+
@second_page = SecondPage.new(@driver)
|
|
107
|
+
@second_page.attach_to_window(:index => 1)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
Then(/^I should be able to refresh the page$/) do
|
|
111
|
+
@page.refresh
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
When(/^I press the back button$/) do
|
|
115
|
+
@page.back
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
When(/^I press the forward button$/) do
|
|
119
|
+
@page.forward
|
|
120
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
When(/^I get the text from the paragraph$/) do
|
|
2
|
+
@text = @page.p_id
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When(/^I search for the paragraph by "([^"]*)"$/) do |how|
|
|
6
|
+
@text = @page.send "p_#{how}".to_sym
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When(/^I search for the paragraph by "([^"]*)" and "([^"]*)"$/) do |param1, param2|
|
|
10
|
+
@text = @page.send "p_#{param1}_#{param2}".to_sym
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I get the text from a paragraph while the script is executing$/) do
|
|
14
|
+
@text = @page.paragraph_element(:id => 'p_id').text
|
|
15
|
+
end
|
|
@@ -15,9 +15,13 @@ When(/^I select the radio button$/) do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
When(/^I retrieve a radio button$/) do
|
|
18
|
-
@element = @page.
|
|
18
|
+
@element = @page.milk_id_element
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
When(/^I search for the radio button by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
22
22
|
@how = "#{param1}_#{param2}"
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
When(/^I select the radio button while the script is executing$/) do
|
|
26
|
+
@page.radio_button_element(:id => "milk_id").select
|
|
27
|
+
end
|
|
@@ -19,7 +19,7 @@ Then(/^the value for the selected item should be "(.*?)"$/) do |expected_item|
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
When(/^I retrieve a select list$/) do
|
|
22
|
-
@element = @page.
|
|
22
|
+
@element = @page.select_list_id_element
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
When(/^I search for the select list by "(.*?)"$/) do |how|
|
|
@@ -27,7 +27,7 @@ When(/^I search for the select list by "(.*?)"$/) do |how|
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
Then(/^option "(.*?)" should contain "(.*?)"$/) do |opt_num, text|
|
|
30
|
-
@element = @page.send "select_list_#{@how}
|
|
30
|
+
@element = @page.send "select_list_#{@how}_element".to_sym
|
|
31
31
|
expect(@element[opt_num.to_i - 1].text).to eql text
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -40,3 +40,11 @@ end
|
|
|
40
40
|
When(/^I search for the select list bys "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
41
41
|
@how = "#{param1}_#{param2}"
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
When(/^I find a select list while the script is executing$/) do
|
|
45
|
+
@select_list = @page.select_list_element(:id => "sel_list_id")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Then(/^I should be able to select "(.*?)" from the list$/) do |value|
|
|
49
|
+
@select_list.select value
|
|
50
|
+
end
|
|
@@ -7,9 +7,13 @@ When(/^I locate the span by "(.*?)"$/) do |how|
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
When(/^I retrieve a span element$/) do
|
|
10
|
-
@element = @page.
|
|
10
|
+
@element = @page.span_id_element
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
When(/^I search for the span by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
14
14
|
@text = @page.send "span_#{param1}_#{param2}".to_sym
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
When(/^I get the text from a span while the script is executing$/) do
|
|
18
|
+
@text = @page.span_element(:id => 'span_id').text
|
|
19
|
+
end
|
|
@@ -11,9 +11,13 @@ When(/^I locate the table cell by "(.*?)"$/) do |how|
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
When(/^I retrieve table cell$/) do
|
|
14
|
-
@element = @page.
|
|
14
|
+
@element = @page.cell_id_element
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
When(/^I retrieve a table cell element by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
18
18
|
@cell_text = @page.send "cell_#{param1}_#{param2}".to_sym
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
When(/^I retrieve a table cell element while the script is executing$/) do
|
|
22
|
+
@cell_text = @page.cell_element(:id => 'cell_id').text
|
|
23
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
When(/^I retrieve a table element$/) do
|
|
2
|
-
@element = @page.
|
|
2
|
+
@element = @page.table_id_element
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
When(/^I retrieve a table element by "(.*?)"$/) do |how|
|
|
6
|
-
@element = @page.send "table_#{how}
|
|
6
|
+
@element = @page.send "table_#{how}_element".to_sym
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
Then(/^the data for row "(.*?)" should be "(.*?)" and "(.*?)"$/) do |row, col1, col2|
|
|
@@ -34,5 +34,19 @@ Then(/^each column should contain "(.*?)"$/) do |text|
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
When(/^I retrieve a table element bys "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
37
|
-
@element = @page.send "table_#{param1}_#{param2}
|
|
37
|
+
@element = @page.send "table_#{param1}_#{param2}_element".to_sym
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
When(/^I retrieve a table element while the script is executing$/) do
|
|
41
|
+
@element = @page.table_element(:id => 'table_id')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
Then(/^the data for the first row should be "([^"]*)" and "([^"]*)"$/) do |col1, col2|
|
|
45
|
+
expect(@element.first_row[0].text).to eql col1
|
|
46
|
+
expect(@element.first_row[1].text).to eql col2
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Then(/^the data for the last row should be "([^"]*)" and "([^"]*)"$/) do |col1, col2|
|
|
50
|
+
expect(@element.last_row[0].text).to eql col1
|
|
51
|
+
expect(@element.last_row[1].text).to eql col2
|
|
38
52
|
end
|
|
@@ -7,7 +7,7 @@ Then(/^the text area should contain "(.*?)"$/) do |text|
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
When(/^I locate the text area by "(.*?)"$/) do |how|
|
|
10
|
-
@element = @page.send "text_area_#{how}
|
|
10
|
+
@element = @page.send "text_area_#{how}_element".to_sym
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
Then(/^I should be able to type "(.*?)" into the area$/) do |text|
|
|
@@ -15,5 +15,21 @@ Then(/^I should be able to type "(.*?)" into the area$/) do |text|
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
When(/^I search for the text area by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
18
|
-
@element = @page.send "text_area_#{param1}_#{param2}
|
|
18
|
+
@element = @page.send "text_area_#{param1}_#{param2}_element".to_sym
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
When(/^I retrieve the text area$/) do
|
|
22
|
+
@element = @page.text_area_id_element
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
When(/^I find a text area while the script is executing$/) do
|
|
26
|
+
@text_area = @page.text_area_element(:id => "text_area_id")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^I should be able to type "(.*?)" into the area element$/) do |value|
|
|
30
|
+
@text_area.value = value
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
When(/^I clear the text area$/) do
|
|
34
|
+
@page.text_area_id_element.clear
|
|
19
35
|
end
|
|
@@ -15,9 +15,17 @@ Then(/^I should be able to type "(.*?)" into the field$/) do |value|
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
When(/^I retrieve a text field$/) do
|
|
18
|
-
@element = @page.
|
|
18
|
+
@element = @page.text_field_id_element
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
When(/^I search for the text field by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
22
22
|
@how = "#{param1}_#{param2}"
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
When(/^I find a text field while the script is executing$/) do
|
|
26
|
+
@text_field = @page.text_field_element(:id => 'text_field_id')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then(/^I should be able to type "(.*?)" into the field element$/) do |value|
|
|
30
|
+
@text_field.value = value
|
|
31
|
+
end
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
When(/^I get the first item from the unordered list$/) do
|
|
2
|
-
@element = @page.
|
|
2
|
+
@element = @page.ul_id_element[0]
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
When(/^I locate the unordered list by "(.*?)"$/) do |how|
|
|
6
|
-
@list = @page.send "ul_#{how}
|
|
6
|
+
@list = @page.send "ul_#{how}_element".to_sym
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
When(/^I search for the unordered list by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
|
10
|
-
@list = @page.send "ul_#{param1}_#{param2}
|
|
10
|
+
@list = @page.send "ul_#{param1}_#{param2}_element".to_sym
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When(/^I retrieve a unordered list element$/) do
|
|
14
|
+
@element = @page.ul_id_element
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When(/^I search for the unordered list while the script is executing$/) do
|
|
18
|
+
@list = @page.unordered_list_element(:id => 'ul_id')
|
|
11
19
|
end
|
data/features/support/env.rb
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
|
-
SimpleCov.start if ENV["COVERAGE"]
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
|
|
5
|
-
|
|
6
1
|
require 'watir-webdriver'
|
|
7
2
|
require 'druid'
|
|
8
|
-
|
|
9
|
-
World(Druid::PageFactory)
|
|
10
|
-
|
|
11
|
-
Before do
|
|
12
|
-
@driver = Watir::Browser.new :firefox if ENV['DRIVER'] == 'WATIR'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
After do |s|
|
|
16
|
-
@driver.close
|
|
17
|
-
end
|
data/features/support/page.rb
CHANGED
|
@@ -24,6 +24,7 @@ class Page
|
|
|
24
24
|
text_field(:text_field_index, :index => 0)
|
|
25
25
|
text_field(:text_field_text, :text => "")
|
|
26
26
|
text_field(:text_field_value, :value => "")
|
|
27
|
+
text_field(:text_field_title, :title => "text_field_title")
|
|
27
28
|
text_field(:text_field_class_index, :class => "text_field_class", :index => 0)
|
|
28
29
|
text_field(:text_field_name_index, :name => "text_field_name", :index => 0)
|
|
29
30
|
|
|
@@ -31,6 +32,7 @@ class Page
|
|
|
31
32
|
checkbox(:cb_name, :name => 'cb_name')
|
|
32
33
|
checkbox(:cb_class, :class => 'cb_class')
|
|
33
34
|
checkbox(:cb_index, :index => 0)
|
|
35
|
+
checkbox(:cb_value, :value => '1')
|
|
34
36
|
checkbox(:cb_xpath, :xpath => "//input[@type='checkbox']")
|
|
35
37
|
checkbox(:cb_class_index, :class => "cb_class", :index => 0)
|
|
36
38
|
checkbox(:cb_name_index, :name => "cb_name", :index => 0)
|
|
@@ -50,6 +52,7 @@ class Page
|
|
|
50
52
|
radio_button(:milk_name, :name => 'milk_name')
|
|
51
53
|
radio_button(:milk_class, :class => 'milk_class')
|
|
52
54
|
radio_button(:milk_index, :index => 0)
|
|
55
|
+
radio_button(:milk_value, :value => 'Milk')
|
|
53
56
|
radio_button(:milk_xpath, :xpath => "//input[@type='radio']")
|
|
54
57
|
radio_button(:milk_class_index, :class => "milk_class", :index => 0)
|
|
55
58
|
radio_button(:milk_name_index, :name => "milk_name", :index => 0)
|
|
@@ -60,14 +63,31 @@ class Page
|
|
|
60
63
|
button(:button_index, :index => 0)
|
|
61
64
|
button(:button_xpath, :xpath=> "//input[@type='submit']")
|
|
62
65
|
button(:button_text, :text => 'Click Me')
|
|
66
|
+
button(:button_value, :value => 'Click Me')
|
|
63
67
|
button(:button_class_index, :class => "button_class", :index => 0)
|
|
64
68
|
button(:button_name_index, :name => "button_name", :index => 0)
|
|
65
69
|
|
|
70
|
+
button(:button_image_id, :id => 'button_image_id')
|
|
71
|
+
button(:button_image_src, :src => 'images/submit.gif')
|
|
72
|
+
button(:button_image_alt, :alt => 'Submit')
|
|
73
|
+
|
|
74
|
+
button(:disabled_button, :value => 'Disabled')
|
|
75
|
+
|
|
76
|
+
button(:btn_id, :id => 'btn_id')
|
|
77
|
+
button(:btn_name, :name => 'btn_name')
|
|
78
|
+
button(:btn_class, :class => 'btn_class')
|
|
79
|
+
button(:btn_index, :index => 0)
|
|
80
|
+
button(:btn_text, :text => 'Click Me Too')
|
|
81
|
+
button(:btn_value, :value => 'Click Me Too')
|
|
82
|
+
button(:btn_class_index, :class => "btn_class", :index => 0)
|
|
83
|
+
button(:btn_name_index, :name => "btn_name", :index => 0)
|
|
84
|
+
|
|
66
85
|
div(:div_id, :id => "div_id")
|
|
67
86
|
div(:div_name, :name => "div_name")
|
|
68
87
|
div(:div_class, :class => 'div_class')
|
|
69
88
|
div(:div_index, :index => 0)
|
|
70
89
|
div(:div_xpath, :xpath => '//div')
|
|
90
|
+
div(:div_text, :text => "page-object rocks!")
|
|
71
91
|
div(:div_class_index, :class => "div_class", :index => 0)
|
|
72
92
|
div(:div_name_index, :name => "div_name", :index => 0)
|
|
73
93
|
|
|
@@ -84,6 +104,7 @@ class Page
|
|
|
84
104
|
cell(:cell_index, :index => 3)
|
|
85
105
|
cell(:cell_xpath, :xpath => '//table//tr[2]//td[2]')
|
|
86
106
|
cell(:cell_name, :name => 'cell_name')
|
|
107
|
+
cell(:cell_text, :text => 'Data4')
|
|
87
108
|
cell(:cell_class_index, :class => "cell_class", :index => 0)
|
|
88
109
|
cell(:cell_name_index, :name => "cell_name", :index => 0)
|
|
89
110
|
|
|
@@ -92,6 +113,7 @@ class Page
|
|
|
92
113
|
span(:span_index, :index => 0)
|
|
93
114
|
span(:span_xpath, :xpath => '//span')
|
|
94
115
|
span(:span_name, :name => 'span_name')
|
|
116
|
+
span(:span_text, :text => 'My alert')
|
|
95
117
|
span(:span_class_index, :class => "span_class", :index => 0)
|
|
96
118
|
span(:span_name_index, :name => "span_name", :index => 0)
|
|
97
119
|
|
|
@@ -100,6 +122,8 @@ class Page
|
|
|
100
122
|
image(:image_class, :class => 'image_class')
|
|
101
123
|
image(:image_index, :index => 0)
|
|
102
124
|
image(:image_xpath, :xpath => '//img')
|
|
125
|
+
image(:image_alt, :alt => 'image_alt')
|
|
126
|
+
image(:image_src, :src => 'images/circle.png')
|
|
103
127
|
image(:image_class_index, :class => "image_class", :index => 0)
|
|
104
128
|
image(:image_name_index, :name => "image_name", :index => 0)
|
|
105
129
|
|
|
@@ -108,6 +132,7 @@ class Page
|
|
|
108
132
|
form(:form_class, :class => 'form_class')
|
|
109
133
|
form(:form_index, :index => 0)
|
|
110
134
|
form(:form_xpath, :xpath => '//form')
|
|
135
|
+
form(:form_action, :action => 'success.html')
|
|
111
136
|
form(:form_class_index, :class => "form_class", :index => 0)
|
|
112
137
|
form(:form_name_index, :name => "form_name", :index => 0)
|
|
113
138
|
|
|
@@ -119,7 +144,7 @@ class Page
|
|
|
119
144
|
hidden_field(:hidden_field_tag_name, :tag_name => "input[type='hidden']")
|
|
120
145
|
hidden_field(:hidden_field_index, :index => 0)
|
|
121
146
|
hidden_field(:hidden_field_text, :text => "")
|
|
122
|
-
hidden_field(:hidden_field_value, :value => "")
|
|
147
|
+
hidden_field(:hidden_field_value, :value => "12345")
|
|
123
148
|
hidden_field(:hidden_field_class_index, :class => "hidden_field_class", :index => 0)
|
|
124
149
|
hidden_field(:hidden_field_name_index, :name => "hidden_field_name", :index => 0)
|
|
125
150
|
|
|
@@ -160,4 +185,76 @@ class Page
|
|
|
160
185
|
unordered_list(:ul_name_index, :name => "ul_name", :index => 0)
|
|
161
186
|
unordered_list(:ul_class_name, :class => "ul_class", :name => "ul_name")
|
|
162
187
|
|
|
188
|
+
button(:alert_button, :id => "alert_button")
|
|
189
|
+
button(:confirm_button, :id => "confirm_button")
|
|
190
|
+
button(:prompt_button, :id => "prompt_button")
|
|
191
|
+
|
|
192
|
+
link(:open_window, :text => 'New Window')
|
|
193
|
+
|
|
194
|
+
h1(:h1_id, :id => 'h1_id')
|
|
195
|
+
h1(:h1_class, :class => 'h1_class')
|
|
196
|
+
h1(:h1_name, :name => 'h1_name')
|
|
197
|
+
h1(:h1_index, :index => 0)
|
|
198
|
+
h1(:h1_xpath, :xpath => '//h1')
|
|
199
|
+
h1(:h1_class_index, :class => 'h1_class', :index => 0)
|
|
200
|
+
h1(:h1_name_index, :name => 'h1_name', :index => 0)
|
|
201
|
+
|
|
202
|
+
h2(:h2_id, :id => 'h2_id')
|
|
203
|
+
h2(:h2_class, :class => 'h2_class')
|
|
204
|
+
h2(:h2_name, :name => 'h2_name')
|
|
205
|
+
h2(:h2_index, :index => 0)
|
|
206
|
+
h2(:h2_xpath, :xpath => '//h2')
|
|
207
|
+
h2(:h2_class_index, :class => 'h2_class', :index => 0)
|
|
208
|
+
h2(:h2_name_index, :name => 'h2_name', :index =>0)
|
|
209
|
+
|
|
210
|
+
h3(:h3_id, :id => 'h3_id')
|
|
211
|
+
h3(:h3_class, :class => 'h3_class')
|
|
212
|
+
h3(:h3_name, :name => 'h3_name')
|
|
213
|
+
h3(:h3_index, :index => 0)
|
|
214
|
+
h3(:h3_xpath, :xpath => '//h3')
|
|
215
|
+
h3(:h3_class_index, :class => 'h3_class', :index => 0)
|
|
216
|
+
h3(:h3_name_index, :name => 'h3_name', :index => 0)
|
|
217
|
+
|
|
218
|
+
h4(:h4_id, :id => 'h4_id')
|
|
219
|
+
h4(:h4_class, :class => 'h4_class')
|
|
220
|
+
h4(:h4_name, :name => 'h4_name')
|
|
221
|
+
h4(:h4_index, :index => 0)
|
|
222
|
+
h4(:h4_xpath, :xpath => '//h4')
|
|
223
|
+
h4(:h4_class_index, :class => 'h4_class', :index => 0)
|
|
224
|
+
h4(:h4_name_index, :name => 'h4_name', :index => 0)
|
|
225
|
+
|
|
226
|
+
h5(:h5_id, :id => 'h5_id')
|
|
227
|
+
h5(:h5_class, :class => 'h5_class')
|
|
228
|
+
h5(:h5_name, :name => 'h5_name')
|
|
229
|
+
h5(:h5_index, :index => 0)
|
|
230
|
+
h5(:h5_xpath, :xpath => '//h5')
|
|
231
|
+
h5(:h5_class_index, :class => 'h5_class', :index => 0)
|
|
232
|
+
h5(:h5_name_index, :name => 'h5_name', :index => 0)
|
|
233
|
+
|
|
234
|
+
h6(:h6_id, :id => 'h6_id')
|
|
235
|
+
h6(:h6_class, :class => 'h6_class')
|
|
236
|
+
h6(:h6_name, :name => 'h6_name')
|
|
237
|
+
h6(:h6_index, :index => 0)
|
|
238
|
+
h6(:h6_xpath, :xpath => '//h6')
|
|
239
|
+
h6(:h6_class_index, :class => 'h6_class', :index => 0)
|
|
240
|
+
h6(:h6_name_index, :name => 'h6_name', :index => 0)
|
|
241
|
+
|
|
242
|
+
paragraph(:p_id, :id => 'p_id')
|
|
243
|
+
paragraph(:p_class, :class => 'p_class')
|
|
244
|
+
paragraph(:p_name, :name => 'p_name')
|
|
245
|
+
paragraph(:p_index, :index => 0)
|
|
246
|
+
paragraph(:p_xpath, :xpath => '//p')
|
|
247
|
+
paragraph(:p_class_index, :class => 'p_class', :index => 0)
|
|
248
|
+
paragraph(:p_name_index, :name => 'p_name', :index => 0)
|
|
249
|
+
|
|
250
|
+
file_field(:file_field_id, :id => 'file_field_id')
|
|
251
|
+
file_field(:file_field_name, :name => 'file_field_name')
|
|
252
|
+
file_field(:file_field_class, :class => 'file_field_class')
|
|
253
|
+
file_field(:file_field_index, :index => 0)
|
|
254
|
+
file_field(:file_field_title, :title => 'file_field_title')
|
|
255
|
+
file_field(:file_field_xpath, :xpath => "//input[@type='file']")
|
|
256
|
+
file_field(:file_field_class_index, :class => 'file_field_class', :index => 0)
|
|
257
|
+
file_field(:file_field_name_index, :name => 'file_field_name', :index => 0)
|
|
258
|
+
|
|
259
|
+
link(:child, :id => 'child')
|
|
163
260
|
end
|