watir 7.0.0.beta2 → 7.0.0
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/chrome.yml +34 -0
- data/.github/workflows/edge.yml +28 -0
- data/.github/workflows/firefox.yml +35 -0
- data/.github/workflows/ie.yml +24 -0
- data/.github/workflows/safari.yml +27 -0
- data/.github/workflows/unit.yml +52 -0
- data/.rubocop.yml +1 -1
- data/CHANGES.md +23 -0
- data/lib/watir/attribute_helper.rb +1 -1
- data/lib/watir/browser.rb +3 -3
- data/lib/watir/capabilities.rb +51 -6
- data/lib/watir/elements/date_field.rb +4 -1
- data/lib/watir/elements/date_time_field.rb +4 -1
- data/lib/watir/elements/table.rb +1 -1
- data/lib/watir/locators/element/selector_builder/xpath.rb +3 -2
- data/lib/watir/version.rb +1 -1
- data/lib/watir/window.rb +22 -0
- data/lib/watirspec/remote_server.rb +2 -6
- data/spec/unit/capabilities_spec.rb +197 -47
- data/spec/watirspec/elements/date_field_spec.rb +3 -3
- data/spec/watirspec/elements/date_time_field_spec.rb +3 -6
- data/spec/watirspec/support/rspec_matchers.rb +1 -1
- data/spec/watirspec/window_switching_spec.rb +40 -14
- data/spec/watirspec_helper.rb +3 -0
- data/watir.gemspec +3 -3
- metadata +21 -16
- data/.github/workflows/tests.yml +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaa0e3a2614b0cdae93ebbae36c1f1c4ae58f55fd7d79a1b333144969354346f
|
4
|
+
data.tar.gz: 349abd59394dcd77d9f4aaf2050ab75dd613872c7aff3de96f8acc13cd797213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2abac0e5c8e81acf27b5edefd507c9056bca728f2ccab2aa858176287cf7e544a6961ab7bcc0edf7a01d78735038fedf77cbb70798aacdd490be4fc987f88602
|
7
|
+
data.tar.gz: a32076a9af54abfbcc470bb96095aa1441f812640029fa492233f7d7cbc5f9fb327de0397417103519cf674e7c03a91de85b749bf87e6cc8483cbf16bcefa3e7
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Chrome Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
local-tests:
|
9
|
+
name: Local Tests
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
15
|
+
ruby: [ 2.6, 3.0 ]
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: ./.github/actions/setup-linux
|
19
|
+
if: matrix.os == 'ubuntu-latest'
|
20
|
+
- uses: ./.github/actions/install-chrome
|
21
|
+
if: matrix.os == 'ubuntu-latest'
|
22
|
+
- run: |
|
23
|
+
echo "COVERAGE=true" >> $GITHUB_ENV
|
24
|
+
if: |
|
25
|
+
matrix.os == 'ubuntu-latest' ||
|
26
|
+
matrix.os == 'macos-latest'
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
- run: bundle install
|
31
|
+
- run: |
|
32
|
+
bundle exec rake spec:chrome
|
33
|
+
env:
|
34
|
+
DISPLAY: :99
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Edge Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
local-tests:
|
9
|
+
name: Local Tests
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os: [macos-latest, windows-latest]
|
15
|
+
ruby: [ 2.6, 3.0 ]
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- run: |
|
19
|
+
echo "COVERAGE=true" >> $GITHUB_ENV
|
20
|
+
if: matrix.os == 'macos-latest'
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
- run: bundle install
|
25
|
+
- run: |
|
26
|
+
bundle exec rake spec:edge
|
27
|
+
env:
|
28
|
+
DISPLAY: :99
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Firefox Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
local-tests:
|
9
|
+
name: Local Tests
|
10
|
+
runs-on: ${{ matrix.os }}
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
15
|
+
ruby: [ 2.6, 3.0 ]
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: ./.github/actions/setup-linux
|
19
|
+
if: matrix.os == 'ubuntu-latest'
|
20
|
+
- uses: browser-actions/setup-firefox@latest
|
21
|
+
with:
|
22
|
+
firefox-version: '93.0'
|
23
|
+
- run: |
|
24
|
+
echo "COVERAGE=true" >> $GITHUB_ENV
|
25
|
+
if: |
|
26
|
+
matrix.os == 'ubuntu-latest' ||
|
27
|
+
matrix.os == 'macos-latest'
|
28
|
+
- uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: ${{ matrix.ruby }}
|
31
|
+
- run: bundle install
|
32
|
+
- run: |
|
33
|
+
bundle exec rake spec:firefox
|
34
|
+
env:
|
35
|
+
DISPLAY: :99
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: IE Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
local-tests:
|
9
|
+
name: Local Tests
|
10
|
+
runs-on: windows-latest
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby: [ 2.6, 3.0 ]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
- run: bundle install
|
21
|
+
- run: |
|
22
|
+
bundle exec rake spec:ie
|
23
|
+
env:
|
24
|
+
DISPLAY: :99
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Safari Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
local-tests:
|
9
|
+
name: Local Tests
|
10
|
+
runs-on: macos-latest
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby: [ 2.6, 3.0 ]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ./.github/actions/enable-safari
|
18
|
+
- run: |
|
19
|
+
echo "COVERAGE=true" >> $GITHUB_ENV
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- run: bundle install
|
24
|
+
- run: |
|
25
|
+
bundle exec rake spec:safari
|
26
|
+
env:
|
27
|
+
DISPLAY: :99
|
@@ -0,0 +1,52 @@
|
|
1
|
+
name: Unit Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
- push
|
5
|
+
- pull_request
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
documentation-test:
|
9
|
+
name: Yard Doctest
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6
|
16
|
+
- run: bundle install
|
17
|
+
- uses: ./.github/actions/install-chrome
|
18
|
+
- uses: ./.github/actions/setup-linux
|
19
|
+
- run: |
|
20
|
+
bundle exec rake yard:doctest
|
21
|
+
|
22
|
+
|
23
|
+
unit-test:
|
24
|
+
name: Unit Tests
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
strategy:
|
27
|
+
fail-fast: false
|
28
|
+
matrix:
|
29
|
+
ruby: ['2.6', '2.7', '3.0']
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
- run: bundle install
|
36
|
+
- uses: ./.github/actions/install-chrome
|
37
|
+
- uses: ./.github/actions/setup-linux
|
38
|
+
- run: |
|
39
|
+
bundle exec rake spec:unit
|
40
|
+
env:
|
41
|
+
DISPLAY: :99
|
42
|
+
|
43
|
+
linter-test:
|
44
|
+
name: Rubocop Tests
|
45
|
+
runs-on: ubuntu-latest
|
46
|
+
steps:
|
47
|
+
- uses: actions/checkout@v2
|
48
|
+
- uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
ruby-version: 2.6
|
51
|
+
- run: bundle install
|
52
|
+
- run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
### 7.0.0 (2021-10-18)
|
2
|
+
|
3
|
+
* Requires Selenium 4.0.0+
|
4
|
+
* Requires Ruby 2.6+
|
5
|
+
* Implement `Window#minimize`
|
6
|
+
* Implement `Window#full_screen`
|
7
|
+
|
8
|
+
### 7.0.0.beta5 (2021-08-02)
|
9
|
+
|
10
|
+
* Add support for passing in Proxy and proxy Hash to Capabilities (#933)
|
11
|
+
* Trigger change event when setting values on date and date-time fields (#938)
|
12
|
+
* Allow user to obtain Capabilities instance from Browser instance
|
13
|
+
|
14
|
+
### 7.0.0.beta4 (2021-05-29)
|
15
|
+
|
16
|
+
* Fix Bug in using negative class names within a collection (#934)
|
17
|
+
|
18
|
+
### 7.0.0.beta3 (2021-05-05)
|
19
|
+
|
20
|
+
* Fix Bug preventing proper use of vendor extension capabilities
|
21
|
+
* Changed how timeouts are supported in Watir Capabilities (#932)
|
22
|
+
* Changed the default Alert Behavior not to automatically get dismissed when an exception happens (#931)
|
23
|
+
|
1
24
|
### 7.0.0.beta2 (2021-03-28)
|
2
25
|
|
3
26
|
* Replace Watir Logger implementation with Selenium Logger subclass
|
data/lib/watir/browser.rb
CHANGED
@@ -12,7 +12,7 @@ module Watir
|
|
12
12
|
include Scrolling
|
13
13
|
|
14
14
|
attr_writer :default_context, :original_window, :locator_namespace, :timer
|
15
|
-
attr_reader :driver, :after_hooks
|
15
|
+
attr_reader :driver, :after_hooks, :capabilities
|
16
16
|
alias wd driver # ensures duck typing with Watir::Element
|
17
17
|
|
18
18
|
class << self
|
@@ -42,8 +42,8 @@ module Watir
|
|
42
42
|
def initialize(browser = :chrome, *args)
|
43
43
|
case browser
|
44
44
|
when ::Symbol, String
|
45
|
-
|
46
|
-
@driver = Selenium::WebDriver.for(
|
45
|
+
@capabilities = Capabilities.new(browser, *args)
|
46
|
+
@driver = Selenium::WebDriver.for(*@capabilities.to_args)
|
47
47
|
when Selenium::WebDriver::Driver
|
48
48
|
@driver = browser
|
49
49
|
else
|
data/lib/watir/capabilities.rb
CHANGED
@@ -63,15 +63,60 @@ module Watir
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def process_browser_options
|
66
|
-
browser_options = @options.delete(:options) || {}
|
67
|
-
|
68
|
-
|
69
|
-
options
|
70
|
-
|
66
|
+
browser_options = @options.delete(:options).dup || {}
|
67
|
+
vendor_caps = process_vendor_capabilities(browser_options)
|
68
|
+
|
69
|
+
options = if browser_options.is_a? Selenium::WebDriver::Options
|
70
|
+
browser_options
|
71
|
+
else
|
72
|
+
convert_timeouts(browser_options)
|
73
|
+
Selenium::WebDriver::Options.send(@browser, **browser_options)
|
74
|
+
end
|
75
|
+
|
76
|
+
options.unhandled_prompt_behavior ||= :ignore
|
77
|
+
process_proxy_options(options)
|
71
78
|
browser_specific_options(options)
|
72
79
|
raise ArgumentError, "#{@options} are unrecognized arguments for Browser constructor" unless @options.empty?
|
73
80
|
|
74
|
-
options
|
81
|
+
vendor_caps << options
|
82
|
+
end
|
83
|
+
|
84
|
+
def process_proxy_options(options)
|
85
|
+
proxy = @options.delete(:proxy)
|
86
|
+
return if proxy.nil?
|
87
|
+
|
88
|
+
proxy &&= Selenium::WebDriver::Proxy.new(proxy) if proxy.is_a?(Hash)
|
89
|
+
|
90
|
+
unless proxy.is_a?(Selenium::WebDriver::Proxy)
|
91
|
+
raise TypeError, "#{proxy} needs to be Selenium Proxy or Hash instance"
|
92
|
+
end
|
93
|
+
|
94
|
+
options.proxy = proxy
|
95
|
+
end
|
96
|
+
|
97
|
+
def process_vendor_capabilities(opts)
|
98
|
+
return [] unless opts.is_a? Hash
|
99
|
+
|
100
|
+
vendor = opts.select { |key, _val| key.to_s.include?(':') && opts.delete(key) }
|
101
|
+
vendor.map { |k, v| Selenium::WebDriver::Remote::Capabilities.new(k => v) }
|
102
|
+
end
|
103
|
+
|
104
|
+
def convert_timeouts(browser_options)
|
105
|
+
browser_options[:timeouts] ||= {}
|
106
|
+
browser_options[:timeouts].keys.each do |key|
|
107
|
+
raise(ArgumentError, 'do not set implicit wait, Watir handles waiting automatically') if key.to_s == 'implicit'
|
108
|
+
|
109
|
+
Watir.logger.deprecate('using timeouts directly in options',
|
110
|
+
":#{key}_timeout",
|
111
|
+
id: 'timeouts')
|
112
|
+
end
|
113
|
+
if browser_options.key?(:page_load_timeout)
|
114
|
+
browser_options[:timeouts][:page_load] = browser_options.delete(:page_load_timeout) * 1000
|
115
|
+
end
|
116
|
+
|
117
|
+
return unless browser_options.key?(:script_timeout)
|
118
|
+
|
119
|
+
browser_options[:timeouts][:script] = browser_options.delete(:script_timeout) * 1000
|
75
120
|
end
|
76
121
|
|
77
122
|
def browser_specific_options(options)
|
@@ -11,7 +11,10 @@ module Watir
|
|
11
11
|
raise ArgumentError, message unless [Date, ::Time].include?(date.class)
|
12
12
|
|
13
13
|
date_string = date.strftime('%Y-%m-%d')
|
14
|
-
element_call(:wait_for_writable)
|
14
|
+
element_call(:wait_for_writable) do
|
15
|
+
execute_js(:setValue, @element, date_string)
|
16
|
+
execute_js(:fireEvent, @element, :change)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
alias set set!
|
17
20
|
alias value= set
|
@@ -11,7 +11,10 @@ module Watir
|
|
11
11
|
raise ArgumentError, message unless [DateTime, ::Time].include?(date.class)
|
12
12
|
|
13
13
|
date_time_string = date.strftime('%Y-%m-%dT%H:%M')
|
14
|
-
element_call(:wait_for_writable)
|
14
|
+
element_call(:wait_for_writable) do
|
15
|
+
execute_js(:setValue, @element, date_time_string)
|
16
|
+
execute_js(:fireEvent, @element, :change)
|
17
|
+
end
|
15
18
|
end
|
16
19
|
alias set set!
|
17
20
|
alias value= set
|
data/lib/watir/elements/table.rb
CHANGED
@@ -29,7 +29,7 @@ module Watir
|
|
29
29
|
all_rows = rows.locate
|
30
30
|
header_row = all_rows.first || raise(Error, 'no rows in table')
|
31
31
|
|
32
|
-
all_rows.entries[1
|
32
|
+
all_rows.entries[1..].map do |row|
|
33
33
|
cell_size_check(header_row, row)
|
34
34
|
Hash[headers(header_row).map(&:text).zip(row.cells.map(&:text))]
|
35
35
|
end
|
@@ -172,7 +172,7 @@ module Watir
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def starts_with?(results, regexp)
|
175
|
-
regexp.source[0] == '^' && results.first == regexp.source[1
|
175
|
+
regexp.source[0] == '^' && results.first == regexp.source[1..]
|
176
176
|
end
|
177
177
|
|
178
178
|
def add_to_matching(key, regexp, results = nil)
|
@@ -218,7 +218,8 @@ module Watir
|
|
218
218
|
|
219
219
|
def equal_pair(key, value)
|
220
220
|
if key == :class
|
221
|
-
negate_xpath = value =~ /^!/
|
221
|
+
negate_xpath = value =~ /^!/
|
222
|
+
value = value[1..] if negate_xpath
|
222
223
|
expression = "contains(concat(' ', @class, ' '), #{XpathSupport.escape " #{value} "})"
|
223
224
|
|
224
225
|
negate_xpath ? "not(#{expression})" : expression
|
data/lib/watir/version.rb
CHANGED
data/lib/watir/window.rb
CHANGED
@@ -92,6 +92,28 @@ module Watir
|
|
92
92
|
use { @driver.manage.window.maximize }
|
93
93
|
end
|
94
94
|
|
95
|
+
#
|
96
|
+
# Minimize window.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# browser.window.minimize
|
100
|
+
#
|
101
|
+
|
102
|
+
def minimize
|
103
|
+
use { @driver.manage.window.minimize }
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Make window full screen.
|
108
|
+
#
|
109
|
+
# @example
|
110
|
+
# browser.window.full_screen
|
111
|
+
#
|
112
|
+
|
113
|
+
def full_screen
|
114
|
+
use { @driver.manage.window.full_screen }
|
115
|
+
end
|
116
|
+
|
95
117
|
#
|
96
118
|
# Returns true if window exists.
|
97
119
|
#
|
@@ -20,14 +20,10 @@ module WatirSpec
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def jar
|
23
|
-
if ENV['LOCAL_SELENIUM']
|
24
|
-
local = File.expand_path('../selenium/buck-out/gen/java/server/src/org/openqa/grid/selenium/selenium.jar')
|
25
|
-
end
|
26
|
-
|
27
23
|
if File.exist?(ENV['REMOTE_SERVER_BINARY'] || '')
|
28
24
|
ENV['REMOTE_SERVER_BINARY']
|
29
|
-
elsif ENV['LOCAL_SELENIUM']
|
30
|
-
|
25
|
+
elsif ENV['LOCAL_SELENIUM']
|
26
|
+
File.expand_path('../selenium/bazel-bin/java/server/src/org/openqa/selenium/grid/selenium_server_deploy.jar')
|
31
27
|
elsif !Dir.glob('*selenium*.jar').empty?
|
32
28
|
Dir.glob('*selenium*.jar').first
|
33
29
|
else
|