watir 6.11.0.beta2 → 6.11.0

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
  SHA256:
3
- metadata.gz: 37e5bd05d8b6ed813503264d89bcaf6aceb4b67d5ad2217569c4aef4b7762ca5
4
- data.tar.gz: 49c34f4a6e37dec3788fdc5c91ae3d06368b6b0d34c5365387e46d2ee07fe922
3
+ metadata.gz: 8eaa5c46491ba52da6c95709e75cc9759e51de70b8a5687c2d44668c1bcd7bee
4
+ data.tar.gz: e66fd1830e0442e4165476ecdca900ec5aaf0aa7879f8006c223402d9442ad0d
5
5
  SHA512:
6
- metadata.gz: b654a96f43a8d9dc84645cc595c018a6263f180f3bd2e8dc20f03ed8ff2d43c135a267d0cf65f7c87c5cfe1ac9d3524cd438a77d13830ebfb179c9cbb4802693
7
- data.tar.gz: d358cfee80f3afae74f39f8aa1d91ba9e98ed6d231735ab19d535ccb3932a0ef273e29e5749dc3ca51778c6220a58e84e5774a26e44403ab0c1592db5fc1ade3
6
+ metadata.gz: 3492caa375debcda81ccc04efec7d2c34af1caa9689ad66e6d60d44bc23f51c103a60070e493d0d1e54255fc77837f10e5aa54054dd66ae1c794546f6ec29ceb
7
+ data.tar.gz: d27c43b7e043a1f2602959bc48be08efe4d4a12fa6ce5f353c1ea38f4b629452153c5232a393510dbed4608fd18fd8f69fbf7a08c573036ee3017d163d781e82
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 6.11.0 (2018-05-18)
2
+
3
+ * Improve lazy loading of element collections
4
+ * Fix regressions (#726, #730)
5
+
1
6
  ### 6.11.0.beta2 (2018-05-10)
2
7
 
3
8
  * Additional performance updates
@@ -37,15 +37,29 @@ module Watir
37
37
  #
38
38
  # Get the element at the given index.
39
39
  #
40
- # Also note that because of Watir's lazy loading, this will return an Element
41
- # instance even if the index is out of bounds.
40
+ # Any call to an ElementCollection including an adjacent selector
41
+ # can not be lazy loaded because it must store correct type
42
42
  #
43
43
  # @param [Integer] idx Index of wanted element, 0-indexed
44
44
  # @return [Watir::Element] Returns an instance of a Watir::Element subclass
45
45
  #
46
46
 
47
47
  def [](idx)
48
- element_class.new(@query_scope, @selector.merge(index: idx))
48
+ if @selector.key? :adjacent
49
+ to_a[idx] || element_class.new(@query_scope, {invalid_locator: true})
50
+ else
51
+ element_class.new(@query_scope, @selector.merge(index: idx))
52
+ end
53
+ end
54
+
55
+ #
56
+ # First element of the collection
57
+ #
58
+ # @return [Watir::Element] Returns an instance of a Watir::Element subclass
59
+ #
60
+
61
+ def first
62
+ self[0]
49
63
  end
50
64
 
51
65
  #
@@ -405,6 +405,7 @@ module Watir
405
405
  assert_exists
406
406
  @element.displayed?
407
407
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
408
+ reset!
408
409
  raise unknown_exception
409
410
  end
410
411
 
@@ -206,7 +206,7 @@ module Watir
206
206
  end
207
207
 
208
208
  def find_options(how, str_or_rx)
209
- browser.wait_while do
209
+ wait_while do
210
210
  case str_or_rx
211
211
  when String, Numeric, Regexp
212
212
  @found = how == :value ? options(value: str_or_rx) : []
@@ -53,6 +53,8 @@ describe "Adjacent Elements" do
53
53
 
54
54
  it "accepts a class_name argument" do
55
55
  siblings = browser.div(id: "second_sibling").siblings(class_name: 'b')
56
+ expect(siblings.first).to be_a Watir::Div
57
+ expect(siblings[0]).to be_a Watir::Div
56
58
  expect(siblings.size).to eq 2
57
59
  expect(siblings.all? { |sib| sib.is_a? Watir::Div }).to eq true
58
60
  end
@@ -111,7 +113,7 @@ describe "Adjacent Elements" do
111
113
  expect(browser.div(id: "second_sibling").following_siblings(tag_name: :div).first).to be_a Watir::Div
112
114
  end
113
115
 
114
- it "accepts class_name argument" do
116
+ it "accepts class_name argument for single class" do
115
117
  expect(browser.div(id: "second_sibling").following_siblings(class_name: 'b').size).to eq 1
116
118
  expect(browser.div(id: "second_sibling").following_siblings(class_name: 'b').first).to be_a Watir::Div
117
119
  end
@@ -54,6 +54,7 @@
54
54
  <a id="hide_foo" href="#" onclick="setTimeoutDisplay('foo', 'none', 500);">hide foo</a>
55
55
  <a id="remove_foo" href="#" onclick="setTimeoutRemove('foo', 1000);">remove foo</a>
56
56
  <a id="add_foobar" href="#" onclick="setTimeoutAddDisplay('foobar', 'bar', 1000);">add foobar</a>
57
+ <a id="readd_bar" href="#" onclick="setTimeoutRemove('bar', 500); setTimeoutAddDisplay('bar', 'foo', 1000);">re-add bar</a>
57
58
  <div id="buttons">
58
59
  <button id="btn" type="button" onclick="setDisabled('btn', true, 0)" disabled>Click To Disable!</button>
59
60
  <a id="enable_btn" href="#" onclick="setDisabled('btn', false, 500);">enable btn</a>
@@ -204,6 +204,11 @@ describe Watir::Element do
204
204
  expect { browser.div(id: 'bar').wait_until_present(timeout: 5) }.to_not raise_exception
205
205
  end
206
206
 
207
+ it "waits until the element re-appears" do
208
+ browser.link(id: 'readd_bar').click
209
+ expect { browser.div(id: 'bar').wait_until_present }.to_not raise_exception
210
+ end
211
+
207
212
  it "times out if the element doesn't appear" do
208
213
  inspected = '#<Watir::Div: located: false; {:id=>"bar", :tag_name=>"div"}>'
209
214
  error = Watir::Wait::TimeoutError
@@ -259,7 +264,6 @@ describe Watir::Element do
259
264
  Watir.default_timeout = 1
260
265
  element = browser.link(name: 'add_select').wait_until(&:exists?)
261
266
  begin
262
- start_time = ::Time.now
263
267
  browser.link(id: 'change_select').click
264
268
  expect { element.wait_while_present }.not_to raise_error
265
269
  ensure
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.11.0.beta2'
5
+ s.version = '6.11.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['Alex Rodionov', 'Titus Fortner']
8
8
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.11.0.beta2
4
+ version: 6.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-10 00:00:00.000000000 Z
12
+ date: 2018-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -520,9 +520,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
520
520
  version: '0'
521
521
  required_rubygems_version: !ruby/object:Gem::Requirement
522
522
  requirements:
523
- - - ">"
523
+ - - ">="
524
524
  - !ruby/object:Gem::Version
525
- version: 1.3.1
525
+ version: '0'
526
526
  requirements: []
527
527
  rubyforge_project: watir
528
528
  rubygems_version: 2.7.3