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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10cab1d1409ebe3bb8f7e249a6d3ee1a8b2523b1
4
- data.tar.gz: a0c781ce798236ee4b2d9c87a37825c05b6f55d9
3
+ metadata.gz: f821e322222ce615fe8e9c02b6a5fcbf783c22e8
4
+ data.tar.gz: b822b4d6fb0de96a76ffcb7c61f33640ef24c724
5
5
  SHA512:
6
- metadata.gz: d292a95a5839ccd31ae7f1696351af2e0e515faf2abcaa9cff723234b42cc9fa237b520be2ac152b09b70e31e2953f3ab61c5bee90cbccfaa1e94ced83f724d6
7
- data.tar.gz: 46a0338d87dc84aab77d24931664a4fe9578826f9211c0a898abe1bf2ff4ebfaa9a3f52478b55acaa5b80095e4788874703c7e4612185a542cd38192f615fa17
6
+ metadata.gz: 933376823cd73c75e48a570972058dc32653ea54460fff9683073b42a19f242270f2eb6917bc108a9e8ddf84deabb390df6fb6e626f31b6fae55d4544e1da563
7
+ data.tar.gz: 8132f6f936389fa572d981581c4c8ab893ea76e796a042d1ee32c6516a58241df2c4091d3c795b0ec6eeb36ec0e8d69c17d61b9beae598eb1e1feec055ac0238
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 6.6.2 (2017-08-08)
2
+
3
+ * Fix bug preventing headless operation (#611)
4
+
1
5
  ### 6.6.1 (2017-08-07)
2
6
 
3
7
  * Support initializing browser with Selenium Options class (#606)
@@ -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
@@ -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] << '--headless'
66
- browser_options[:args] << '--disable-gpu'
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[:technology_preview]
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
- @browser_args = Marshal.load( Marshal.dump(@browser_args))
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
- caps = desired_capabilities.send(:capabilities)
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 "Actions Endpoint Not Yet Implemented", :firefox do
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
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1279211", :firefox do
128
- not_compliant_on :safari, :headless do
129
- it "raises UnhandledAlertError error when running error checks with alert present" do
130
- url = WatirSpec.url_for("alerts.html")
131
- @page_after_hook = Proc.new { browser.url }
132
- browser.after_hooks.add @page_after_hook
133
- browser.goto url
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
- it "is able to set a file path in the field and click the upload button and fire the onchange event" do
113
- browser.goto WatirSpec.url_for("forms_with_input_elements.html")
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
- path = File.expand_path(__FILE__)
116
- element = browser.file_field(name: "new_user_portrait")
116
+ path = File.expand_path(__FILE__)
117
+ element = browser.file_field(name: "new_user_portrait")
117
118
 
118
- element.set path
119
+ element.set path
119
120
 
120
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
121
- expect(messages.first).to include(File.basename(path))
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
- browser.button(name: "new_user_submit").click
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
- it "is able to set a file path in the field and click the upload button and fire the onchange event" do
137
- browser.goto WatirSpec.url_for("forms_with_input_elements.html")
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
- path = File.expand_path(__FILE__)
140
- element = browser.file_field(name: "new_user_portrait")
142
+ path = File.expand_path(__FILE__)
143
+ element = browser.file_field(name: "new_user_portrait")
141
144
 
142
- element.value = path
143
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
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
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
74
+ describe "#select" do
75
75
  not_compliant_on :safari do
76
- describe "#select" do
77
- it "selects the chosen option (page context)" do
78
- browser.option(text: "Denmark").select
79
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
80
- end
81
-
82
- it "selects the chosen option (select_list context)" do
83
- browser.select_list(name: "new_user_country").option(text: "Denmark").select
84
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
85
- end
86
-
87
- it "selects the option when found by text (page context)" do
88
- browser.option(text: 'Sweden').select
89
- expect(browser.option(text: 'Sweden')).to be_selected
90
- end
91
-
92
- it "selects the option when found by text (select_list context)" do
93
- browser.select_list(name: 'new_user_country').option(text: 'Sweden').select
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
- bug "http://github.com/watir/watir/issues/issue/32", :internet_explorer, :chrome do
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
- bug "https://github.com/SeleniumHQ/selenium/issues/2856", %i(remote firefox) do
368
- it "should resize the window" do
369
- initial_size = browser.window.size
370
- browser.window.resize_to(
371
- initial_size.width - 20,
372
- initial_size.height - 20
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
- new_size = browser.window.size
374
+ new_size = browser.window.size
376
375
 
377
- expect(new_size.width).to eq initial_size.width - 20
378
- expect(new_size.height).to eq initial_size.height - 20
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
- bug "https://github.com/SeleniumHQ/selenium/issues/2856", :firefox do
401
- it "should maximize the window" do
402
- initial_size = browser.window.size
403
- browser.window.resize_to(
404
- initial_size.width,
405
- initial_size.height - 20
406
- )
407
-
408
- browser.window.maximize
409
- browser.wait_until { browser.window.size != initial_size }
410
-
411
- new_size = browser.window.size
412
- expect(new_size.width).to be >= initial_size.width
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
@@ -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 = super
131
+ matching_guards = common_guards
125
132
  matching_guards << :remote
126
133
  matching_guards << [:remote, browser]
127
134
  matching_guards
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.6.1'
5
+ s.version = '6.6.2'
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.6.1
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-07 00:00:00.000000000 Z
12
+ date: 2017-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver