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.
- 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
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe Druid::Elements::TableRow do
|
5
|
+
describe "when mapping how to find an element" do
|
6
|
+
it "should map watir types to same" do
|
7
|
+
[:class, :id, :name, :xpath, :index].each do |t|
|
8
|
+
identifier = Druid::Elements::TableRow.identifier_for t => 'value'
|
9
|
+
expect(identifier.keys.first).to eql t
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
describe "interface" do
|
14
|
+
let(:element) { double 'element' }
|
15
|
+
let(:table_row) { Druid::Elements::TableRow.new(element) }
|
16
|
+
|
17
|
+
it "should return a table cell when indexed" do
|
18
|
+
expect(element).to receive(:[]).with(1)
|
19
|
+
expect(table_row[1]).to be_instance_of Druid::Elements::TableCell
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return the number of columns" do
|
23
|
+
expect(element).to receive_message_chain(:cells, :size).and_return(3)
|
24
|
+
expect(table_row.columns).to eql 3
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should iterate over the table columns" do
|
28
|
+
expect(table_row).to receive(:columns).and_return(3)
|
29
|
+
allow(table_row).to receive(:[])
|
30
|
+
count = 0
|
31
|
+
table_row.each do
|
32
|
+
count += 1
|
33
|
+
end
|
34
|
+
expect(count).to eql 3
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should register with tag_name :tr" do
|
38
|
+
expect(Druid::Elements.element_class_for(:tr)).to be Druid::Elements::TableRow
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe Druid::Elements::Table do
|
5
|
+
describe "when mapping how to find an element" do
|
6
|
+
it "should map watir types to same" do
|
7
|
+
[:class, :id, :name, :index, :xpath].each do |t|
|
8
|
+
identifier = Druid::Elements::Table.identifier_for t => 'value'
|
9
|
+
expect(identifier.keys.first).to eql t
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "interface" do
|
15
|
+
let(:element) { double('element')}
|
16
|
+
let(:table) { Druid::Elements::Table.new(element) }
|
17
|
+
|
18
|
+
it "should return a table row" do
|
19
|
+
expect(element).to receive(:[]).with(1)
|
20
|
+
expect(table[1]).to be_instance_of Druid::Elements::TableRow
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return the number of rows" do
|
24
|
+
expect(element).to receive_message_chain(:rows, :size).and_return(2)
|
25
|
+
expect(table.rows).to eql 2
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should iterate over the table rows" do
|
29
|
+
allow(element).to receive(:[])
|
30
|
+
expect(table).to receive(:rows).and_return(2)
|
31
|
+
count = 0
|
32
|
+
table.each do
|
33
|
+
count += 1
|
34
|
+
end
|
35
|
+
expect(count).to eql 2
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return the first row" do
|
39
|
+
expect(element).to receive(:[]).with(0).and_return(element)
|
40
|
+
expect(table.first_row).to be_instance_of Druid::Elements::TableRow
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return the last row" do
|
44
|
+
expect(element).to receive(:[]).with(-1).and_return(element)
|
45
|
+
expect(table.last_row).to be_instance_of Druid::Elements::TableRow
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should register with tag_name :table" do
|
49
|
+
expect(Druid::Elements.element_class_for(:table)).to be Druid::Elements::Table
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe Druid::Elements::TextArea do
|
5
|
+
describe "when mapping how to find an element" do
|
6
|
+
it "should map watir types to same" do
|
7
|
+
[:class, :id, :index, :name, :xpath].each do |t|
|
8
|
+
identifier = Druid::Elements::TextArea.identifier_for t => 'value'
|
9
|
+
expect(identifier.keys.first).to eql t
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should map selenium types to watir" do
|
14
|
+
identifier = Druid::Elements::TextArea.identifier_for :css => 'value'
|
15
|
+
expect(identifier.keys.first).to eql :tag_name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "interface" do
|
20
|
+
let(:element) { double "element" }
|
21
|
+
let(:text_area) { Druid::Elements::TextArea.new(element) }
|
22
|
+
it "should set its' value" do
|
23
|
+
expect(element).to receive(:send_keys).with('test')
|
24
|
+
text_area.value = 'test'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should register with tag_name :textarea" do
|
28
|
+
expect(Druid::Elements.element_class_for(:textarea)).to be Druid::Elements::TextArea
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe Druid::Elements::TextField do
|
5
|
+
describe "when mapping how to find an element" do
|
6
|
+
it "should map watir types to same" do
|
7
|
+
[:class, :id, :index, :name, :tag_name, :text, :css, :xpath, :title].each do |t|
|
8
|
+
identifier = Druid::Elements::TextField.identifier_for t => 'value'
|
9
|
+
expect(identifier.keys.first).to eql t
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "interface" do
|
15
|
+
let(:element) { double 'element' }
|
16
|
+
let(:text_field) { Druid::Elements::TextField.new(element) }
|
17
|
+
|
18
|
+
it "should set its' value" do
|
19
|
+
expect(element).to receive(:set).with('test')
|
20
|
+
text_field.value = 'test'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should register with type :text" do
|
24
|
+
expect(Druid::Elements.element_class_for(:input, :text)).to be Druid::Elements::TextField
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should register with type :password" do
|
28
|
+
expect(Druid::Elements.element_class_for(:input, :password)).to be Druid::Elements::TextField
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe Druid::Elements::UnOrderedList do
|
5
|
+
describe "when mapping how to find an element" do
|
6
|
+
it "should map watir types to same" do
|
7
|
+
[:class, :id, :index, :xpath].each do |t|
|
8
|
+
identifier = Druid::Elements::UnOrderedList.identifier_for t => 'value'
|
9
|
+
expect(identifier.keys.first).to eql t
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "interface" do
|
15
|
+
let(:element) { double 'element' }
|
16
|
+
let(:ul) { Druid::Elements::UnOrderedList.new(element) }
|
17
|
+
|
18
|
+
it "should return a list item when indexed" do
|
19
|
+
expect(element).to receive(:li)
|
20
|
+
expect(ul[1]).to be_instance_of Druid::Elements::ListItem
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should know how many items it contains" do
|
24
|
+
expect(element).to receive_message_chain(:lis, :size).and_return(3)
|
25
|
+
expect(ul.items).to eql 3
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should know how to iterate over the items" do
|
29
|
+
expect(ul).to receive(:items).and_return(3)
|
30
|
+
allow(ul).to receive(:[])
|
31
|
+
count = 0
|
32
|
+
ul.each do
|
33
|
+
count += 1
|
34
|
+
end
|
35
|
+
expect(count).to eql 3
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should register with tag_name :ul" do
|
39
|
+
expect(Druid::Elements.element_class_for(:ul)).to be Druid::Elements::UnOrderedList
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'druid/elements'
|
3
|
+
|
4
|
+
describe "Element with nested elements" do
|
5
|
+
let(:we) { double 'we'}
|
6
|
+
let(:element) { Druid::Elements::Element.new(we) }
|
7
|
+
let(:driver) { driver = element}
|
8
|
+
|
9
|
+
it "should find nested links" do
|
10
|
+
expect(we).to receive(:link).with(:id => 'blah').and_return(we)
|
11
|
+
element.link_element(:id => 'blah')
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should find nested buttons" do
|
15
|
+
expect(we).to receive(:button).with(:id => 'blah').and_return(we)
|
16
|
+
element.button_element(:id => 'blah')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should find nested text fields" do
|
20
|
+
expect(we).to receive(:text_field).with(:id => 'blah').and_return(we)
|
21
|
+
element.text_field_element(:id => 'blah')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should find nested hidden fields" do
|
25
|
+
expect(we).to receive(:hidden).and_return(we)
|
26
|
+
element.hidden_field_element
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should find nested text areas" do
|
30
|
+
expect(we).to receive(:textarea).and_return(we)
|
31
|
+
element.text_area_element
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should find nested select list" do
|
35
|
+
expect(we).to receive(:select_list).and_return(we)
|
36
|
+
element.select_list_element
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should find a nested checkbox" do
|
40
|
+
expect(we).to receive(:checkbox).and_return(we)
|
41
|
+
element.checkbox_element
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should find a nested radio button" do
|
45
|
+
expect(we).to receive(:radio).and_return(we)
|
46
|
+
element.radio_button_element
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should find a nested div" do
|
50
|
+
expect(we).to receive(:div).and_return(we)
|
51
|
+
element.div_element
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should find a nested span" do
|
55
|
+
expect(we).to receive(:span).and_return(we)
|
56
|
+
element.span_element
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should find a nested table" do
|
60
|
+
expect(we).to receive(:table).and_return(we)
|
61
|
+
element.table_element
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should find a nested cell" do
|
65
|
+
expect(we).to receive(:td).and_return(we)
|
66
|
+
element.cell_element
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should find a nested image" do
|
70
|
+
expect(we).to receive(:image).and_return(we)
|
71
|
+
element.image_element
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should find a nested form" do
|
75
|
+
expect(we).to receive(:form).and_return(we)
|
76
|
+
element.form_element
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should find a nested ordered list" do
|
80
|
+
expect(we).to receive(:ol).and_return(we)
|
81
|
+
element.ordered_list_element
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should find a nested unordered list" do
|
85
|
+
expect(we).to receive(:ul).and_return(we)
|
86
|
+
element.unordered_list_element
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should find a nested list item" do
|
90
|
+
expect(we).to receive(:li).and_return(we)
|
91
|
+
element.list_item_element
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should find a nested h1" do
|
95
|
+
expect(we).to receive(:h1).and_return(we)
|
96
|
+
element.h1_element
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should find a nested h2" do
|
100
|
+
expect(we).to receive(:h2).and_return(we)
|
101
|
+
element.h2_element
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should find a nested h3" do
|
105
|
+
expect(we).to receive(:h3).and_return(we)
|
106
|
+
element.h3_element
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should find a nested h4" do
|
110
|
+
expect(we).to receive(:h4).and_return(we)
|
111
|
+
element.h4_element
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should find a nested h5" do
|
115
|
+
expect(we).to receive(:h5).and_return(we)
|
116
|
+
element.h5_element
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should find a nested h6" do
|
120
|
+
expect(we).to receive(:h6).and_return(we)
|
121
|
+
element.h6_element
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should find a nested paragraph" do
|
125
|
+
expect(we).to receive(:p).and_return(we)
|
126
|
+
element.paragraph_element
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class DruidPagePopulator
|
4
|
+
include Druid
|
5
|
+
|
6
|
+
text_field(:tf, :id => 'id')
|
7
|
+
text_area(:ta, :id => 'id')
|
8
|
+
select_list(:sl, :id => 'id')
|
9
|
+
checkbox(:cb, :id => 'id')
|
10
|
+
radio_button(:rb, :id => 'id')
|
11
|
+
file_field(:ff, :id => 'id')
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Druid::PagePopulator do
|
15
|
+
let(:driver) { mock_driver }
|
16
|
+
let(:druid) { DruidPagePopulator.new(driver) }
|
17
|
+
|
18
|
+
it "should set a value in a text field" do
|
19
|
+
expect(druid).to receive(:tf=).with('value')
|
20
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
21
|
+
druid.populate_page_with('tf' => 'value')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not set a value if it is not found on the page" do
|
25
|
+
expect(druid).not_to receive(:text_field)
|
26
|
+
druid.populate_page_with('coffee' => 'value')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should set a value in a text area" do
|
30
|
+
expect(druid).to receive(:ta=).with('value')
|
31
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
32
|
+
druid.populate_page_with('ta' => 'value')
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should set a value in a select list" do
|
36
|
+
expect(druid).to receive(:sa=).with('value')
|
37
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
38
|
+
druid.populate_page_with('sa' => 'value')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should set a value in a file field" do
|
42
|
+
expect(druid).to receive(:ff=).with('value')
|
43
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
44
|
+
druid.populate_page_with('ff' => 'value')
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should check a checkbox to true is specified" do
|
48
|
+
expect(druid).to receive(:check_cb)
|
49
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
50
|
+
druid.populate_page_with('cb' => true)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should uncheck a checkbox to false is specified" do
|
54
|
+
expect(druid).to receive(:uncheck_cb)
|
55
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
56
|
+
druid.populate_page_with('cb' => false)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should select a radio button when true is specified" do
|
60
|
+
expect(druid).to receive(:select_rb)
|
61
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
62
|
+
druid.populate_page_with('rb' => true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should clear a radio button when false is specified" do
|
66
|
+
expect(druid).to receive(:clear_rb)
|
67
|
+
expect(druid).to receive(:is_enabled?).and_return(true)
|
68
|
+
druid.populate_page_with('rb' => false)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should not populate a checkbox if it is disabled" do
|
72
|
+
expect(druid).not_to receive(:check_cb)
|
73
|
+
expect(druid).to receive(:cb_element).and_return(driver)
|
74
|
+
expect(driver).to receive(:enabled?).and_return(false)
|
75
|
+
druid.populate_page_with('cb' => true)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should not populate a radio button when it is disabled" do
|
79
|
+
expect(druid).not_to receive(:select_rb)
|
80
|
+
expect(druid).to receive(:rb_element).and_return(driver)
|
81
|
+
expect(driver).to receive(:enabled?).and_return(false)
|
82
|
+
druid.populate_page_with('rb' => true)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should not populate a text field when it is disabled" do
|
86
|
+
expect(druid).not_to receive(:tf=)
|
87
|
+
expect(druid).to receive(:tf_element).and_return(driver)
|
88
|
+
expect(driver).to receive(:enabled?).and_return(false)
|
89
|
+
druid.populate_page_with('tf' => 'test')
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: druid-ts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Sheng
|
@@ -14,58 +14,50 @@ dependencies:
|
|
14
14
|
name: watir-webdriver
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 0.9.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - '
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.9'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 0.9.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: 3.4.0
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 3.4.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: cucumber
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: 1.3.20
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- -
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: 1.3.20
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: yard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.8.7.6
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.8.7.6
|
69
61
|
description: Druid DSL that works with Watir
|
70
62
|
email:
|
71
63
|
- 278570038@qq.com
|
@@ -73,41 +65,73 @@ executables: []
|
|
73
65
|
extensions: []
|
74
66
|
extra_rdoc_files: []
|
75
67
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .
|
68
|
+
- ".gitignore"
|
69
|
+
- ".rspec"
|
70
|
+
- ".rvmrc"
|
71
|
+
- ".travis.yml"
|
72
|
+
- ChangeLog
|
78
73
|
- Gemfile
|
79
74
|
- README.md
|
80
75
|
- Rakefile
|
81
76
|
- cucumber.yml
|
77
|
+
- druid.gemspec
|
78
|
+
- features/async.feature
|
82
79
|
- features/button.feature
|
83
80
|
- features/checkbox.feature
|
84
81
|
- features/div.feature
|
85
82
|
- features/element.feature
|
83
|
+
- features/file_field.feature
|
86
84
|
- features/form.feature
|
85
|
+
- features/frames.feature
|
86
|
+
- features/heading.feature
|
87
87
|
- features/hidden_field.feature
|
88
|
+
- features/html/async.html
|
89
|
+
- features/html/frame_1.html
|
90
|
+
- features/html/frame_2.html
|
91
|
+
- features/html/frame_3.html
|
92
|
+
- features/html/frames.html
|
93
|
+
- features/html/iframes.html
|
88
94
|
- features/html/images/circle.png
|
95
|
+
- features/html/modal.html
|
96
|
+
- features/html/modal_1.html
|
97
|
+
- features/html/modal_2.html
|
98
|
+
- features/html/nested_elements.html
|
99
|
+
- features/html/nested_frame_1.html
|
100
|
+
- features/html/nested_frame_2.html
|
101
|
+
- features/html/nested_frame_3.html
|
102
|
+
- features/html/nested_frames.html
|
89
103
|
- features/html/static_elements.html
|
90
104
|
- features/html/success.html
|
91
105
|
- features/image.feature
|
92
106
|
- features/link.feature
|
93
107
|
- features/list_item.feature
|
108
|
+
- features/modal_dialog.feature
|
109
|
+
- features/nested_elements.feature
|
94
110
|
- features/ordered_list.feature
|
95
111
|
- features/page_level_actions.feature
|
112
|
+
- features/paragraph.feature
|
96
113
|
- features/radio_button.feature
|
97
114
|
- features/select_list.feature
|
98
115
|
- features/span.feature
|
116
|
+
- features/step_definations/async_steps.rb
|
99
117
|
- features/step_definations/button_steps.rb
|
100
118
|
- features/step_definations/checkbox_steps.rb
|
101
119
|
- features/step_definations/div_steps.rb
|
102
120
|
- features/step_definations/element_steps.rb
|
121
|
+
- features/step_definations/file_field_steps.rb
|
103
122
|
- features/step_definations/form_steps.rb
|
123
|
+
- features/step_definations/frame_steps.rb
|
124
|
+
- features/step_definations/heading_steps.rb
|
104
125
|
- features/step_definations/hidden_field_steps.rb
|
105
126
|
- features/step_definations/image_steps.rb
|
106
127
|
- features/step_definations/link_steps.rb
|
107
128
|
- features/step_definations/list_item_steps.rb
|
129
|
+
- features/step_definations/modal_dialog_steps.rb
|
130
|
+
- features/step_definations/nested_elements_steps.rb
|
108
131
|
- features/step_definations/ordered_list_steps.rb
|
109
132
|
- features/step_definations/page_level_actions_steps.rb
|
110
133
|
- features/step_definations/page_traversal_steps.rb
|
134
|
+
- features/step_definations/paragraph_steps.rb
|
111
135
|
- features/step_definations/radio_button_steps.rb
|
112
136
|
- features/step_definations/select_list_steps.rb
|
113
137
|
- features/step_definations/span_steps.rb
|
@@ -117,7 +141,9 @@ files:
|
|
117
141
|
- features/step_definations/text_field_steps.rb
|
118
142
|
- features/step_definations/unordered_list_steps.rb
|
119
143
|
- features/support/env.rb
|
144
|
+
- features/support/hooks.rb
|
120
145
|
- features/support/page.rb
|
146
|
+
- features/support/persistent_browser.rb
|
121
147
|
- features/support/url_helper.rb
|
122
148
|
- features/table.feature
|
123
149
|
- features/table_cell.feature
|
@@ -126,17 +152,24 @@ files:
|
|
126
152
|
- features/unordered_list.feature
|
127
153
|
- lib/druid.rb
|
128
154
|
- lib/druid/accessors.rb
|
155
|
+
- lib/druid/assist.rb
|
156
|
+
- lib/druid/core_ext/string.rb
|
157
|
+
- lib/druid/element_locators.rb
|
129
158
|
- lib/druid/elements.rb
|
130
159
|
- lib/druid/elements/button.rb
|
131
160
|
- lib/druid/elements/check_box.rb
|
132
161
|
- lib/druid/elements/div.rb
|
133
162
|
- lib/druid/elements/element.rb
|
163
|
+
- lib/druid/elements/file_field.rb
|
134
164
|
- lib/druid/elements/form.rb
|
165
|
+
- lib/druid/elements/heading.rb
|
135
166
|
- lib/druid/elements/hidden_field.rb
|
136
167
|
- lib/druid/elements/image.rb
|
137
168
|
- lib/druid/elements/link.rb
|
138
169
|
- lib/druid/elements/list_item.rb
|
170
|
+
- lib/druid/elements/option.rb
|
139
171
|
- lib/druid/elements/ordered_list.rb
|
172
|
+
- lib/druid/elements/paragraph.rb
|
140
173
|
- lib/druid/elements/radio_button.rb
|
141
174
|
- lib/druid/elements/select_list.rb
|
142
175
|
- lib/druid/elements/span.rb
|
@@ -146,8 +179,38 @@ files:
|
|
146
179
|
- lib/druid/elements/text_area.rb
|
147
180
|
- lib/druid/elements/text_field.rb
|
148
181
|
- lib/druid/elements/unordered_list.rb
|
182
|
+
- lib/druid/nested_elements.rb
|
149
183
|
- lib/druid/page_factory.rb
|
184
|
+
- lib/druid/page_populator.rb
|
185
|
+
- spec/druid/accessors_spec.rb
|
150
186
|
- spec/druid/druid_spec.rb
|
187
|
+
- spec/druid/element_locators_spec.rb
|
188
|
+
- spec/druid/elements/button_spec.rb
|
189
|
+
- spec/druid/elements/check_box_spec.rb
|
190
|
+
- spec/druid/elements/div_spec.rb
|
191
|
+
- spec/druid/elements/element_spec.rb
|
192
|
+
- spec/druid/elements/file_field_spec.rb
|
193
|
+
- spec/druid/elements/form_spec.rb
|
194
|
+
- spec/druid/elements/heading_spec.rb
|
195
|
+
- spec/druid/elements/hidden_field_spec.rb
|
196
|
+
- spec/druid/elements/image_spec.rb
|
197
|
+
- spec/druid/elements/link_spec.rb
|
198
|
+
- spec/druid/elements/list_item_spec.rb
|
199
|
+
- spec/druid/elements/option_spec.rb
|
200
|
+
- spec/druid/elements/ordered_list_spec.rb
|
201
|
+
- spec/druid/elements/page_factory_spec.rb
|
202
|
+
- spec/druid/elements/paragraph_spec.rb
|
203
|
+
- spec/druid/elements/radio_button_spec.rb
|
204
|
+
- spec/druid/elements/select_list_spec.rb
|
205
|
+
- spec/druid/elements/span_spec.rb
|
206
|
+
- spec/druid/elements/table_cell_spec.rb
|
207
|
+
- spec/druid/elements/table_row_spec.rb
|
208
|
+
- spec/druid/elements/table_spec.rb
|
209
|
+
- spec/druid/elements/text_area_spec.rb
|
210
|
+
- spec/druid/elements/text_field_spec.rb
|
211
|
+
- spec/druid/elements/unordered_list_spec.rb
|
212
|
+
- spec/druid/nested_element_spec.rb
|
213
|
+
- spec/druid/page_populator_spec.rb
|
151
214
|
- spec/spec_helper.rb
|
152
215
|
homepage: http://github.com/timsheng/druid
|
153
216
|
licenses:
|
@@ -159,50 +222,78 @@ require_paths:
|
|
159
222
|
- lib
|
160
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
161
224
|
requirements:
|
162
|
-
- -
|
225
|
+
- - ">="
|
163
226
|
- !ruby/object:Gem::Version
|
164
227
|
version: '0'
|
165
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
229
|
requirements:
|
167
|
-
- -
|
230
|
+
- - ">="
|
168
231
|
- !ruby/object:Gem::Version
|
169
232
|
version: '0'
|
170
233
|
requirements: []
|
171
234
|
rubyforge_project: druid
|
172
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.5.1
|
173
236
|
signing_key:
|
174
237
|
specification_version: 4
|
175
238
|
summary: Druid DSL for browser testing
|
176
239
|
test_files:
|
240
|
+
- features/async.feature
|
177
241
|
- features/button.feature
|
178
242
|
- features/checkbox.feature
|
179
243
|
- features/div.feature
|
180
244
|
- features/element.feature
|
245
|
+
- features/file_field.feature
|
181
246
|
- features/form.feature
|
247
|
+
- features/frames.feature
|
248
|
+
- features/heading.feature
|
182
249
|
- features/hidden_field.feature
|
250
|
+
- features/html/async.html
|
251
|
+
- features/html/frame_1.html
|
252
|
+
- features/html/frame_2.html
|
253
|
+
- features/html/frame_3.html
|
254
|
+
- features/html/frames.html
|
255
|
+
- features/html/iframes.html
|
183
256
|
- features/html/images/circle.png
|
257
|
+
- features/html/modal.html
|
258
|
+
- features/html/modal_1.html
|
259
|
+
- features/html/modal_2.html
|
260
|
+
- features/html/nested_elements.html
|
261
|
+
- features/html/nested_frame_1.html
|
262
|
+
- features/html/nested_frame_2.html
|
263
|
+
- features/html/nested_frame_3.html
|
264
|
+
- features/html/nested_frames.html
|
184
265
|
- features/html/static_elements.html
|
185
266
|
- features/html/success.html
|
186
267
|
- features/image.feature
|
187
268
|
- features/link.feature
|
188
269
|
- features/list_item.feature
|
270
|
+
- features/modal_dialog.feature
|
271
|
+
- features/nested_elements.feature
|
189
272
|
- features/ordered_list.feature
|
190
273
|
- features/page_level_actions.feature
|
274
|
+
- features/paragraph.feature
|
191
275
|
- features/radio_button.feature
|
192
276
|
- features/select_list.feature
|
193
277
|
- features/span.feature
|
278
|
+
- features/step_definations/async_steps.rb
|
194
279
|
- features/step_definations/button_steps.rb
|
195
280
|
- features/step_definations/checkbox_steps.rb
|
196
281
|
- features/step_definations/div_steps.rb
|
197
282
|
- features/step_definations/element_steps.rb
|
283
|
+
- features/step_definations/file_field_steps.rb
|
198
284
|
- features/step_definations/form_steps.rb
|
285
|
+
- features/step_definations/frame_steps.rb
|
286
|
+
- features/step_definations/heading_steps.rb
|
199
287
|
- features/step_definations/hidden_field_steps.rb
|
200
288
|
- features/step_definations/image_steps.rb
|
201
289
|
- features/step_definations/link_steps.rb
|
202
290
|
- features/step_definations/list_item_steps.rb
|
291
|
+
- features/step_definations/modal_dialog_steps.rb
|
292
|
+
- features/step_definations/nested_elements_steps.rb
|
203
293
|
- features/step_definations/ordered_list_steps.rb
|
204
294
|
- features/step_definations/page_level_actions_steps.rb
|
205
295
|
- features/step_definations/page_traversal_steps.rb
|
296
|
+
- features/step_definations/paragraph_steps.rb
|
206
297
|
- features/step_definations/radio_button_steps.rb
|
207
298
|
- features/step_definations/select_list_steps.rb
|
208
299
|
- features/step_definations/span_steps.rb
|
@@ -212,13 +303,42 @@ test_files:
|
|
212
303
|
- features/step_definations/text_field_steps.rb
|
213
304
|
- features/step_definations/unordered_list_steps.rb
|
214
305
|
- features/support/env.rb
|
306
|
+
- features/support/hooks.rb
|
215
307
|
- features/support/page.rb
|
308
|
+
- features/support/persistent_browser.rb
|
216
309
|
- features/support/url_helper.rb
|
217
310
|
- features/table.feature
|
218
311
|
- features/table_cell.feature
|
219
312
|
- features/text_area.feature
|
220
313
|
- features/text_field.feature
|
221
314
|
- features/unordered_list.feature
|
315
|
+
- spec/druid/accessors_spec.rb
|
222
316
|
- spec/druid/druid_spec.rb
|
317
|
+
- spec/druid/element_locators_spec.rb
|
318
|
+
- spec/druid/elements/button_spec.rb
|
319
|
+
- spec/druid/elements/check_box_spec.rb
|
320
|
+
- spec/druid/elements/div_spec.rb
|
321
|
+
- spec/druid/elements/element_spec.rb
|
322
|
+
- spec/druid/elements/file_field_spec.rb
|
323
|
+
- spec/druid/elements/form_spec.rb
|
324
|
+
- spec/druid/elements/heading_spec.rb
|
325
|
+
- spec/druid/elements/hidden_field_spec.rb
|
326
|
+
- spec/druid/elements/image_spec.rb
|
327
|
+
- spec/druid/elements/link_spec.rb
|
328
|
+
- spec/druid/elements/list_item_spec.rb
|
329
|
+
- spec/druid/elements/option_spec.rb
|
330
|
+
- spec/druid/elements/ordered_list_spec.rb
|
331
|
+
- spec/druid/elements/page_factory_spec.rb
|
332
|
+
- spec/druid/elements/paragraph_spec.rb
|
333
|
+
- spec/druid/elements/radio_button_spec.rb
|
334
|
+
- spec/druid/elements/select_list_spec.rb
|
335
|
+
- spec/druid/elements/span_spec.rb
|
336
|
+
- spec/druid/elements/table_cell_spec.rb
|
337
|
+
- spec/druid/elements/table_row_spec.rb
|
338
|
+
- spec/druid/elements/table_spec.rb
|
339
|
+
- spec/druid/elements/text_area_spec.rb
|
340
|
+
- spec/druid/elements/text_field_spec.rb
|
341
|
+
- spec/druid/elements/unordered_list_spec.rb
|
342
|
+
- spec/druid/nested_element_spec.rb
|
343
|
+
- spec/druid/page_populator_spec.rb
|
223
344
|
- spec/spec_helper.rb
|
224
|
-
has_rdoc:
|