watir 7.0.0.beta1 → 7.0.0.beta5
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.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +7 -3
- data/.rubocop.yml +2 -7
- data/CHANGES.md +32 -0
- data/lib/watir/browser.rb +21 -7
- data/lib/watir/capabilities.rb +52 -7
- data/lib/watir/elements/date_field.rb +4 -1
- data/lib/watir/elements/date_time_field.rb +4 -1
- data/lib/watir/elements/element.rb +32 -3
- data/lib/watir/elements/font.rb +1 -0
- data/lib/watir/elements/iframe.rb +0 -1
- data/lib/watir/elements/radio.rb +2 -2
- data/lib/watir/elements/select.rb +63 -40
- data/lib/watir/has_window.rb +2 -0
- data/lib/watir/locators.rb +4 -0
- data/lib/watir/locators/element/matcher.rb +1 -1
- data/lib/watir/locators/element/selector_builder.rb +0 -3
- data/lib/watir/locators/element/selector_builder/xpath.rb +2 -1
- data/lib/watir/locators/option/matcher.rb +24 -0
- data/lib/watir/locators/option/selector_builder.rb +8 -0
- data/lib/watir/locators/option/selector_builder/xpath.rb +37 -0
- data/lib/watir/logger.rb +3 -74
- data/lib/watir/radio_set.rb +1 -0
- data/lib/watir/screenshot.rb +2 -8
- data/lib/watir/user_editable.rb +10 -3
- data/lib/watir/version.rb +1 -1
- data/lib/watir/window.rb +15 -4
- data/lib/watir/window_collection.rb +9 -0
- data/lib/watirspec.rb +4 -2
- data/lib/watirspec/guards.rb +1 -1
- data/lib/watirspec/remote_server.rb +2 -6
- data/lib/watirspec/server.rb +1 -1
- data/spec/spec_helper.rb +0 -10
- data/spec/unit/capabilities_spec.rb +198 -48
- data/spec/unit/match_elements/element_spec.rb +11 -0
- data/spec/watirspec/after_hooks_spec.rb +22 -45
- data/spec/watirspec/browser_spec.rb +185 -206
- data/spec/watirspec/cookies_spec.rb +47 -52
- data/spec/watirspec/drag_and_drop_spec.rb +5 -7
- data/spec/watirspec/elements/area_spec.rb +1 -5
- data/spec/watirspec/elements/button_spec.rb +4 -8
- data/spec/watirspec/elements/checkbox_spec.rb +2 -4
- data/spec/watirspec/elements/date_field_spec.rb +13 -16
- data/spec/watirspec/elements/date_time_field_spec.rb +14 -13
- data/spec/watirspec/elements/dd_spec.rb +3 -4
- data/spec/watirspec/elements/del_spec.rb +10 -12
- data/spec/watirspec/elements/div_spec.rb +41 -50
- data/spec/watirspec/elements/dl_spec.rb +4 -12
- data/spec/watirspec/elements/element_spec.rb +155 -89
- data/spec/watirspec/elements/elements_spec.rb +8 -9
- data/spec/watirspec/elements/filefield_spec.rb +5 -7
- data/spec/watirspec/elements/form_spec.rb +1 -1
- data/spec/watirspec/elements/forms_spec.rb +3 -5
- data/spec/watirspec/elements/frame_spec.rb +17 -22
- data/spec/watirspec/elements/iframe_spec.rb +21 -27
- data/spec/watirspec/elements/ins_spec.rb +10 -12
- data/spec/watirspec/elements/link_spec.rb +24 -26
- data/spec/watirspec/elements/links_spec.rb +8 -9
- data/spec/watirspec/elements/radio_spec.rb +11 -14
- data/spec/watirspec/elements/select_list_spec.rb +248 -117
- data/spec/watirspec/elements/span_spec.rb +10 -12
- data/spec/watirspec/elements/table_nesting_spec.rb +31 -34
- data/spec/watirspec/elements/table_spec.rb +11 -13
- data/spec/watirspec/elements/tbody_spec.rb +10 -12
- data/spec/watirspec/elements/td_spec.rb +4 -6
- data/spec/watirspec/elements/text_field_spec.rb +10 -12
- data/spec/watirspec/elements/tr_spec.rb +5 -7
- data/spec/watirspec/support/rspec_matchers.rb +1 -1
- data/spec/watirspec/user_editable_spec.rb +26 -28
- data/spec/watirspec/wait_spec.rb +255 -258
- data/spec/watirspec/window_switching_spec.rb +199 -200
- data/spec/watirspec_helper.rb +34 -31
- data/watir.gemspec +1 -1
- metadata +7 -8
- data/spec/implementation_spec.rb +0 -24
- data/spec/unit/logger_spec.rb +0 -81
data/spec/watirspec_helper.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'watirspec'
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'webdrivers'
|
4
|
+
require 'selenium/webdriver/support/guards'
|
4
5
|
|
5
|
-
Watir.default_timeout =
|
6
|
+
Watir.default_timeout = 5
|
6
7
|
|
7
8
|
if ENV['SELENIUM_STATS'] == 'true'
|
8
9
|
require 'selenium_statistics'
|
@@ -21,7 +22,6 @@ class LocalConfig
|
|
21
22
|
def configure
|
22
23
|
set_webdriver
|
23
24
|
set_browser_args
|
24
|
-
set_guard_proc
|
25
25
|
load_webdrivers
|
26
26
|
end
|
27
27
|
|
@@ -71,35 +71,6 @@ class LocalConfig
|
|
71
71
|
args
|
72
72
|
end
|
73
73
|
|
74
|
-
def set_guard_proc
|
75
|
-
matching_guards = add_guards
|
76
|
-
|
77
|
-
@imp.guard_proc = lambda { |args|
|
78
|
-
args.any? { |arg| matching_guards.include?(arg) }
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
def add_guards
|
83
|
-
matching_guards = common_guards
|
84
|
-
matching_guards << :local
|
85
|
-
matching_guards << [:local, browser]
|
86
|
-
matching_guards
|
87
|
-
end
|
88
|
-
|
89
|
-
def common_guards
|
90
|
-
matching_guards = [browser]
|
91
|
-
matching_guards << [browser, Selenium::WebDriver::Platform.os]
|
92
|
-
matching_guards << :headless if @imp.browser_args.last[:headless]
|
93
|
-
matching_guards << "v#{Watir::VERSION.tr('.', '_')[/.*(?=_)/]}".to_sym
|
94
|
-
matching_guards << :w3c if ENV['W3C']
|
95
|
-
|
96
|
-
if !Selenium::WebDriver::Platform.linux? || ENV['DESKTOP_SESSION']
|
97
|
-
# some specs (i.e. Window#maximize) needs a window manager on linux
|
98
|
-
matching_guards << :window_manager
|
99
|
-
end
|
100
|
-
matching_guards
|
101
|
-
end
|
102
|
-
|
103
74
|
def firefox_args
|
104
75
|
ENV['FIREFOX_BINARY'] ? {options: {binary: ENV['FIREFOX_BINARY']}} : {}
|
105
76
|
end
|
@@ -172,3 +143,35 @@ else
|
|
172
143
|
end
|
173
144
|
|
174
145
|
WatirSpec.run!
|
146
|
+
|
147
|
+
RSpec.configure do |config|
|
148
|
+
config.before do |example|
|
149
|
+
guards = Selenium::WebDriver::Support::Guards.new(example,
|
150
|
+
bug_tracker: 'https://github.com/watir/watir/issues')
|
151
|
+
|
152
|
+
guards.add_condition(:browser, WatirSpec.implementation.browser_args.first)
|
153
|
+
guards.add_condition(:platform, Selenium::WebDriver::Platform.os)
|
154
|
+
|
155
|
+
headless = WatirSpec.implementation.browser_args.last[:headless]
|
156
|
+
guards.add_condition(:headless, headless)
|
157
|
+
|
158
|
+
window_manager = !Selenium::WebDriver::Platform.linux? || !ENV['DESKTOP_SESSION'].nil?
|
159
|
+
guards.add_condition(:window_manager, window_manager)
|
160
|
+
|
161
|
+
remote = ENV['USE_REMOTE'] == 'true'
|
162
|
+
guards.add_condition(:remote, remote)
|
163
|
+
|
164
|
+
results = guards.disposition
|
165
|
+
send(*results) if results
|
166
|
+
|
167
|
+
$browser = WatirSpec.new_browser if $browser.nil? || $browser.closed?
|
168
|
+
end
|
169
|
+
|
170
|
+
if ENV['AUTOMATIC_RETRY']
|
171
|
+
require 'rspec/retry'
|
172
|
+
config.verbose_retry = true
|
173
|
+
config.display_try_failure_messages = true
|
174
|
+
config.default_retry_count = 3
|
175
|
+
config.exceptions_to_retry = [IOError, Net::ReadTimeout]
|
176
|
+
end
|
177
|
+
end
|
data/watir.gemspec
CHANGED
@@ -25,7 +25,7 @@ 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', '>= 4.0.0.
|
28
|
+
s.add_dependency 'selenium-webdriver', '>= 4.0.0.beta4'
|
29
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
|
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: 7.0.0.
|
4
|
+
version: 7.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: selenium-webdriver
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.0.0.
|
21
|
+
version: 4.0.0.beta4
|
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: 4.0.0.
|
28
|
+
version: 4.0.0.beta4
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: regexp_parser
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -381,6 +381,9 @@ files:
|
|
381
381
|
- lib/watir/locators/element/selector_builder/regexp_disassembler.rb
|
382
382
|
- lib/watir/locators/element/selector_builder/xpath.rb
|
383
383
|
- lib/watir/locators/element/selector_builder/xpath_support.rb
|
384
|
+
- lib/watir/locators/option/matcher.rb
|
385
|
+
- lib/watir/locators/option/selector_builder.rb
|
386
|
+
- lib/watir/locators/option/selector_builder/xpath.rb
|
384
387
|
- lib/watir/locators/row/selector_builder.rb
|
385
388
|
- lib/watir/locators/row/selector_builder/xpath.rb
|
386
389
|
- lib/watir/locators/text_area/selector_builder.rb
|
@@ -408,12 +411,10 @@ files:
|
|
408
411
|
- lib/watirspec/runner.rb
|
409
412
|
- lib/watirspec/server.rb
|
410
413
|
- lib/watirspec/server/app.rb
|
411
|
-
- spec/implementation_spec.rb
|
412
414
|
- spec/locator_spec_helper.rb
|
413
415
|
- spec/spec_helper.rb
|
414
416
|
- spec/unit/capabilities_spec.rb
|
415
417
|
- spec/unit/element_locator_spec.rb
|
416
|
-
- spec/unit/logger_spec.rb
|
417
418
|
- spec/unit/match_elements/button_spec.rb
|
418
419
|
- spec/unit/match_elements/element_spec.rb
|
419
420
|
- spec/unit/match_elements/text_field_spec.rb
|
@@ -618,12 +619,10 @@ signing_key:
|
|
618
619
|
specification_version: 4
|
619
620
|
summary: Watir powered by Selenium
|
620
621
|
test_files:
|
621
|
-
- spec/implementation_spec.rb
|
622
622
|
- spec/locator_spec_helper.rb
|
623
623
|
- spec/spec_helper.rb
|
624
624
|
- spec/unit/capabilities_spec.rb
|
625
625
|
- spec/unit/element_locator_spec.rb
|
626
|
-
- spec/unit/logger_spec.rb
|
627
626
|
- spec/unit/match_elements/button_spec.rb
|
628
627
|
- spec/unit/match_elements/element_spec.rb
|
629
628
|
- spec/unit/match_elements/text_field_spec.rb
|
data/spec/implementation_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'watirspec_helper'
|
2
|
-
|
3
|
-
describe WatirSpec::Implementation do
|
4
|
-
before { @impl = WatirSpec::Implementation.new }
|
5
|
-
|
6
|
-
it 'finds matching guards' do
|
7
|
-
guards = {
|
8
|
-
[:firefox] => [
|
9
|
-
{name: :not_compliant, data: {file: './spec/watirspec/div_spec.rb:108'}},
|
10
|
-
{name: :deviates, data: {file: './spec/watirspec/div_spec.rb:114'}},
|
11
|
-
{name: :not_compliant, data: {file: './spec/watirspec/div_spec.rb:200'}},
|
12
|
-
{name: :bug, data: {file: './spec/watirspec/div_spec.rb:228', key: 'WTR-350'}}
|
13
|
-
],
|
14
|
-
[:chrome] => [
|
15
|
-
{name: :not_compliant, data: {file: './spec/watirspec/div_spec.rb:109'}},
|
16
|
-
{name: :deviates, data: {file: './spec/watirspec/div_spec.rb:115'}},
|
17
|
-
{name: :not_compliant, data: {file: './spec/watirspec/div_spec.rb:201'}},
|
18
|
-
{name: :bug, data: {file: './spec/watirspec/div_spec.rb:229', key: 'WTR-349'}}
|
19
|
-
]
|
20
|
-
}
|
21
|
-
@impl.name = :firefox
|
22
|
-
expect(@impl.matching_guards_in(guards)).to eq(guards.first[1])
|
23
|
-
end
|
24
|
-
end
|
data/spec/unit/logger_spec.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require_relative 'unit_helper'
|
2
|
-
|
3
|
-
module Watir
|
4
|
-
describe Logger do
|
5
|
-
around do |example|
|
6
|
-
debug = $DEBUG
|
7
|
-
$DEBUG = false
|
8
|
-
example.call
|
9
|
-
$DEBUG = debug
|
10
|
-
Watir.instance_variable_set(:@logger, nil) # reset cache
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'logs warnings by default' do
|
14
|
-
expect(Watir.logger.level).to eq(2)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'logs everything if $DEBUG is set to true' do
|
18
|
-
$DEBUG = true
|
19
|
-
expect(Watir.logger.level).to eq(0)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'allows to change level during execution' do
|
23
|
-
Watir.logger.level = :info
|
24
|
-
expect(Watir.logger.level).to eq(1)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'allows to change level with integer' do
|
28
|
-
Watir.logger.level = 3
|
29
|
-
expect(Watir.logger.level).to eq(3)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'outputs to stdout by default' do
|
33
|
-
expect { Watir.logger.warn('message') }.to output(/WARN Watir message/).to_stdout_from_any_process
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'allows to output to file' do
|
37
|
-
Watir.logger.output = 'test.log'
|
38
|
-
Watir.logger.warn('message')
|
39
|
-
expect(File.read('test.log')).to include('WARN Watir message')
|
40
|
-
ensure
|
41
|
-
File.delete('test.log')
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'allows to deprecate functionality' do
|
45
|
-
message = /WARN Watir \[DEPRECATION\] #old is deprecated\. Use #new instead\./
|
46
|
-
expect { Watir.logger.deprecate('#old', '#new') }.to output(message).to_stdout_from_any_process
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'allows to selectively ignore deprecations with Strings' do
|
50
|
-
Watir.logger.ignore('old deprecated')
|
51
|
-
expect { Watir.logger.deprecate('#old', '#new', ids: ['old deprecated']) }
|
52
|
-
.to_not output.to_stdout_from_any_process
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'allows to selectively ignore deprecations with Symbols' do
|
56
|
-
Watir.logger.ignore(:foo)
|
57
|
-
expect { Watir.logger.deprecate('#old', '#new', ids: [:foo]) }.to_not output.to_stdout_from_any_process
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'allows to selectively ignore warnings with Strings' do
|
61
|
-
Watir.logger.ignore(:foo)
|
62
|
-
expect { Watir.logger.warn('warning', ids: ['foo']) }.to_not output.to_stdout_from_any_process
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'allows to selectively ignore warnings with Symbols' do
|
66
|
-
Watir.logger.ignore(:foo)
|
67
|
-
expect { Watir.logger.warn('warning', ids: [:foo]) }.to_not output.to_stdout_from_any_process
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'allows to ignore all deprecation notices' do
|
71
|
-
Watir.logger.ignore(:deprecations)
|
72
|
-
expect { Watir.logger.deprecate('#old', '#new') }.to_not output.to_stdout_from_any_process
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'allows to ignore multiple ids' do
|
76
|
-
Watir.logger.ignore(%i[foo bar])
|
77
|
-
expect { Watir.logger.warn('warning', ids: [:foo]) }.to_not output.to_stdout_from_any_process
|
78
|
-
expect { Watir.logger.warn('warning', ids: [:bar]) }.to_not output.to_stdout_from_any_process
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|