watir 6.6.1 → 6.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/watir/browser.rb +1 -1
- data/lib/watir/capabilities.rb +7 -7
- data/lib/watirspec/implementation.rb +5 -3
- data/spec/watirspec/after_hooks_spec.rb +15 -9
- data/spec/watirspec/elements/filefield_spec.rb +18 -14
- data/spec/watirspec/elements/option_spec.rb +19 -21
- data/spec/watirspec/elements/tr_spec.rb +1 -1
- data/spec/watirspec/window_switching_spec.rb +22 -26
- data/spec/watirspec_helper.rb +8 -1
- data/watir.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f821e322222ce615fe8e9c02b6a5fcbf783c22e8
|
4
|
+
data.tar.gz: b822b4d6fb0de96a76ffcb7c61f33640ef24c724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 933376823cd73c75e48a570972058dc32653ea54460fff9683073b42a19f242270f2eb6917bc108a9e8ddf84deabb390df6fb6e626f31b6fae55d4544e1da563
|
7
|
+
data.tar.gz: 8132f6f936389fa572d981581c4c8ab893ea76e796a042d1ee32c6516a58241df2c4091d3c795b0ec6eeb36ec0e8d69c17d61b9beae598eb1e1feec055ac0238
|
data/CHANGES.md
CHANGED
data/lib/watir/browser.rb
CHANGED
@@ -61,7 +61,7 @@ module Watir
|
|
61
61
|
'#<%s:0x%x url=%s title=%s>' % [self.class, hash*2, url.inspect, title.inspect]
|
62
62
|
rescue Errno::ECONNREFUSED
|
63
63
|
'#<%s:0x%x closed=true>' % [self.class, hash*2]
|
64
|
-
rescue Selenium::WebDriver::Error::UnhandledAlertError
|
64
|
+
rescue Selenium::WebDriver::Error::UnhandledAlertError, Selenium::WebDriver::Error::UnexpectedAlertOpenError
|
65
65
|
'#<%s:0x%x alert=true>' % [self.class, hash*2]
|
66
66
|
end
|
67
67
|
alias selector_string inspect
|
data/lib/watir/capabilities.rb
CHANGED
@@ -7,7 +7,7 @@ module Watir
|
|
7
7
|
@browser = browser == :remote ? @options.delete(:browser).to_sym : browser.to_sym
|
8
8
|
@selenium_browser = browser == :remote || options[:url] ? :remote : browser
|
9
9
|
|
10
|
-
@options = options
|
10
|
+
@options = options.dup
|
11
11
|
@selenium_opts = {}
|
12
12
|
end
|
13
13
|
|
@@ -58,12 +58,12 @@ module Watir
|
|
58
58
|
when :chrome
|
59
59
|
if @options.key?(:args)
|
60
60
|
browser_options ||= {}
|
61
|
-
browser_options[:args] = @options.delete(:args)
|
61
|
+
browser_options[:args] = @options.delete(:args).dup
|
62
62
|
end
|
63
63
|
if @options.delete(:headless)
|
64
64
|
browser_options ||= {}
|
65
|
-
browser_options[:args]
|
66
|
-
browser_options[:args]
|
65
|
+
browser_options[:args] ||= []
|
66
|
+
browser_options[:args] += ['--headless', '--disable-gpu']
|
67
67
|
end
|
68
68
|
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
|
69
69
|
@selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options) if browser_options
|
@@ -71,11 +71,11 @@ module Watir
|
|
71
71
|
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Firefox::Options
|
72
72
|
@selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(options) if browser_options
|
73
73
|
when :safari
|
74
|
-
@selenium_opts["safari.options"] = {'technologyPreview' => true} if @options
|
74
|
+
@selenium_opts["safari.options"] = {'technologyPreview' => true} if @options.delete(:technology_preview)
|
75
75
|
when :remote
|
76
76
|
if @browser == :chrome && @options.delete(:headless)
|
77
|
-
@options.delete(:args)
|
78
|
-
@options['chromeOptions'] = {'args' => ['--headless', '--disable-gpu']}
|
77
|
+
args = @options.delete(:args) || []
|
78
|
+
@options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -10,7 +10,8 @@ module WatirSpec
|
|
10
10
|
|
11
11
|
def initialize_copy(orig)
|
12
12
|
super
|
13
|
-
|
13
|
+
# Backward compatibility < Ruby 2.4
|
14
|
+
@browser_args = browser_args.map { |arg| arg.is_a?(Symbol) ? arg : arg.dup }
|
14
15
|
end
|
15
16
|
|
16
17
|
def browser_class
|
@@ -37,9 +38,10 @@ module WatirSpec
|
|
37
38
|
def inspect_args
|
38
39
|
hash = browser_args.last
|
39
40
|
desired_capabilities = hash.delete(:desired_capabilities)
|
40
|
-
|
41
|
-
string = "\tdriver: #{browser_args.first}\n"
|
41
|
+
string = ''
|
42
42
|
hash.each { |arg| string << "#{arg.inspect}\n" }
|
43
|
+
return "#{string} default capabilities" unless desired_capabilities
|
44
|
+
|
43
45
|
string << "\tcapabilities:\n"
|
44
46
|
caps.each { |k, v| string << "\t\t#{k}: #{v}\n"}
|
45
47
|
hash[:desired_capabilities] = desired_capabilities
|
@@ -80,7 +80,7 @@ describe "Browser::AfterHooks" do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
bug "
|
83
|
+
bug "MoveTargetOutOfBoundsError", :firefox do
|
84
84
|
it "runs after_hooks after Element#double_click" do
|
85
85
|
browser.goto(WatirSpec.url_for("non_control_elements.html"))
|
86
86
|
@page_after_hook = Proc.new { @yield = browser.title == "Non-control elements" }
|
@@ -124,16 +124,22 @@ describe "Browser::AfterHooks" do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
127
|
+
not_compliant_on :safari, :headless do
|
128
|
+
it "raises UnhandledAlertError error when running error checks with alert present" do
|
129
|
+
url = WatirSpec.url_for("alerts.html")
|
130
|
+
@page_after_hook = Proc.new { browser.url }
|
131
|
+
browser.after_hooks.add @page_after_hook
|
132
|
+
browser.goto url
|
133
|
+
|
134
|
+
not_compliant_on %i(local firefox) do
|
134
135
|
expect { browser.button(id: "alert").click }.to raise_error(Selenium::WebDriver::Error::UnhandledAlertError)
|
135
|
-
browser.alert.ok
|
136
136
|
end
|
137
|
+
|
138
|
+
deviates_on %i(local firefox) do
|
139
|
+
expect { browser.button(id: "alert").click }.to raise_error(Selenium::WebDriver::Error::UnexpectedAlertOpenError)
|
140
|
+
end
|
141
|
+
|
142
|
+
browser.alert.ok
|
137
143
|
end
|
138
144
|
end
|
139
145
|
|
@@ -109,18 +109,20 @@ describe "FileField" do
|
|
109
109
|
|
110
110
|
describe "#set" do
|
111
111
|
not_compliant_on :safari do
|
112
|
-
|
113
|
-
|
112
|
+
bug "https://github.com/mozilla/geckodriver/issues/858", :firefox do
|
113
|
+
it "is able to set a file path in the field and click the upload button and fire the onchange event" do
|
114
|
+
browser.goto WatirSpec.url_for("forms_with_input_elements.html")
|
114
115
|
|
115
|
-
|
116
|
-
|
116
|
+
path = File.expand_path(__FILE__)
|
117
|
+
element = browser.file_field(name: "new_user_portrait")
|
117
118
|
|
118
|
-
|
119
|
+
element.set path
|
119
120
|
|
120
|
-
|
121
|
-
|
121
|
+
expect(element.value).to include(File.basename(path)) # only some browser will return the full path
|
122
|
+
expect(messages.first).to include(File.basename(path))
|
122
123
|
|
123
|
-
|
124
|
+
browser.button(name: "new_user_submit").click
|
125
|
+
end
|
124
126
|
end
|
125
127
|
|
126
128
|
it "raises an error if the file does not exist" do
|
@@ -133,14 +135,16 @@ describe "FileField" do
|
|
133
135
|
|
134
136
|
not_compliant_on :safari do
|
135
137
|
describe "#value=" do
|
136
|
-
|
137
|
-
|
138
|
+
bug "https://github.com/mozilla/geckodriver/issues/858", :firefox do
|
139
|
+
it "is able to set a file path in the field and click the upload button and fire the onchange event" do
|
140
|
+
browser.goto WatirSpec.url_for("forms_with_input_elements.html")
|
138
141
|
|
139
|
-
|
140
|
-
|
142
|
+
path = File.expand_path(__FILE__)
|
143
|
+
element = browser.file_field(name: "new_user_portrait")
|
141
144
|
|
142
|
-
|
143
|
-
|
145
|
+
element.value = path
|
146
|
+
expect(element.value).to include(File.basename(path)) # only some browser will return the full path
|
147
|
+
end
|
144
148
|
end
|
145
149
|
|
146
150
|
not_compliant_on :internet_explorer do
|
@@ -71,28 +71,26 @@ describe "Option" do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
describe "#select" do
|
75
75
|
not_compliant_on :safari do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
expect(browser.select_list(name: 'new_user_country').option(text: 'Sweden')).to be_selected
|
95
|
-
end
|
76
|
+
it "selects the chosen option (page context)" do
|
77
|
+
browser.option(text: "Denmark").select
|
78
|
+
expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
|
79
|
+
end
|
80
|
+
|
81
|
+
it "selects the chosen option (select_list context)" do
|
82
|
+
browser.select_list(name: "new_user_country").option(text: "Denmark").select
|
83
|
+
expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
|
84
|
+
end
|
85
|
+
|
86
|
+
it "selects the option when found by text (page context)" do
|
87
|
+
browser.option(text: 'Sweden').select
|
88
|
+
expect(browser.option(text: 'Sweden')).to be_selected
|
89
|
+
end
|
90
|
+
|
91
|
+
it "selects the option when found by text (select_list context)" do
|
92
|
+
browser.select_list(name: 'new_user_country').option(text: 'Sweden').select
|
93
|
+
expect(browser.select_list(name: 'new_user_country').option(text: 'Sweden')).to be_selected
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
@@ -35,7 +35,7 @@ describe "TableRow" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "#click" do
|
38
|
-
|
38
|
+
not_compliant_on :internet_explorer, :chrome, :firefox do
|
39
39
|
it "fires the row's onclick event" do
|
40
40
|
browser.tr(id: 'inner_first').click
|
41
41
|
expect(messages).to include('tr')
|
@@ -364,19 +364,17 @@ describe "Window" do
|
|
364
364
|
end
|
365
365
|
|
366
366
|
not_compliant_on :headless do
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
)
|
367
|
+
it "should resize the window" do
|
368
|
+
initial_size = browser.window.size
|
369
|
+
browser.window.resize_to(
|
370
|
+
initial_size.width - 20,
|
371
|
+
initial_size.height - 20
|
372
|
+
)
|
374
373
|
|
375
|
-
|
374
|
+
new_size = browser.window.size
|
376
375
|
|
377
|
-
|
378
|
-
|
379
|
-
end
|
376
|
+
expect(new_size.width).to eq initial_size.width - 20
|
377
|
+
expect(new_size.height).to eq initial_size.height - 20
|
380
378
|
end
|
381
379
|
end
|
382
380
|
|
@@ -397,21 +395,19 @@ describe "Window" do
|
|
397
395
|
|
398
396
|
not_compliant_on :headless do
|
399
397
|
compliant_on :window_manager do
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
expect(new_size.height).to be > (initial_size.height - 20)
|
414
|
-
end
|
398
|
+
it "should maximize the window" do
|
399
|
+
initial_size = browser.window.size
|
400
|
+
browser.window.resize_to(
|
401
|
+
initial_size.width,
|
402
|
+
initial_size.height - 20
|
403
|
+
)
|
404
|
+
|
405
|
+
browser.window.maximize
|
406
|
+
browser.wait_until { browser.window.size != initial_size }
|
407
|
+
|
408
|
+
new_size = browser.window.size
|
409
|
+
expect(new_size.width).to be >= initial_size.width
|
410
|
+
expect(new_size.height).to be > (initial_size.height - 20)
|
415
411
|
end
|
416
412
|
end
|
417
413
|
end
|
data/spec/watirspec_helper.rb
CHANGED
@@ -54,6 +54,13 @@ class LocalConfig
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def add_guards
|
57
|
+
matching_guards = common_guards
|
58
|
+
matching_guards << :local
|
59
|
+
matching_guards << [:local, browser]
|
60
|
+
matching_guards
|
61
|
+
end
|
62
|
+
|
63
|
+
def common_guards
|
57
64
|
matching_guards = [:webdriver]
|
58
65
|
|
59
66
|
matching_guards << browser
|
@@ -121,7 +128,7 @@ class RemoteConfig < LocalConfig
|
|
121
128
|
private
|
122
129
|
|
123
130
|
def add_guards
|
124
|
-
matching_guards =
|
131
|
+
matching_guards = common_guards
|
125
132
|
matching_guards << :remote
|
126
133
|
matching_guards << [:remote, browser]
|
127
134
|
matching_guards
|
data/watir.gemspec
CHANGED
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.6.
|
4
|
+
version: 6.6.2
|
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: 2017-08-
|
12
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|