watir-webdriver 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97a842500bc21408f519b175ca58df6c8533491a
4
- data.tar.gz: 65dd8b201a511705730c8e21c6e691e615b984c6
3
+ metadata.gz: 69667d301519d6ffd4340fe0187d9989d72cd0b5
4
+ data.tar.gz: 27ec93300295d47e1334fe0a92be7d40fceb9811
5
5
  SHA512:
6
- metadata.gz: 06f2ac29fc1ba7ade5cc45b5291757fe1d6c4f907a205ddb9aaf21a78208dc603afcb3aea128ff83ac4e677378cef87f8135724559b59f9c6a699b85c8f8ff27
7
- data.tar.gz: 01b2df0459f6fba07f5e4739e1bbd5ae3b7654c0eaf4d316725f1aa0a91c1e0e38508393d901f91f070c1994879b4cb58e555dbad9448907af08bd92fc997fdf
6
+ metadata.gz: 103bf16805460dd31e2e2c2151701c1eaaac607544868879a3e77ed83c85aa96b143d46d398355cca5eb024a5d16173bd7d05c7ac2a41bdb609de140c8ab6d1d
7
+ data.tar.gz: fac256f75d40768e6df698add77dbc0032cad9a48b3ef4f2878824e9c807c6c92b12ce137be68ec4a4aeddd6adb15a3ab85d0f8e81e651afc6f8de3eb6b05998
@@ -18,13 +18,13 @@ notifications:
18
18
  before_script: support/travis.sh
19
19
  script: bundle exec rake $RAKE_TASK
20
20
  env:
21
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=firefox
22
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=firefox ALWAYS_LOCATE=false
23
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=firefox PREFER_CSS=1 SELECTOR_STATS=1
24
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=chrome
25
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=chrome ALWAYS_LOCATE=false
26
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=chrome PREFER_CSS=1 SELECTOR_STATS=1
27
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=phantomjs
28
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=phantomjs ALWAYS_LOCATE=false
29
- - RAKE_TASK=spec WATIR_WEBDRIVER_BROWSER=phantomjs PREFER_CSS=1 SELECTOR_STATS=1
21
+ - RAKE_TASK=spec:firefox
22
+ - RAKE_TASK=spec:firefox ALWAYS_LOCATE=false
23
+ - RAKE_TASK=spec:firefox PREFER_CSS=1 SELECTOR_STATS=1
24
+ - RAKE_TASK=spec:chrome
25
+ - RAKE_TASK=spec:chrome ALWAYS_LOCATE=false
26
+ - RAKE_TASK=spec:chrome PREFER_CSS=1 SELECTOR_STATS=1
27
+ - RAKE_TASK=spec:phantomjs
28
+ - RAKE_TASK=spec:phantomjs ALWAYS_LOCATE=false
29
+ - RAKE_TASK=spec:phantomjs PREFER_CSS=1 SELECTOR_STATS=1
30
30
  - RAKE_TASK=yard:doctest
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.9.1 (2015-10-14)
2
+
3
+ * Fix permissions issue with element_locator file(#381)
4
+ * Trying to select a disabled option now raises `ObjectDisabledException` (#378)
5
+ * `Element#enabled?` raises `UnknownObjectException` if element is not present (#379)
6
+
1
7
  ### 0.9.0 (2015-10-08)
2
8
 
3
9
  * Improve performance for Select#include? (#375, thanks @Conky5)
@@ -34,16 +34,6 @@ module Watir
34
34
  end
35
35
  end
36
36
 
37
- #
38
- # Returns true if this element is enabled.
39
- #
40
- # @return [Boolean]
41
- #
42
-
43
- def enabled?
44
- !disabled?
45
- end
46
-
47
37
  private
48
38
 
49
39
  def locator_class
@@ -410,7 +410,8 @@ module Watir
410
410
  #
411
411
 
412
412
  def enabled?
413
- present? && element_call { @element.enabled? }
413
+ assert_exists
414
+ element_call { @element.enabled? }
414
415
  end
415
416
 
416
417
  #
@@ -3,15 +3,5 @@ module Watir
3
3
 
4
4
  alias_method :readonly?, :read_only?
5
5
 
6
- #
7
- # Returns true if input is enabled.
8
- #
9
- # @return [Boolean]
10
- #
11
-
12
- def enabled?
13
- !disabled?
14
- end
15
-
16
6
  end # Input
17
7
  end # Watir
@@ -2,16 +2,6 @@ module Watir
2
2
  class Select < HTMLElement
3
3
  include Watir::Exception
4
4
 
5
- #
6
- # Returns true if this element is enabled
7
- #
8
- # @return [Boolean]
9
- #
10
-
11
- def enabled?
12
- !disabled?
13
- end
14
-
15
5
  #
16
6
  # Clears all selected options.
17
7
  #
@@ -22,7 +12,7 @@ module Watir
22
12
  raise Error, "you can only clear multi-selects" unless multiple?
23
13
 
24
14
  options.each do |o|
25
- o.click if o.selected?
15
+ click_option(o) if o.selected?
26
16
  end
27
17
  end
28
18
 
@@ -156,7 +146,7 @@ module Watir
156
146
  end
157
147
  no_value_found(string) if elements.empty?
158
148
 
159
- elements.each { |e| e.click unless e.selected? }
149
+ elements.each { |e| click_option(e) unless e.selected? }
160
150
  elements.first.text
161
151
  else
162
152
  begin
@@ -167,8 +157,7 @@ module Watir
167
157
  no_value_found(string)
168
158
  end
169
159
 
170
- e.click unless e.selected?
171
-
160
+ click_option(e) unless e.selected?
172
161
  safe_text(e)
173
162
  end
174
163
  end
@@ -182,7 +171,7 @@ module Watir
182
171
  if multiple?
183
172
  found = elements.select do |e|
184
173
  next unless matches_regexp?(how, e, exp)
185
- e.click unless e.selected?
174
+ click_option(e) unless e.selected?
186
175
  true
187
176
  end
188
177
 
@@ -193,8 +182,7 @@ module Watir
193
182
  element = elements.find { |e| matches_regexp?(how, e, exp) }
194
183
  no_value_found(exp) unless element
195
184
 
196
- element.click unless element.selected?
197
-
185
+ click_option(element) unless element.selected?
198
186
  safe_text(element)
199
187
  end
200
188
  end
@@ -223,6 +211,11 @@ module Watir
223
211
  end
224
212
  end
225
213
 
214
+ def click_option(element)
215
+ element = Option.new(self, element: element) unless element.is_a?(Option)
216
+ element.click
217
+ end
218
+
226
219
  def safe_text(element)
227
220
  element.text
228
221
  rescue Selenium::WebDriver::Error::StaleElementReferenceError, Selenium::WebDriver::Error::UnhandledAlertError
@@ -1,3 +1,3 @@
1
1
  module Watir
2
- VERSION = '0.9.0'
2
+ VERSION = '0.9.1'
3
3
  end
@@ -4,7 +4,7 @@ describe 'Watir' do
4
4
  describe '#always_locate?' do
5
5
 
6
6
  before do
7
- browser.goto WatirSpec.url_for('removed_element.html', needs_server: true)
7
+ browser.goto WatirSpec.url_for('removed_element.html')
8
8
  end
9
9
 
10
10
  it 'determines whether #exist? returns false for stale element' do
@@ -3,7 +3,7 @@ require File.expand_path('../watirspec/spec_helper', __FILE__)
3
3
  describe Watir::Element do
4
4
  describe "#click" do
5
5
  before {
6
- browser.goto WatirSpec.url_for('clicks.html', needs_server: true)
6
+ browser.goto WatirSpec.url_for('clicks.html')
7
7
  }
8
8
 
9
9
  let(:clicker) { browser.element(id: "click-logger") }
@@ -4,7 +4,7 @@ describe Watir::Element do
4
4
 
5
5
  describe '#present?' do
6
6
  before do
7
- browser.goto(WatirSpec.url_for("wait.html", needs_server: true))
7
+ browser.goto(WatirSpec.url_for("wait.html"))
8
8
  end
9
9
 
10
10
  it 'returns true if the element exists and is visible' do
@@ -31,9 +31,27 @@ describe Watir::Element do
31
31
 
32
32
  end
33
33
 
34
+ describe "#enabled?" do
35
+ before do
36
+ browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
37
+ end
38
+
39
+ it "returns true if the element is enabled" do
40
+ expect(browser.element(name: 'new_user_submit')).to be_enabled
41
+ end
42
+
43
+ it "returns false if the element is disabled" do
44
+ expect(browser.element(name: 'new_user_submit_disabled')).to_not be_enabled
45
+ end
46
+
47
+ it "raises UnknownObjectException if the element doesn't exist" do
48
+ expect { browser.element(name: "no_such_name").enabled? }.to raise_error(Watir::Exception::UnknownObjectException)
49
+ end
50
+ end
51
+
34
52
  describe "#reset!" do
35
53
  it "successfully relocates collection elements after a reset!" do
36
- browser.goto(WatirSpec.url_for("wait.html", needs_server: true))
54
+ browser.goto(WatirSpec.url_for("wait.html"))
37
55
  element = browser.div(:id, 'foo')
38
56
  expect(element).to exist
39
57
  browser.refresh
@@ -45,7 +63,7 @@ describe Watir::Element do
45
63
 
46
64
  describe "#exists?" do
47
65
  before do
48
- browser.goto WatirSpec.url_for('removed_element.html', needs_server: true)
66
+ browser.goto WatirSpec.url_for('removed_element.html')
49
67
  end
50
68
 
51
69
  it "does not propagate StaleElementReferenceErrors" do
@@ -93,7 +111,7 @@ describe Watir::Element do
93
111
  describe "#element_call" do
94
112
 
95
113
  it 'handles exceptions when taking an action on an element that goes stale during execution' do
96
- browser.goto WatirSpec.url_for('removed_element.html', needs_server: true)
114
+ browser.goto WatirSpec.url_for('removed_element.html')
97
115
 
98
116
  watir_element = browser.div(id: "text")
99
117
 
@@ -119,7 +137,7 @@ describe Watir::Element do
119
137
  %i(webdriver iphone),
120
138
  %i(webdriver safari) do
121
139
  it "should hover over the element" do
122
- browser.goto WatirSpec.url_for('hover.html', needs_server: true)
140
+ browser.goto WatirSpec.url_for('hover.html')
123
141
  link = browser.a
124
142
 
125
143
  expect(link.style("font-size")).to eq "10px"
@@ -3,7 +3,7 @@ require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))
3
3
  describe Watir::Browser do
4
4
 
5
5
  before do
6
- browser.goto WatirSpec.url_for("special_chars.html", needs_server: true)
6
+ browser.goto WatirSpec.url_for("special_chars.html")
7
7
  end
8
8
 
9
9
  it "finds elements with single quotes" do
@@ -9,7 +9,7 @@ git submodule update --init
9
9
  mkdir ~/.yard
10
10
  bundle exec yard config -a autoload_plugins yard-doctest
11
11
 
12
- if [[ "$WATIR_WEBDRIVER_BROWSER" = "chrome" ]]; then
12
+ if [[ "$RAKE_TASK" = "spec:chrome" ]]; then
13
13
  export CHROME_REVISION=`curl -s http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE`
14
14
  export CHROMEDRIVER_VERSION=`curl -s http://chromedriver.storage.googleapis.com/LATEST_RELEASE`
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -276,10 +276,6 @@ files:
276
276
  - spec/container_spec.rb
277
277
  - spec/element_locator_spec.rb
278
278
  - spec/element_spec.rb
279
- - spec/html/clicks.html
280
- - spec/html/hover.html
281
- - spec/html/removed_element.html
282
- - spec/html/special_chars.html
283
279
  - spec/implementation.rb
284
280
  - spec/input_spec.rb
285
281
  - spec/locator_spec_helper.rb
@@ -309,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
305
  version: '0'
310
306
  requirements: []
311
307
  rubyforge_project: watir-webdriver
312
- rubygems_version: 2.4.5
308
+ rubygems_version: 2.4.8
313
309
  signing_key:
314
310
  specification_version: 4
315
311
  summary: Watir on WebDriver
@@ -320,10 +316,6 @@ test_files:
320
316
  - spec/container_spec.rb
321
317
  - spec/element_locator_spec.rb
322
318
  - spec/element_spec.rb
323
- - spec/html/clicks.html
324
- - spec/html/hover.html
325
- - spec/html/removed_element.html
326
- - spec/html/special_chars.html
327
319
  - spec/implementation.rb
328
320
  - spec/input_spec.rb
329
321
  - spec/locator_spec_helper.rb
@@ -1,19 +0,0 @@
1
- <html>
2
- <head>
3
- <script src="../watirspec/html/javascript/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
4
- </head>
5
- <script>
6
- $(document).ready(function() {
7
- $("#click-logger").click(function(evt) {
8
- $("#log").append("<p>shift=" + evt.shiftKey + " alt=" + evt.altKey + "</p>");
9
- });
10
- });
11
- </script>
12
- <body>
13
- <div id="click-logger">click me</div>
14
- <div id="log"></div>
15
- <div>
16
- <div onclick="this.innerHTML = 'You Clicked It!'" style="color: red; text-decoration: underline; cursor: pointer;">Can You Click This?</div>
17
- </div>
18
- </body>
19
- </html>
@@ -1,12 +0,0 @@
1
- <html>
2
- <head>
3
- <style type="text/css" media="screen">
4
- a { font-size: 10px; }
5
- a:hover { font-size: 20px; }
6
- </style>
7
- </head>
8
-
9
- <body>
10
- <a href="#">hello</a>
11
- </body>
12
- </html>
@@ -1,24 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html>
3
- <head>
4
- <title>obsolete element</title>
5
- <script type="text/javascript" charset="utf-8">
6
- function removeText() {
7
- var e = document.getElementById("text");
8
- e.parentNode.removeChild(e);
9
- }
10
- </script>
11
- </head>
12
-
13
- <body>
14
- <button id='remove-button' onclick="removeText()">Remove text</button>
15
- <div id="text">Text</div>
16
-
17
- <div id='top'>Top Element>
18
- <div id='middle'>Middle Element>
19
- <div id='bottom'>Bottom Element</div>
20
- </div>
21
- </div>
22
-
23
- </body>
24
- </html>
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <title>Special Chars</title>
6
- </head>
7
-
8
- <body>
9
- <div id='single-quote'>single 'quotes'</div>
10
- <div id='double-quote'>double "quotes"</div>
11
- </body>
12
- </html>