watir 6.17.0 → 6.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/actions/enable-safari/action.yml +11 -0
- data/.github/actions/install-chrome/action.yml +11 -0
- data/.github/workflows/linux.yml +61 -0
- data/.github/workflows/mac.yml +55 -0
- data/.github/workflows/unit.yml +31 -0
- data/.github/workflows/windows.yml +39 -0
- data/.rubocop_todo.yml +36 -0
- data/CHANGES.md +14 -0
- data/LICENSE +2 -2
- data/README.md +9 -10
- data/Rakefile +1 -1
- data/lib/watir.rb +1 -0
- data/lib/watir/adjacent.rb +1 -1
- data/lib/watir/alert.rb +1 -0
- data/lib/watir/attribute_helper.rb +2 -0
- data/lib/watir/browser.rb +2 -2
- data/lib/watir/cookies.rb +2 -0
- data/lib/watir/element_collection.rb +21 -6
- data/lib/watir/elements/element.rb +10 -10
- data/lib/watir/elements/html_elements.rb +0 -1
- data/lib/watir/elements/iframe.rb +2 -1
- data/lib/watir/elements/select.rb +20 -5
- data/lib/watir/generator/html/generator.rb +1 -1
- data/lib/watir/has_window.rb +17 -15
- data/lib/watir/js_execution.rb +2 -2
- data/lib/watir/js_snippets.rb +2 -2
- data/lib/watir/locators.rb +1 -3
- data/lib/watir/locators/element/selector_builder.rb +1 -1
- data/lib/watir/logger.rb +2 -18
- data/lib/watir/radio_set.rb +2 -2
- data/lib/watir/user_editable.rb +6 -2
- data/lib/watir/version.rb +1 -1
- data/lib/watir/wait.rb +2 -0
- data/lib/watir/wait/timer.rb +1 -1
- data/lib/watir/window.rb +7 -3
- data/lib/watir/window_collection.rb +105 -0
- data/lib/watirspec.rb +1 -0
- data/lib/watirspec/implementation.rb +3 -5
- data/lib/watirspec/runner.rb +1 -1
- data/lib/watirspec/server.rb +1 -1
- data/spec/spec_helper.rb +2 -7
- data/spec/unit/match_elements/element_spec.rb +17 -15
- data/spec/unit/unit_helper.rb +2 -4
- data/spec/watirspec/after_hooks_spec.rb +15 -11
- data/spec/watirspec/browser_spec.rb +3 -2
- data/spec/watirspec/elements/element_spec.rb +14 -11
- data/spec/watirspec/elements/filefield_spec.rb +2 -2
- data/spec/watirspec/elements/iframe_spec.rb +5 -7
- data/spec/watirspec/elements/link_spec.rb +5 -3
- data/spec/watirspec/elements/select_list_spec.rb +156 -37
- data/spec/watirspec/html/wait.html +5 -5
- data/spec/watirspec/html/window_switching.html +10 -0
- data/spec/watirspec/legacy_wait_spec.rb +216 -0
- data/spec/watirspec/support/rspec_matchers.rb +10 -7
- data/spec/watirspec/wait_spec.rb +257 -301
- data/spec/watirspec/window_switching_spec.rb +282 -160
- data/spec/watirspec_helper.rb +10 -15
- data/support/doctest_helper.rb +0 -2
- data/watir.gemspec +2 -2
- metadata +25 -13
- data/.travis.yml +0 -87
- data/appveyor.yml +0 -13
- data/spec/watirspec/relaxed_locate_spec.rb +0 -109
data/spec/watirspec_helper.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'watirspec'
|
2
2
|
require 'spec_helper'
|
3
|
+
require 'webdrivers'
|
3
4
|
|
4
5
|
Watir.default_timeout = 8
|
5
6
|
|
@@ -27,14 +28,14 @@ class LocalConfig
|
|
27
28
|
private
|
28
29
|
|
29
30
|
def load_webdrivers
|
30
|
-
case browser
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
@imp.driver_info = case browser
|
32
|
+
when :chrome
|
33
|
+
Webdrivers::Chromedriver.update
|
34
|
+
"chromedriver version: #{Webdrivers::Chromedriver.current_version.version}"
|
35
|
+
when :firefox
|
36
|
+
Webdrivers::Geckodriver.update
|
37
|
+
"geckodriver version: #{Webdrivers::Geckodriver.current_version.version}"
|
38
|
+
end
|
38
39
|
end
|
39
40
|
|
40
41
|
def set_webdriver
|
@@ -86,12 +87,6 @@ class LocalConfig
|
|
86
87
|
matching_guards << :headless if @imp.browser_args.last[:headless]
|
87
88
|
matching_guards << :w3c if ENV['W3C']
|
88
89
|
|
89
|
-
# TODO: Replace this with Selenium::WebDriver::Platform.ci after next Selenium Release
|
90
|
-
if ENV['APPVEYOR']
|
91
|
-
matching_guards << :appveyor
|
92
|
-
matching_guards << [browser, :appveyor]
|
93
|
-
end
|
94
|
-
|
95
90
|
if !Selenium::WebDriver::Platform.linux? || ENV['DESKTOP_SESSION']
|
96
91
|
# some specs (i.e. Window#maximize) needs a window manager on linux
|
97
92
|
matching_guards << :window_manager
|
@@ -103,7 +98,7 @@ class LocalConfig
|
|
103
98
|
ENV['FIREFOX_BINARY'] ? {options: {binary: ENV['FIREFOX_BINARY']}} : {}
|
104
99
|
end
|
105
100
|
|
106
|
-
def
|
101
|
+
def safari_preview_args
|
107
102
|
{technology_preview: true}
|
108
103
|
end
|
109
104
|
|
data/support/doctest_helper.rb
CHANGED
data/watir.gemspec
CHANGED
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
26
26
|
s.require_paths = ['lib']
|
27
27
|
|
28
|
-
s.add_dependency 'selenium-webdriver', '
|
29
|
-
s.add_runtime_dependency 'regexp_parser', '
|
28
|
+
s.add_dependency 'selenium-webdriver', '>= 3.8'
|
29
|
+
s.add_runtime_dependency 'regexp_parser', '>= 1.2', '< 3'
|
30
30
|
|
31
31
|
s.add_development_dependency 'activesupport', '~> 4.0', '>= 4.1.11' # for pluralization during code generation
|
32
32
|
s.add_development_dependency 'coveralls'
|
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.
|
4
|
+
version: 6.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
@@ -10,36 +10,42 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: selenium-webdriver
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '3.
|
21
|
+
version: '3.8'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '3.
|
28
|
+
version: '3.8'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: regexp_parser
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '1.2'
|
36
|
+
- - "<"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '3'
|
36
39
|
type: :runtime
|
37
40
|
prerelease: false
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
|
-
- - "
|
43
|
+
- - ">="
|
41
44
|
- !ruby/object:Gem::Version
|
42
45
|
version: '1.2'
|
46
|
+
- - "<"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3'
|
43
49
|
- !ruby/object:Gem::Dependency
|
44
50
|
name: activesupport
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -283,15 +289,20 @@ extra_rdoc_files: []
|
|
283
289
|
files:
|
284
290
|
- ".document"
|
285
291
|
- ".github/ISSUE_TEMPLATE.md"
|
292
|
+
- ".github/actions/enable-safari/action.yml"
|
293
|
+
- ".github/actions/install-chrome/action.yml"
|
294
|
+
- ".github/workflows/linux.yml"
|
295
|
+
- ".github/workflows/mac.yml"
|
296
|
+
- ".github/workflows/unit.yml"
|
297
|
+
- ".github/workflows/windows.yml"
|
286
298
|
- ".gitignore"
|
287
299
|
- ".rubocop.yml"
|
288
|
-
- ".
|
300
|
+
- ".rubocop_todo.yml"
|
289
301
|
- CHANGES.md
|
290
302
|
- Gemfile
|
291
303
|
- LICENSE
|
292
304
|
- README.md
|
293
305
|
- Rakefile
|
294
|
-
- appveyor.yml
|
295
306
|
- lib/watir-webdriver.rb
|
296
307
|
- lib/watir.rb
|
297
308
|
- lib/watir/adjacent.rb
|
@@ -404,6 +415,7 @@ files:
|
|
404
415
|
- lib/watir/wait.rb
|
405
416
|
- lib/watir/wait/timer.rb
|
406
417
|
- lib/watir/window.rb
|
418
|
+
- lib/watir/window_collection.rb
|
407
419
|
- lib/watirspec.rb
|
408
420
|
- lib/watirspec/guards.rb
|
409
421
|
- lib/watirspec/implementation.rb
|
@@ -586,8 +598,8 @@ files:
|
|
586
598
|
- spec/watirspec/html/wait.html
|
587
599
|
- spec/watirspec/html/watirspec.css
|
588
600
|
- spec/watirspec/html/window_switching.html
|
601
|
+
- spec/watirspec/legacy_wait_spec.rb
|
589
602
|
- spec/watirspec/radio_set_spec.rb
|
590
|
-
- spec/watirspec/relaxed_locate_spec.rb
|
591
603
|
- spec/watirspec/screenshot_spec.rb
|
592
604
|
- spec/watirspec/scroll_spec.rb
|
593
605
|
- spec/watirspec/special_chars_spec.rb
|
@@ -619,7 +631,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
619
631
|
- !ruby/object:Gem::Version
|
620
632
|
version: '0'
|
621
633
|
requirements: []
|
622
|
-
rubygems_version: 3.
|
634
|
+
rubygems_version: 3.0.3
|
623
635
|
signing_key:
|
624
636
|
specification_version: 4
|
625
637
|
summary: Watir powered by Selenium
|
@@ -798,8 +810,8 @@ test_files:
|
|
798
810
|
- spec/watirspec/html/wait.html
|
799
811
|
- spec/watirspec/html/watirspec.css
|
800
812
|
- spec/watirspec/html/window_switching.html
|
813
|
+
- spec/watirspec/legacy_wait_spec.rb
|
801
814
|
- spec/watirspec/radio_set_spec.rb
|
802
|
-
- spec/watirspec/relaxed_locate_spec.rb
|
803
815
|
- spec/watirspec/screenshot_spec.rb
|
804
816
|
- spec/watirspec/scroll_spec.rb
|
805
817
|
- spec/watirspec/special_chars_spec.rb
|
data/.travis.yml
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# Please note that we should not be using container-based infrastructure
|
2
|
-
# because Chrome requires a lot of shared memory and Travis does not allow
|
3
|
-
# use host's /dev/shm.
|
4
|
-
sudo: required
|
5
|
-
dist: trusty
|
6
|
-
cache: bundler
|
7
|
-
notifications:
|
8
|
-
slack:
|
9
|
-
secure: BLsBCm33R32VNRccrLx9F0P24X6BVpVHj1OWaN4Kyn6g9qXteIwC2VKVMnKNbifpojfMkrn0OeFQFK1O1DSOsC3mgzn/udoB+DnUGcSemFUn04xhbYF5SI+3zGPKPo0JLvjjdEKSSma84YwKdrj88pGUK34p01gL8hiaqjFzWdk=
|
10
|
-
before_install:
|
11
|
-
- gem update --system
|
12
|
-
- gem install bundler
|
13
|
-
|
14
|
-
before_script:
|
15
|
-
- support/travis.sh
|
16
|
-
- export PATH=~/.webdrivers:$PATH
|
17
|
-
|
18
|
-
script: bundle exec rake $RAKE_TASK
|
19
|
-
|
20
|
-
_version:
|
21
|
-
five: &five
|
22
|
-
language: ruby
|
23
|
-
rvm: 2.5.8
|
24
|
-
six: &six
|
25
|
-
language: ruby
|
26
|
-
rvm: 2.6.6
|
27
|
-
seven: &seven
|
28
|
-
language: ruby
|
29
|
-
rvm: 2.7.1
|
30
|
-
|
31
|
-
_browsers:
|
32
|
-
firefox: &firefox-latest
|
33
|
-
addons:
|
34
|
-
firefox: latest
|
35
|
-
chrome: &chrome
|
36
|
-
addons:
|
37
|
-
chrome: stable
|
38
|
-
|
39
|
-
matrix:
|
40
|
-
include:
|
41
|
-
- env: RAKE_TASK=spec:remote_firefox
|
42
|
-
<<: *seven
|
43
|
-
<<: *firefox-latest
|
44
|
-
- env: RAKE_TASK=spec:remote_chrome
|
45
|
-
<<: *seven
|
46
|
-
<<: *chrome
|
47
|
-
- env: RAKE_TASK=spec:firefox RELAXED_LOCATE=false
|
48
|
-
<<: *seven
|
49
|
-
<<: *firefox-latest
|
50
|
-
- env: RAKE_TASK=spec:firefox
|
51
|
-
<<: *seven
|
52
|
-
<<: *firefox-latest
|
53
|
-
- env: RAKE_TASK=spec:firefox
|
54
|
-
<<: *six
|
55
|
-
<<: *firefox-latest
|
56
|
-
- env: RAKE_TASK=spec:firefox
|
57
|
-
<<: *five
|
58
|
-
<<: *firefox-latest
|
59
|
-
- env: RAKE_TASK=spec:chrome
|
60
|
-
<<: *seven
|
61
|
-
<<: *chrome
|
62
|
-
- env: RAKE_TASK=spec:chrome
|
63
|
-
<<: *six
|
64
|
-
<<: *chrome
|
65
|
-
- env: RAKE_TASK=spec:chrome
|
66
|
-
<<: *five
|
67
|
-
<<: *chrome
|
68
|
-
- env: RAKE_TASK=spec:chrome RELAXED_LOCATE=false
|
69
|
-
<<: *seven
|
70
|
-
<<: *chrome
|
71
|
-
- env: RAKE_TASK=spec:chrome W3C=true
|
72
|
-
<<: *seven
|
73
|
-
<<: *chrome
|
74
|
-
- env: RAKE_TASK=spec:chrome HEADLESS=true
|
75
|
-
<<: *seven
|
76
|
-
<<: *chrome
|
77
|
-
- env: RAKE_TASK=spec:unit
|
78
|
-
<<: *seven
|
79
|
-
- env: RAKE_TASK=spec:stats
|
80
|
-
<<: *seven
|
81
|
-
<<: *chrome
|
82
|
-
- env: RAKE_TASK=yard:doctest
|
83
|
-
<<: *seven
|
84
|
-
<<: *chrome
|
85
|
-
- env: RAKE_TASK=rubocop
|
86
|
-
<<: *five
|
87
|
-
<<: *chrome
|
data/appveyor.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
version: "#{build}"
|
2
|
-
build: off
|
3
|
-
clone_depth: 100
|
4
|
-
install:
|
5
|
-
- set PATH=C:\Ruby25\bin;%PATH%
|
6
|
-
- gem update --system
|
7
|
-
- bundle install
|
8
|
-
test_script:
|
9
|
-
- bundle exec rake %RAKE_TASK%
|
10
|
-
environment:
|
11
|
-
matrix:
|
12
|
-
- RAKE_TASK: spec:chrome
|
13
|
-
- RAKE_TASK: spec:firefox
|
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'watirspec_helper'
|
2
|
-
|
3
|
-
describe 'Watir#relaxed_locate?' do
|
4
|
-
compliant_on :relaxed_locate do
|
5
|
-
context 'when true' do
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.url_for('wait.html'))
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'when acting on an element that is never present' do
|
11
|
-
it 'raises exception after timing out' do
|
12
|
-
element = browser.link(id: 'not_there')
|
13
|
-
expect { element.click }.to wait_and_raise_unknown_object_exception
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when acting on an element whose parent is never present' do
|
18
|
-
it 'raises exception after timing out' do
|
19
|
-
element = browser.link(id: 'not_there')
|
20
|
-
expect { element.element.click }.to wait_and_raise_unknown_object_exception
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'when acting on an element from a collection whose parent is never present' do
|
25
|
-
it 'raises exception after timing out' do
|
26
|
-
element = browser.link(id: 'not_there')
|
27
|
-
expect { element.elements[2].click }.to wait_and_raise_unknown_object_exception
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'when acting on an element that is already present' do
|
32
|
-
it 'does not wait' do
|
33
|
-
expect { browser.link.click }.to execute_immediately
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'when acting on an element that eventually becomes present' do
|
38
|
-
it 'waits until present and then takes action' do
|
39
|
-
start_time = ::Time.now
|
40
|
-
browser.a(id: 'show_bar').click
|
41
|
-
expect { browser.div(id: 'bar').click }.to_not raise_exception
|
42
|
-
expect(::Time.now - start_time).to be < Watir.default_timeout
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'waits until text field is displayed and then takes action' do
|
46
|
-
start_time = ::Time.now
|
47
|
-
browser.a(id: 'show_textfield').click
|
48
|
-
expect { browser.text_field(id: 'textfield').set 'Foo' }.to_not raise_exception
|
49
|
-
expect(::Time.now - start_time).to be < Watir.default_timeout
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context 'when acting on a text field that eventually becomes writable' do
|
54
|
-
it 'waits to not be readonly' do
|
55
|
-
expect(browser.text_field(id: 'writable')).to be_readonly
|
56
|
-
start_time = ::Time.now
|
57
|
-
browser.a(id: 'make-writable').click
|
58
|
-
expect { browser.text_field(id: 'writable').set 'foo' }.not_to raise_exception
|
59
|
-
expect(::Time.now - start_time).to be > 2
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'ensures all checks happen once even if time has expired' do
|
64
|
-
Watir.default_timeout = -1
|
65
|
-
expect { browser.link.click }.to_not raise_exception
|
66
|
-
ensure
|
67
|
-
Watir.default_timeout = 30
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'does not wait for parent element to be present when querying child element' do
|
71
|
-
el = browser.element(id: 'not_there').element(id: 'doesnt_matter')
|
72
|
-
expect { el.present? }.to execute_immediately
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'waits for parent element to be present before locating a collection' do
|
76
|
-
els = browser.element(id: /not|there/).elements(id: 'doesnt_matter')
|
77
|
-
expect { els.to_a }.to wait_and_raise_unknown_object_exception
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
not_compliant_on :relaxed_locate do
|
83
|
-
context 'when false' do
|
84
|
-
before :each do
|
85
|
-
browser.goto(WatirSpec.url_for('wait.html'))
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'when acting on an element that is never present' do
|
89
|
-
it 'raises exception immediately' do
|
90
|
-
element = browser.link(id: 'not_there')
|
91
|
-
start_time = ::Time.now
|
92
|
-
expect { element.click }.to raise_exception(Watir::Exception::UnknownObjectException)
|
93
|
-
expect(::Time.now - start_time).to be < 1
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'when acting on an element that eventually becomes present' do
|
98
|
-
it 'raises exception immediately' do
|
99
|
-
start_time = ::Time.now
|
100
|
-
browser.a(id: 'show_bar').click
|
101
|
-
|
102
|
-
expect { browser.div(id: 'bar').click }.to raise_unknown_object_exception
|
103
|
-
|
104
|
-
expect(::Time.now - start_time).to be < 1
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|