capybara-webkit 0.10.1 → 0.11.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.
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 2012-03-09 Joe Ferris <jferris@thoughtbot.com>
2
+ * node.rb, driver_spec.rb: Allow interaction with invisible elements
3
+
4
+ 2012-03-02 Joe Ferris <jferris@thoughtbot.com>
5
+ * browser.rb: Use Timeout from stdlib since Capybara.timeout is being removed
6
+
1
7
  2012-03-02 Matthew Mongeau <halogenandtoast@gmail.com>
2
8
  * capybara_webkit_builder.rb:
3
9
  set LANG to en_US.UTF-8 to prevent string encoding issues during install
data/NEWS.md CHANGED
@@ -1,4 +1,10 @@
1
+ New for 0.11.0:
2
+
3
+ * Allow interaction with invisible elements
4
+ * Use Timeout from stdlib since Capybara.timeout is being removed
5
+
1
6
  New for 0.10.1:
7
+
2
8
  * LANG environment variable is set to en_US.UTF-8 in order to avoid string encoding issues from qmake.
3
9
  * pro, find_command, and CommandFactory are more structured.
4
10
  * Changed wiki link and directing platform specific issues to the google group.
@@ -1,6 +1,6 @@
1
1
  require 'socket'
2
2
  require 'thread'
3
- require 'capybara/util/timeout'
3
+ require 'timeout'
4
4
  require 'json'
5
5
 
6
6
  class Capybara::Driver::Webkit
@@ -194,9 +194,10 @@ class Capybara::Driver::Webkit
194
194
  end
195
195
 
196
196
  def connect
197
- Capybara.timeout(5) do
198
- attempt_connect
199
- !@socket.nil?
197
+ Timeout.timeout(5) do
198
+ while @socket.nil?
199
+ attempt_connect
200
+ end
200
201
  end
201
202
  end
202
203
 
@@ -1,9 +1,5 @@
1
1
  class Capybara::Driver::Webkit
2
2
  class Node < Capybara::Driver::Node
3
-
4
- class ElementNotDisplayedError < StandardError
5
- end
6
-
7
3
  NBSP = "\xC2\xA0"
8
4
  NBSP.force_encoding("UTF-8") if NBSP.respond_to?(:force_encoding)
9
5
 
@@ -33,7 +29,6 @@ class Capybara::Driver::Webkit
33
29
  end
34
30
 
35
31
  def select_option
36
- check_visibility(self)
37
32
  invoke "selectOption"
38
33
  end
39
34
 
@@ -47,13 +42,10 @@ class Capybara::Driver::Webkit
47
42
  end
48
43
 
49
44
  def click
50
- check_visibility(self)
51
45
  invoke "click"
52
46
  end
53
47
 
54
48
  def drag_to(element)
55
- check_visibility(self)
56
- check_visibility(element)
57
49
  invoke 'dragTo', element.native
58
50
  end
59
51
 
@@ -122,9 +114,5 @@ class Capybara::Driver::Webkit
122
114
  def multiple_select?
123
115
  self.tag_name == "select" && self["multiple"] == "multiple"
124
116
  end
125
-
126
- def check_visibility(element)
127
- raise(ElementNotDisplayedError, "This element is not visible so it may not be interacted with") unless element.visible?
128
- end
129
117
  end
130
118
  end
@@ -1,7 +1,7 @@
1
1
  module Capybara
2
2
  module Driver
3
3
  class Webkit
4
- VERSION = '0.10.1'.freeze
4
+ VERSION = '0.11.0'.freeze
5
5
  end
6
6
  end
7
7
  end
data/spec/driver_spec.rb CHANGED
@@ -713,13 +713,10 @@ describe Capybara::Driver::Webkit do
713
713
  <div id="change">Change me</div>
714
714
  <div id="mouseup">Push me</div>
715
715
  <div id="mousedown">Release me</div>
716
- <div id="invisible-mouseup" style="display:none;">You can't push me</div>
717
- <div id="invisible-mousedown" style="display:none;">You can't release me</div>
718
716
  <form action="/" method="GET">
719
717
  <select id="change_select" name="change_select">
720
718
  <option value="1" id="option-1" selected="selected">one</option>
721
719
  <option value="2" id="option-2">two</option>
722
- <option value="2" id="invisible-option" style="display:none;">three</option>
723
720
  </select>
724
721
  </form>
725
722
  <script type="text/javascript">
@@ -741,7 +738,6 @@ describe Capybara::Driver::Webkit do
741
738
  });
742
739
  </script>
743
740
  <a href="/next">Next</a>
744
- <a href="/next" id="hidden" style="display:none;">Not displayed</a>
745
741
  </body></html>
746
742
  HTML
747
743
  [200,
@@ -750,7 +746,7 @@ describe Capybara::Driver::Webkit do
750
746
  end
751
747
  end
752
748
 
753
- it "clicks a visible element" do
749
+ it "clicks an element" do
754
750
  subject.find("//a").first.click
755
751
  subject.current_url =~ %r{/next$}
756
752
  end
@@ -782,39 +778,6 @@ describe Capybara::Driver::Webkit do
782
778
 
783
779
  subject.find("//*[@class='triggered']").size.should == 1
784
780
  end
785
-
786
- context "raises error when" do
787
- it "tries to click an invisible element" do
788
- expect {
789
- subject.find("//*[@id='hidden']").first.click
790
- }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError)
791
- end
792
-
793
- it "tries to drag an invisible element to a visible one" do
794
- draggable = subject.find("//*[@id='invisible-mousedown']").first
795
- container = subject.find("//*[@id='mouseup']").first
796
-
797
- expect {
798
- draggable.drag_to(container)
799
- }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError)
800
- end
801
-
802
- it "tries to drag a visible element to an invisible one" do
803
- draggable = subject.find("//*[@id='mousedown']").first
804
- container = subject.find("//*[@id='invisible-mouseup']").first
805
-
806
- expect {
807
- draggable.drag_to(container)
808
- }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError)
809
- end
810
-
811
- it "tries to select an invisible option" do
812
- option = subject.find("//option[@id='invisible-option']").first
813
- expect {
814
- option.select_option
815
- }.to raise_error(Capybara::Driver::Webkit::Node::ElementNotDisplayedError)
816
- end
817
- end
818
781
  end
819
782
 
820
783
  context "nesting app" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-webkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,11 +13,11 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-03-02 00:00:00.000000000Z
16
+ date: 2012-03-16 00:00:00.000000000Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: capybara
20
- requirement: &2153762820 !ruby/object:Gem::Requirement
20
+ requirement: &2152940960 !ruby/object:Gem::Requirement
21
21
  none: false
22
22
  requirements:
23
23
  - - ! '>='
@@ -28,10 +28,10 @@ dependencies:
28
28
  version: '1.2'
29
29
  type: :runtime
30
30
  prerelease: false
31
- version_requirements: *2153762820
31
+ version_requirements: *2152940960
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: json
34
- requirement: &2156481880 !ruby/object:Gem::Requirement
34
+ requirement: &2152940280 !ruby/object:Gem::Requirement
35
35
  none: false
36
36
  requirements:
37
37
  - - ! '>='
@@ -39,10 +39,10 @@ dependencies:
39
39
  version: '0'
40
40
  type: :runtime
41
41
  prerelease: false
42
- version_requirements: *2156481880
42
+ version_requirements: *2152940280
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
- requirement: &2156481340 !ruby/object:Gem::Requirement
45
+ requirement: &2152939740 !ruby/object:Gem::Requirement
46
46
  none: false
47
47
  requirements:
48
48
  - - ~>
@@ -50,10 +50,10 @@ dependencies:
50
50
  version: 2.6.0
51
51
  type: :development
52
52
  prerelease: false
53
- version_requirements: *2156481340
53
+ version_requirements: *2152939740
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: sinatra
56
- requirement: &2156480920 !ruby/object:Gem::Requirement
56
+ requirement: &2152939320 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ! '>='
@@ -61,10 +61,10 @@ dependencies:
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
- version_requirements: *2156480920
64
+ version_requirements: *2152939320
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: mini_magick
67
- requirement: &2156480460 !ruby/object:Gem::Requirement
67
+ requirement: &2152938860 !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
70
70
  - - ! '>='
@@ -72,10 +72,10 @@ dependencies:
72
72
  version: '0'
73
73
  type: :development
74
74
  prerelease: false
75
- version_requirements: *2156480460
75
+ version_requirements: *2152938860
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rake
78
- requirement: &2156480040 !ruby/object:Gem::Requirement
78
+ requirement: &2152938440 !ruby/object:Gem::Requirement
79
79
  none: false
80
80
  requirements:
81
81
  - - ! '>='
@@ -83,10 +83,10 @@ dependencies:
83
83
  version: '0'
84
84
  type: :development
85
85
  prerelease: false
86
- version_requirements: *2156480040
86
+ version_requirements: *2152938440
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: appraisal
89
- requirement: &2156479540 !ruby/object:Gem::Requirement
89
+ requirement: &2152937940 !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
92
  - - ~>
@@ -94,7 +94,7 @@ dependencies:
94
94
  version: 0.4.0
95
95
  type: :development
96
96
  prerelease: false
97
- version_requirements: *2156479540
97
+ version_requirements: *2152937940
98
98
  description:
99
99
  email: support@thoughtbot.com
100
100
  executables: []