druid-ts 1.1.3 → 1.1.4
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/ChangeLog +27 -0
- data/features/async.feature +6 -0
- data/features/div.feature +1 -0
- data/features/element.feature +4 -0
- data/features/hidden_field.feature +0 -2
- data/features/html/async.html +13 -0
- data/features/html/multi_elements.html +4 -0
- data/features/html/static_elements.html +10 -3
- data/features/link.feature +1 -0
- data/features/multi_elements.feature +135 -25
- data/features/select_list.feature +8 -0
- data/features/span.feature +2 -0
- data/features/step_definations/async_steps.rb +17 -0
- data/features/step_definations/element_steps.rb +6 -0
- data/features/step_definations/multi_elements_steps.rb +96 -0
- data/features/step_definations/select_list_steps.rb +12 -0
- data/features/step_definations/table_steps.rb +20 -3
- data/features/support/ajax_test_environment.rb +1 -1
- data/features/support/page.rb +7 -2
- data/features/table.feature +35 -0
- data/features/text_area.feature +0 -2
- data/features/text_field.feature +1 -2
- data/lib/druid.rb +31 -3
- data/lib/druid/accessors.rb +184 -146
- data/lib/druid/assist.rb +10 -2
- data/lib/druid/element_locators.rb +186 -102
- data/lib/druid/elements/div.rb +1 -1
- data/lib/druid/elements/element.rb +131 -96
- data/lib/druid/elements/hidden_field.rb +1 -5
- data/lib/druid/elements/link.rb +1 -1
- data/lib/druid/elements/select_list.rb +8 -0
- data/lib/druid/elements/span.rb +1 -1
- data/lib/druid/elements/table.rb +14 -3
- data/lib/druid/elements/table_row.rb +17 -2
- data/lib/druid/elements/text_area.rb +0 -8
- data/lib/druid/elements/text_field.rb +1 -1
- data/lib/druid/javascript/yui.rb +19 -0
- data/lib/druid/javascript_framework_facade.rb +3 -1
- data/lib/druid/nested_elements.rb +1 -1
- data/lib/druid/page_factory.rb +25 -0
- data/lib/druid/page_populator.rb +1 -0
- data/lib/druid/version.rb +1 -1
- data/spec/druid/accessors_spec.rb +189 -1
- data/spec/druid/druid_spec.rb +6 -0
- data/spec/druid/element_locators_spec.rb +276 -0
- data/spec/druid/elements/div_spec.rb +1 -1
- data/spec/druid/elements/element_spec.rb +11 -0
- data/spec/druid/elements/hidden_field_spec.rb +0 -5
- data/spec/druid/elements/link_spec.rb +1 -1
- data/spec/druid/elements/span_spec.rb +1 -1
- data/spec/druid/elements/text_area_spec.rb +0 -5
- data/spec/druid/elements/text_field_spec.rb +1 -1
- data/spec/druid/page_factory_spec.rb +20 -0
- data/spec/druid/page_populator_spec.rb +8 -4
- metadata +2 -1
@@ -4,7 +4,7 @@ require 'druid/elements'
|
|
4
4
|
describe Druid::Elements::Div do
|
5
5
|
describe "when mapping how to find an element" do
|
6
6
|
it "should map watir types to same" do
|
7
|
-
[:class, :id, :text, :index, :xpath].each do |t|
|
7
|
+
[:class, :id, :text, :index, :xpath, :title].each do |t|
|
8
8
|
identifier = Druid::Elements::Div.identifier_for t => 'value'
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
@@ -82,6 +82,12 @@ describe Druid::Elements::Element do
|
|
82
82
|
expect(element.when_present(10)).to eq element
|
83
83
|
end
|
84
84
|
|
85
|
+
it "should use the overriden wait when set" do
|
86
|
+
Druid.default_element_wait = 20
|
87
|
+
expect(we).to receive(:wait_until_present).with(20)
|
88
|
+
element.when_present
|
89
|
+
end
|
90
|
+
|
85
91
|
it "should be able to block until it is visible" do
|
86
92
|
expect(Watir::Wait).to receive(:until).with(10, "Element was not visible in 10 seconds")
|
87
93
|
element.when_visible(10)
|
@@ -151,5 +157,10 @@ describe Druid::Elements::Element do
|
|
151
157
|
expect(we).to receive(:enabled?).and_return(false)
|
152
158
|
expect(element).to be_disabled
|
153
159
|
end
|
160
|
+
|
161
|
+
it "should be able to flash element" do
|
162
|
+
expect(we).to receive(:flash)
|
163
|
+
element.flash
|
164
|
+
end
|
154
165
|
end
|
155
166
|
end
|
@@ -9,11 +9,6 @@ describe Druid::Elements::HiddenField do
|
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
13
|
-
it "should map selenium types to watir" do
|
14
|
-
identifier = Druid::Elements::HiddenField.identifier_for :css => 'value'
|
15
|
-
expect(identifier.keys.first).to eql :tag_name
|
16
|
-
end
|
17
12
|
end
|
18
13
|
|
19
14
|
describe "interface" do
|
@@ -4,7 +4,7 @@ require 'druid/elements'
|
|
4
4
|
describe Druid::Elements::Link do
|
5
5
|
describe "when mapping how to find an element" do
|
6
6
|
it "should map watir types to same" do
|
7
|
-
[:class, :href, :id, :name, :text, :xpath, :css].each do |t|
|
7
|
+
[:class, :href, :id, :name, :text, :xpath, :css, :title].each do |t|
|
8
8
|
identifier = Druid::Elements::Link.identifier_for t => 'value'
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
@@ -4,7 +4,7 @@ require 'druid/elements'
|
|
4
4
|
describe Druid::Elements::Span do
|
5
5
|
describe "when mapping how to find an element" do
|
6
6
|
it "should map watir types to same" do
|
7
|
-
[:class, :id, :index, :xpath, :text].each do |t|
|
7
|
+
[:class, :id, :index, :title, :xpath, :text].each do |t|
|
8
8
|
identifier = Druid::Elements::Span.identifier_for t => 'value'
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
@@ -9,11 +9,6 @@ describe Druid::Elements::TextArea do
|
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
11
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
12
|
end
|
18
13
|
|
19
14
|
describe "interface" do
|
@@ -4,7 +4,7 @@ require 'druid/elements'
|
|
4
4
|
describe Druid::Elements::TextField do
|
5
5
|
describe "when mapping how to find an element" do
|
6
6
|
it "should map watir types to same" do
|
7
|
-
[:class, :id, :index, :name, :
|
7
|
+
[:class, :id, :index, :name, :text, :xpath, :title, :label].each do |t|
|
8
8
|
identifier = Druid::Elements::TextField.identifier_for t => 'value'
|
9
9
|
expect(identifier.keys.first).to eql t
|
10
10
|
end
|
@@ -77,6 +77,26 @@ describe Druid::PageFactory do
|
|
77
77
|
expect(current_page).to be page
|
78
78
|
end
|
79
79
|
|
80
|
+
it "should not execute block if page is not @current_page" do
|
81
|
+
world.instance_variable_set "@current_page", TestPageWithDirectUrl.new(driver)
|
82
|
+
world.if_page(FactoryTestDruid) do |page|
|
83
|
+
fail
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return the @current_page if asking for another page" do
|
88
|
+
expected = TestPageWithDirectUrl.new(driver)
|
89
|
+
world.instance_variable_set "@current_page", expected
|
90
|
+
expect(world.if_page(FactoryTestDruid)).to be expected
|
91
|
+
end
|
92
|
+
|
93
|
+
# it "should execute the block when we ask if it is the correct page" do
|
94
|
+
# world.instance_variable_set "@current_page", FactoryTestDruid.new(driver)
|
95
|
+
# world.if_page(FactoryTestDruid) do |page|
|
96
|
+
# expect(page).to be_instance_of FactoryTestDruid
|
97
|
+
# end
|
98
|
+
# end
|
99
|
+
|
80
100
|
it "should raise an error when you do not provide a default route" do
|
81
101
|
expect { Druid::PageFactory.routes = {:another => []} }.to raise_error 'You must provide a :default route for PageFactory routes'
|
82
102
|
end
|
@@ -28,7 +28,8 @@ describe Druid::PagePopulator do
|
|
28
28
|
|
29
29
|
it "should set a value in a text area" do
|
30
30
|
expect(druid).to receive(:ta=).with('value')
|
31
|
-
expect(druid).to receive(:
|
31
|
+
expect(druid).to receive(:ta_element).and_return(driver)
|
32
|
+
expect(driver).to receive(:tag_name).and_return('textarea')
|
32
33
|
druid.populate_page_with('ta' => 'value')
|
33
34
|
end
|
34
35
|
|
@@ -70,22 +71,25 @@ describe Druid::PagePopulator do
|
|
70
71
|
|
71
72
|
it "should not populate a checkbox if it is disabled" do
|
72
73
|
expect(druid).not_to receive(:check_cb)
|
73
|
-
expect(druid).to receive(:cb_element).and_return(driver)
|
74
|
+
expect(druid).to receive(:cb_element).twice.and_return(driver)
|
74
75
|
expect(driver).to receive(:enabled?).and_return(false)
|
76
|
+
expect(driver).to receive(:tag_name).and_return('input')
|
75
77
|
druid.populate_page_with('cb' => true)
|
76
78
|
end
|
77
79
|
|
78
80
|
it "should not populate a radio button when it is disabled" do
|
79
81
|
expect(druid).not_to receive(:select_rb)
|
80
|
-
expect(druid).to receive(:rb_element).and_return(driver)
|
82
|
+
expect(druid).to receive(:rb_element).twice.and_return(driver)
|
81
83
|
expect(driver).to receive(:enabled?).and_return(false)
|
84
|
+
expect(driver).to receive(:tag_name).and_return('input')
|
82
85
|
druid.populate_page_with('rb' => true)
|
83
86
|
end
|
84
87
|
|
85
88
|
it "should not populate a text field when it is disabled" do
|
86
89
|
expect(druid).not_to receive(:tf=)
|
87
|
-
expect(druid).to receive(:tf_element).and_return(driver)
|
90
|
+
expect(druid).to receive(:tf_element).twice.and_return(driver)
|
88
91
|
expect(driver).to receive(:enabled?).and_return(false)
|
92
|
+
expect(driver).to receive(:tag_name).and_return("input")
|
89
93
|
druid.populate_page_with('tf' => 'test')
|
90
94
|
end
|
91
95
|
|
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: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Sheng
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/druid/elements/unordered_list.rb
|
206
206
|
- lib/druid/javascript/jquery.rb
|
207
207
|
- lib/druid/javascript/prototype.rb
|
208
|
+
- lib/druid/javascript/yui.rb
|
208
209
|
- lib/druid/javascript_framework_facade.rb
|
209
210
|
- lib/druid/nested_elements.rb
|
210
211
|
- lib/druid/page_factory.rb
|