swamp 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/features/specifications/user_scans_select_box_elements_in_a_page.feature +11 -0
- data/features/support/page_examples/select_without_id_and_name.html +1 -0
- data/lib/swamp.rb +1 -0
- data/lib/swamp/complex_select_box.rb +11 -0
- data/lib/swamp/select_boxes.rb +3 -0
- data/lib/swamp/version.rb +1 -1
- data/spec/swamp/select_boxes_spec.rb +26 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6ab9f667564af8b8a224893d26848f2eed6e4c7
|
4
|
+
data.tar.gz: 47ba68f51f80b0a25b8fd1344c6e1faa2f30adb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d1df06d75df7a27a5a48f96e97caf2364f07f8dddfe241906e5eb7b126b04f15487ea990d2bd148288b075c83edfe02324bdb80d7c5b17b9770bc434c9b2a6
|
7
|
+
data.tar.gz: 725f4c672d632660446e777a8688dfdb8a03183f45b4ceba59f5fff02e117edd972d5d99d2029181657f7e975f85519b29f1c7fd7362aabb21ff6200bd61c30a
|
data/.travis.yml
CHANGED
@@ -28,3 +28,14 @@ Feature: user scans select box elements in a page
|
|
28
28
|
source.select(option, :from => "Region")
|
29
29
|
end
|
30
30
|
"""
|
31
|
+
|
32
|
+
Scenario: A select box that doesn't has either id or name
|
33
|
+
Given I enter the url for this page: "select_without_id_and_name.html"
|
34
|
+
When swamp scans that page
|
35
|
+
Then swamp should highlight this element: "select.provider-select"
|
36
|
+
And it should output the following code snippet
|
37
|
+
"""
|
38
|
+
def provider_select(option)
|
39
|
+
source.find(:css, "select.provider-select option[value='#{option}']").click
|
40
|
+
end
|
41
|
+
"""
|
@@ -0,0 +1 @@
|
|
1
|
+
<select class="provider-select" data-bound-key="region"><optgroup label="Next Generation Cloud Servers"><option value="compute,cloudServersOpenStack,ORD">Chicago (ORD)</option><option value="compute,cloudServersOpenStack,IAD">Northern Virginia (IAD)</option><option value="compute,cloudServersOpenStack,DFW">Dallas (DFW)</option><option value="compute,cloudServersOpenStack,HKG">Hong Kong (HKG)</option><option value="compute,cloudServersOpenStack,SYD">Sydney (SYD)</option></optgroup><optgroup label="First Generation Cloud Servers"><option value="compute,cloudServers">Dallas (DFW)</option></optgroup></select>
|
data/lib/swamp.rb
CHANGED
data/lib/swamp/select_boxes.rb
CHANGED
@@ -10,6 +10,9 @@ module Swamp
|
|
10
10
|
elsif has_name?(element)
|
11
11
|
shine %/select[name='#{element["name"]}']/
|
12
12
|
elements << Swamp::SelectBox.new(element["name"], element["name"])
|
13
|
+
else
|
14
|
+
shine %/select.#{element["class"]}/
|
15
|
+
elements << Swamp::ComplexSelectBox.new(element["class"], element["class"])
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
data/lib/swamp/version.rb
CHANGED
@@ -63,6 +63,32 @@ module Swamp
|
|
63
63
|
select_boxes.get.first.selector.should == "birthday_month"
|
64
64
|
end
|
65
65
|
end
|
66
|
+
|
67
|
+
context "when the select element doesn't has either id or name" do
|
68
|
+
let(:element) { {'class' => "provider-select"} }
|
69
|
+
|
70
|
+
before(:each) do
|
71
|
+
element.stub(:visible?).and_return(true)
|
72
|
+
select_boxes.page.stub(:all).with('select').and_return([element])
|
73
|
+
end
|
74
|
+
|
75
|
+
it "highlights the element" do
|
76
|
+
select_boxes.page.should_receive(:execute_script).twice
|
77
|
+
select_boxes.get
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns the element in the array using the class as the name" do
|
81
|
+
select_boxes.page.stub(:execute_script).and_return(nil)
|
82
|
+
select_boxes.get.should have(1).select_box
|
83
|
+
select_boxes.get.first.name.should == "provider-select"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "returns the element in the array using the class as the selector" do
|
87
|
+
select_boxes.page.stub(:execute_script).and_return(nil)
|
88
|
+
select_boxes.get.should have(1).select_box
|
89
|
+
select_boxes.get.first.selector.should == "provider-select"
|
90
|
+
end
|
91
|
+
end
|
66
92
|
end
|
67
93
|
end
|
68
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juraci de Lima Vieira Neto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -179,12 +179,14 @@ files:
|
|
179
179
|
- features/support/page_examples/radio.html
|
180
180
|
- features/support/page_examples/select_box_with_id.html
|
181
181
|
- features/support/page_examples/select_box_with_name_only.html
|
182
|
+
- features/support/page_examples/select_without_id_and_name.html
|
182
183
|
- features/support/setup.rb
|
183
184
|
- lib/swamp.rb
|
184
185
|
- lib/swamp/base.rb
|
185
186
|
- lib/swamp/builder.rb
|
186
187
|
- lib/swamp/button.rb
|
187
188
|
- lib/swamp/buttons.rb
|
189
|
+
- lib/swamp/complex_select_box.rb
|
188
190
|
- lib/swamp/element.rb
|
189
191
|
- lib/swamp/elements.rb
|
190
192
|
- lib/swamp/evaluator.rb
|
@@ -265,6 +267,7 @@ test_files:
|
|
265
267
|
- features/support/page_examples/radio.html
|
266
268
|
- features/support/page_examples/select_box_with_id.html
|
267
269
|
- features/support/page_examples/select_box_with_name_only.html
|
270
|
+
- features/support/page_examples/select_without_id_and_name.html
|
268
271
|
- features/support/setup.rb
|
269
272
|
- spec/spec_helper.rb
|
270
273
|
- spec/swamp/builder_spec.rb
|