watir-webdriver 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +78 -126
  3. data/LICENSE +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +1 -1
  6. data/lib/watir-webdriver.rb +15 -1
  7. data/lib/watir-webdriver/browser.rb +2 -1
  8. data/lib/watir-webdriver/cookies.rb +35 -7
  9. data/lib/watir-webdriver/elements/area.rb +13 -0
  10. data/lib/watir-webdriver/elements/element.rb +3 -3
  11. data/lib/watir-webdriver/elements/generated.rb +94 -55
  12. data/lib/watir-webdriver/elements/{frame.rb → iframe.rb} +41 -28
  13. data/lib/watir-webdriver/elements/input.rb +0 -16
  14. data/lib/watir-webdriver/elements/link.rb +13 -1
  15. data/lib/watir-webdriver/elements/text_area.rb +17 -0
  16. data/lib/watir-webdriver/html/generator.rb +2 -2
  17. data/lib/watir-webdriver/html/spec_extractor.rb +31 -4
  18. data/lib/watir-webdriver/html/visitor.rb +12 -4
  19. data/lib/watir-webdriver/locators/button_locator.rb +7 -13
  20. data/lib/watir-webdriver/locators/element_locator.rb +9 -5
  21. data/lib/watir-webdriver/locators/text_area_locator.rb +20 -0
  22. data/lib/watir-webdriver/locators/text_field_locator.rb +8 -0
  23. data/lib/watir-webdriver/version.rb +1 -1
  24. data/lib/watir-webdriver/wait.rb +23 -11
  25. data/spec/browser_spec.rb +18 -18
  26. data/spec/click_spec.rb +5 -5
  27. data/spec/container_spec.rb +5 -11
  28. data/spec/element_locator_spec.rb +32 -26
  29. data/spec/element_spec.rb +9 -9
  30. data/spec/implementation.rb +6 -2
  31. data/spec/input_spec.rb +11 -5
  32. data/spec/locator_spec_helper.rb +3 -3
  33. data/spec/special_chars_spec.rb +1 -1
  34. data/support/travis.sh +19 -5
  35. data/watir-webdriver.gemspec +1 -0
  36. metadata +37 -38
  37. data/spec/html/wait.html +0 -28
  38. data/spec/wait_spec.rb +0 -118
@@ -2,7 +2,7 @@ require 'active_support/ordered_hash'
2
2
 
3
3
  module LocatorSpecHelper
4
4
  def driver
5
- @driver ||= mock(Selenium::WebDriver::Driver)
5
+ @driver ||= double(Selenium::WebDriver::Driver)
6
6
  end
7
7
 
8
8
  def locator(selector, attrs)
@@ -28,10 +28,10 @@ module LocatorSpecHelper
28
28
 
29
29
  def element(opts = {})
30
30
  attrs = opts.delete(:attributes)
31
- el = mock(Watir::Element, opts)
31
+ el = double(Watir::Element, opts)
32
32
 
33
33
  attrs.each do |key, value|
34
- el.stub!(:attribute).with(key).and_return(value)
34
+ el.stub(:attribute).with(key).and_return(value)
35
35
  end if attrs
36
36
 
37
37
  el
@@ -7,7 +7,7 @@ describe Watir::Browser do
7
7
  end
8
8
 
9
9
  it "finds elements with single quotes" do
10
- browser.div(:text => "single 'quotes'").should exist
10
+ expect(browser.div(:text => "single 'quotes'")).to exist
11
11
  end
12
12
 
13
13
  end
@@ -3,16 +3,30 @@
3
3
  set -e
4
4
  set -x
5
5
 
6
- CHROME_REVISION=191150
7
- sh -e /etc/init.d/xvfb start && git submodule update --init
6
+ export CHROME_REVISION=228611
7
+ export CHROMEDRIVER_VERSION=2.4
8
+
9
+ sh -e /etc/init.d/xvfb start
10
+ git submodule update --init
8
11
 
9
12
  if [[ "$WATIR_WEBDRIVER_BROWSER" = "chrome" ]]; then
13
+ sudo chmod 1777 /dev/shm
14
+
10
15
  sudo apt-get install -y unzip libxss1
11
- curl -L -O "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$CHROME_REVISION/chrome-linux.zip"
16
+
17
+ curl -L -O "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/${CHROME_REVISION}/chrome-linux.zip"
12
18
  unzip chrome-linux.zip
13
- curl -L "http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/$CHROME_REVISION/chrome-linux.test/chromedriver" > chrome-linux/chromedriver
19
+
20
+ # chrome sandbox doesn't currently work on travis: https://github.com/travis-ci/travis-ci/issues/938
21
+ sudo chown root:root chrome-linux/chrome_sandbox
22
+ sudo chmod 4755 chrome-linux/chrome_sandbox
23
+ export CHROME_DEVEL_SANDBOX="$PWD/chrome-linux/chrome_sandbox"
24
+
25
+ curl -L -O "http://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
26
+ unzip chromedriver_linux64.zip
27
+
28
+ mv chromedriver chrome-linux/chromedriver
14
29
  chmod +x chrome-linux/chromedriver
15
- sudo chmod 1777 /dev/shm
16
30
  fi
17
31
 
18
32
  if [[ "$WATIR_WEBDRIVER_BROWSER" = "phantomjs" ]]; then
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://github.com/watir/watir-webdriver"
12
12
  s.summary = %q{Watir on WebDriver}
13
13
  s.description = %q{WebDriver-backed Watir}
14
+ s.license = 'MIT'
14
15
 
15
16
  s.rubyforge_project = "watir-webdriver"
16
17
 
metadata CHANGED
@@ -1,167 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-28 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 2.18.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.18.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.8.2.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.8.2.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webidl
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.1.5
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.1.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.9.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.9.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fuubar
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: nokogiri
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: activesupport
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '3.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: pry
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: coveralls
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: WebDriver-backed Watir
@@ -171,11 +171,11 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
- - .document
175
- - .gitignore
176
- - .gitmodules
177
- - .travis.yml
178
- - .yardopts
174
+ - ".document"
175
+ - ".gitignore"
176
+ - ".gitmodules"
177
+ - ".travis.yml"
178
+ - ".yardopts"
179
179
  - CHANGES.md
180
180
  - Gemfile
181
181
  - LICENSE
@@ -197,6 +197,7 @@ files:
197
197
  - lib/watir-webdriver/container.rb
198
198
  - lib/watir-webdriver/cookies.rb
199
199
  - lib/watir-webdriver/element_collection.rb
200
+ - lib/watir-webdriver/elements/area.rb
200
201
  - lib/watir-webdriver/elements/button.rb
201
202
  - lib/watir-webdriver/elements/checkbox.rb
202
203
  - lib/watir-webdriver/elements/dlist.rb
@@ -204,9 +205,9 @@ files:
204
205
  - lib/watir-webdriver/elements/file_field.rb
205
206
  - lib/watir-webdriver/elements/font.rb
206
207
  - lib/watir-webdriver/elements/form.rb
207
- - lib/watir-webdriver/elements/frame.rb
208
208
  - lib/watir-webdriver/elements/generated.rb
209
209
  - lib/watir-webdriver/elements/hidden.rb
210
+ - lib/watir-webdriver/elements/iframe.rb
210
211
  - lib/watir-webdriver/elements/image.rb
211
212
  - lib/watir-webdriver/elements/input.rb
212
213
  - lib/watir-webdriver/elements/link.rb
@@ -234,6 +235,7 @@ files:
234
235
  - lib/watir-webdriver/locators/child_cell_locator.rb
235
236
  - lib/watir-webdriver/locators/child_row_locator.rb
236
237
  - lib/watir-webdriver/locators/element_locator.rb
238
+ - lib/watir-webdriver/locators/text_area_locator.rb
237
239
  - lib/watir-webdriver/locators/text_field_locator.rb
238
240
  - lib/watir-webdriver/row_container.rb
239
241
  - lib/watir-webdriver/screenshot.rb
@@ -252,18 +254,17 @@ files:
252
254
  - spec/html/hover.html
253
255
  - spec/html/removed_element.html
254
256
  - spec/html/special_chars.html
255
- - spec/html/wait.html
256
257
  - spec/implementation.rb
257
258
  - spec/input_spec.rb
258
259
  - spec/locator_spec_helper.rb
259
260
  - spec/spec_helper.rb
260
261
  - spec/special_chars_spec.rb
261
- - spec/wait_spec.rb
262
262
  - support/travis.sh
263
263
  - support/version_differ.rb
264
264
  - watir-webdriver.gemspec
265
265
  homepage: http://github.com/watir/watir-webdriver
266
- licenses: []
266
+ licenses:
267
+ - MIT
267
268
  metadata: {}
268
269
  post_install_message:
269
270
  rdoc_options: []
@@ -271,17 +272,17 @@ require_paths:
271
272
  - lib
272
273
  required_ruby_version: !ruby/object:Gem::Requirement
273
274
  requirements:
274
- - - '>='
275
+ - - ">="
275
276
  - !ruby/object:Gem::Version
276
277
  version: '0'
277
278
  required_rubygems_version: !ruby/object:Gem::Requirement
278
279
  requirements:
279
- - - '>='
280
+ - - ">="
280
281
  - !ruby/object:Gem::Version
281
282
  version: '0'
282
283
  requirements: []
283
284
  rubyforge_project: watir-webdriver
284
- rubygems_version: 2.0.0
285
+ rubygems_version: 2.2.0
285
286
  signing_key:
286
287
  specification_version: 4
287
288
  summary: Watir on WebDriver
@@ -295,11 +296,9 @@ test_files:
295
296
  - spec/html/hover.html
296
297
  - spec/html/removed_element.html
297
298
  - spec/html/special_chars.html
298
- - spec/html/wait.html
299
299
  - spec/implementation.rb
300
300
  - spec/input_spec.rb
301
301
  - spec/locator_spec_helper.rb
302
302
  - spec/spec_helper.rb
303
303
  - spec/special_chars_spec.rb
304
- - spec/wait_spec.rb
305
304
  has_rdoc:
@@ -1,28 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html>
3
- <head>
4
- <title>wait test</title>
5
- <script type="text/javascript" charset="utf-8">
6
- function setTimeoutDisplay(id, display, timeout) {
7
- setTimeout(function() {
8
- document.getElementById(id).style.display = display;
9
- }, timeout);
10
- }
11
-
12
- function setTimeoutRemove(id, timeout) {
13
- setTimeout(function() {
14
- var e = document.getElementById(id);
15
- e.parentNode.removeChild(e);
16
- }, timeout);
17
- }
18
- </script>
19
- </head>
20
-
21
- <body>
22
- <div id="foo" style="display:block;">foo</div>
23
- <div id="bar" style="display:none;" onclick='this.innerHTML = "changed"'>bar</div>
24
- <a id="show_bar" href="#" onclick="setTimeoutDisplay('bar', 'block', 500);">show bar</a>
25
- <a id="hide_foo" href="#" onclick="setTimeoutDisplay('foo', 'none', 500);">hide foo</a>
26
- <a id="remove_foo" href="#" onclick="setTimeoutRemove('foo', 1000);">remove foo</a>
27
- </body>
28
- </html>
@@ -1,118 +0,0 @@
1
- require File.expand_path("watirspec/spec_helper", File.dirname(__FILE__))
2
-
3
- not_compliant_on [:webdriver, :safari] do
4
- describe Watir::Wait do
5
- describe "#until" do
6
- it "waits until the block returns true" do
7
- Wait.until(0.5) { true }.should be_true
8
- end
9
-
10
- it "times out" do
11
- lambda do
12
- Wait.until(0.5) { false }
13
- end.should raise_error(Watir::Wait::TimeoutError)
14
- end
15
-
16
- it "times out with a custom message" do
17
- lambda do
18
- Wait.until(0.5, "oops") { false }
19
- end.should raise_error(Watir::Wait::TimeoutError, "timed out after 0.5 seconds, oops")
20
- end
21
- end
22
-
23
- describe "#while" do
24
- it "waits while the block returns true" do
25
- Wait.while(0.5) { false }.should == nil
26
- end
27
-
28
- it "times out" do
29
- lambda do
30
- Wait.while(0.5) { true }
31
- end.should raise_error(Watir::Wait::TimeoutError)
32
- end
33
-
34
- it "times out with a custom message" do
35
- lambda do
36
- Wait.while(0.5, "oops") { true }
37
- end.should raise_error(Watir::Wait::TimeoutError, "timed out after 0.5 seconds, oops")
38
- end
39
- end
40
- end
41
-
42
- describe Watir::Element do
43
- before do
44
- browser.goto WatirSpec.url_for("wait.html", :needs_server => true)
45
- end
46
-
47
- describe "#when_present" do
48
- it "yields when the element becomes present" do
49
- called = false
50
-
51
- browser.a(:id, 'show_bar').click
52
- browser.div(:id, 'bar').when_present(2) { called = true }
53
-
54
- called.should be_true
55
- end
56
-
57
- it "invokes subsequent method calls when the element becomes present" do
58
- browser.a(:id, 'show_bar').click
59
-
60
- bar = browser.div(:id, 'bar')
61
- bar.when_present(2).click
62
- bar.text.should == "changed"
63
- end
64
-
65
- it "times out when given a block" do
66
- lambda {
67
- browser.div(:id, 'bar').when_present(1) {}
68
- }.should raise_error(Watir::Wait::TimeoutError)
69
- end
70
-
71
- it "times out when not given a block" do
72
- lambda {
73
- browser.div(:id, 'bar').when_present(1).click
74
- }.should raise_error(Watir::Wait::TimeoutError,
75
- /^timed out after 1 seconds, waiting for (\{:id=>"bar", :tag_name=>"div"\}|\{:tag_name=>"div", :id=>"bar"\}) to become present$/
76
- )
77
- end
78
-
79
- it "responds to Element methods" do
80
- decorator = browser.div.when_present
81
-
82
- decorator.should respond_to(:exist?)
83
- decorator.should respond_to(:present?)
84
- decorator.should respond_to(:click)
85
- end
86
- end
87
-
88
- describe "#wait_until_present" do
89
- it "it waits until the element appears" do
90
- browser.a(:id, 'show_bar').click
91
- browser.div(:id, 'bar').wait_until_present(5)
92
- end
93
-
94
- it "times out if the element doesn't appear" do
95
- lambda do
96
- browser.div(:id, 'bar').wait_until_present(1)
97
- end.should raise_error(Watir::Wait::TimeoutError,
98
- /^timed out after 1 seconds, waiting for (\{:id=>"bar", :tag_name=>"div"\}|\{:tag_name=>"div", :id=>"bar"\}) to become present$/
99
- )
100
- end
101
- end
102
-
103
- describe "#wait_while_present" do
104
- it "waits until the element disappears" do
105
- browser.a(:id, 'hide_foo').click
106
- browser.div(:id, 'foo').wait_while_present(1)
107
- end
108
-
109
- it "times out" do
110
- lambda do
111
- browser.div(:id, 'foo').wait_while_present(1)
112
- end.should raise_error(Watir::Wait::TimeoutError,
113
- /^timed out after 1 seconds, waiting for (\{:id=>"foo", :tag_name=>"div"\}|\{:tag_name=>"div", :id=>"foo"\}) to disappear$/
114
- )
115
- end
116
- end
117
- end
118
- end