watir 6.8.4 → 6.9.0

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: 8e27340a127131e5038ba637cb30c8c8e61e8d61
4
- data.tar.gz: 599c0f65d2a585dd3e299aaf41d632c9d74ebee9
3
+ metadata.gz: c07f7155e0844cc08be4fcdeda576a6c2748cbf8
4
+ data.tar.gz: aeb56b78fe7c0609e1449a34fff22ff3e8c8ecf3
5
5
  SHA512:
6
- metadata.gz: 5686c7a7d4ea2b16aa2edfe14a641bfa3eb5b31ef18a5ab1707b50689f55c71a366da7ef200b66b770d1f0f035746cfe47a92937d2020466f545fb67ff0c64ca
7
- data.tar.gz: 844b9f240d35c4dc558cfc345afcd26b2483dcb61e018c40e5a0080be0d421cfb8893b9ca611105d26e059941b9c1ae5610a5d304af5f5df34ddbb3e8d9b93b1
6
+ metadata.gz: 8a6fb8f40775476021d6b696dff03c2fc9fd634b3b667a97851e4035821f631b2a25d80771f0cfac337273fae47abeb354b7a939c0dbc5bce7761effcbb03429
7
+ data.tar.gz: ae1c29c9a9e296b8aad4d754e7d2d075b47ca5f8a2b5b581738539939cf9e0631e41feefbbc4c74222f77bcff0b67dd7b41936fc02c17127215d9d0d051e124e
data/CHANGES.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 6.9.0 (2017-11-18)
2
+
3
+ * Fix bug in Element#flash
4
+ * Fix bug with w3c alert handling (thanks Lakshya Kapoor)
5
+ * Add support for passing multiple options into #select and #select_all (thanks Justin Ko)
6
+ * Add support for passing multiple parameters into Element#set! (thanks Justin Ko)
7
+ * Add support for headless Firefox (thanks Lucas Tierney)
8
+ * Add support for setting cookie expiration by String (thanks Lucas Tierney)
9
+ * Add support for new class locators to #element and #elements (thanks Justin Ko)
10
+ * Provide suggestion to look inside IFrame when element not found (thanks Justin Ko)
11
+
1
12
  ### 6.8.4 (2017-09-08)
2
13
 
3
14
  * Fix bug with non-visible buttons not being waited on (#648)
data/README.md CHANGED
@@ -17,7 +17,7 @@ require 'watir'
17
17
  browser = Watir::Browser.new
18
18
 
19
19
  browser.goto 'watir.com'
20
- browser.link(text: 'Documentation').click
20
+ browser.link(text: 'documentation').click
21
21
 
22
22
  puts browser.title
23
23
  # => 'Documentation – Watir Project...'
@@ -96,7 +96,7 @@ module Watir
96
96
 
97
97
  def assert_exists
98
98
  @alert = @browser.driver.switch_to.alert
99
- rescue Selenium::WebDriver::Error::NoAlertPresentError
99
+ rescue Selenium::WebDriver::Error::NoAlertPresentError, Selenium::WebDriver::Error::NoSuchAlertError
100
100
  raise Exception::UnknownObjectException, 'unable to locate alert'
101
101
  end
102
102
 
@@ -83,6 +83,11 @@ module Watir
83
83
  @selenium_opts[:options] = browser_options
84
84
  Watir.logger.deprecate 'Initializing Browser with both :profile and :option', ':profile as a key inside :option' if profile
85
85
  end
86
+ if @options.delete(:headless)
87
+ browser_options ||= {}
88
+ browser_options[:args] ||= []
89
+ browser_options[:args] += ['--headless']
90
+ end
86
91
  @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
87
92
  @selenium_opts[:options].profile = profile if profile
88
93
  when :safari
@@ -92,6 +97,10 @@ module Watir
92
97
  args = @options.delete(:args) || @options.delete(:switches) || []
93
98
  @options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
94
99
  end
100
+ if @browser == :firefox && @options.delete(:headless)
101
+ args = @options.delete(:args) || @options.delete(:switches) || []
102
+ @options[Selenium::WebDriver::Firefox::Options.KEY] = {'args' => args + ['--headless']}
103
+ end
95
104
  if @browser == :safari && @options.delete(:technology_preview)
96
105
  @options["safari.options"] = {'technologyPreview' => true}
97
106
  end
@@ -59,7 +59,10 @@ module Watir
59
59
  value: value}
60
60
  cookie[:secure] = opts[:secure] if opts.key?(:secure)
61
61
  cookie[:path] = opts[:path] if opts.key?(:path)
62
- cookie[:expires] = opts[:expires] if opts.key?(:expires)
62
+ expires = opts[:expires]
63
+ if expires
64
+ cookie[:expires] = ::Time.parse(expires) if expires.is_a?(String) else expires
65
+ end
63
66
  cookie[:domain] = opts[:domain] if opts.key?(:domain)
64
67
 
65
68
  @control.add_cookie cookie
@@ -655,6 +655,10 @@ module Watir
655
655
  begin
656
656
  send exist_check
657
657
  yield
658
+ rescue unknown_exception => ex
659
+ msg = ex.message
660
+ msg += ". Maybe look in an iframe?" if @query_scope.iframes.count > 0
661
+ raise unknown_exception, msg
658
662
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
659
663
  retry
660
664
  rescue Selenium::WebDriver::Error::ElementNotVisibleError, Selenium::WebDriver::Error::ElementNotInteractableError
@@ -41,8 +41,9 @@ module Watir
41
41
  # @return [String] The text of the option selected. If multiple options match, returns the first match.
42
42
  #
43
43
 
44
- def select(str_or_rx)
45
- select_by str_or_rx
44
+ def select(*str_or_rx)
45
+ results = str_or_rx.flatten.map { |v| select_by v}
46
+ results.first
46
47
  end
47
48
 
48
49
  #
@@ -53,8 +54,9 @@ module Watir
53
54
  # @return [String] The text of the first option selected.
54
55
  #
55
56
 
56
- def select_all(str_or_rx)
57
- select_all_by str_or_rx
57
+ def select_all(*str_or_rx)
58
+ results = str_or_rx.flatten.map { |v| select_all_by v }
59
+ results.first
58
60
  end
59
61
 
60
62
  #
@@ -64,8 +66,9 @@ module Watir
64
66
  # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
65
67
  #
66
68
 
67
- def select!(str_or_rx)
68
- select_by!(str_or_rx, :single)
69
+ def select!(*str_or_rx)
70
+ results = str_or_rx.flatten.map { |v| select_by!(v, :single) }
71
+ results.first
69
72
  end
70
73
 
71
74
  #
@@ -75,8 +78,9 @@ module Watir
75
78
  # @raise [Watir::Exception::NoValueFoundException] if the value does not exist.
76
79
  #
77
80
 
78
- def select_all!(str_or_rx)
79
- select_by!(str_or_rx, :multiple)
81
+ def select_all!(*str_or_rx)
82
+ results = str_or_rx.flatten.map { |v| select_by!(v, :multiple) }
83
+ results.first
80
84
  end
81
85
 
82
86
  #
@@ -43,11 +43,13 @@ module Watir
43
43
  # @return [Watir::Element]
44
44
  #
45
45
 
46
- def flash(color: 'red', flashes: 10, delay: 0)
46
+ def flash(color: 'red', flashes: 5, delay: 0.2)
47
47
  background_color = style("backgroundColor")
48
+ background_color = 'white' if background_color.empty?
48
49
  element_color = element_call { execute_js(:backgroundColor, @element) }.strip
50
+ element_color = 'white' if element_color.empty?
49
51
 
50
- flashes.times do |n|
52
+ (flashes * 2).times do |n|
51
53
  nextcolor = n.even? ? color : background_color
52
54
  element_call { execute_js(:backgroundColor, @element, nextcolor) }
53
55
  sleep(delay)
@@ -79,7 +79,7 @@ module Watir
79
79
  how, what = @selector.to_a.first
80
80
  selector_builder.check_type(how, what)
81
81
 
82
- if WD_FINDERS.include?(how)
82
+ if wd_supported?(how, what)
83
83
  wd_find_first_by(how, what)
84
84
  else
85
85
  find_first_by_multiple
@@ -118,7 +118,7 @@ module Watir
118
118
  return [what] if how == :element
119
119
  selector_builder.check_type how, what
120
120
 
121
- if WD_FINDERS.include?(how)
121
+ if wd_supported?(how, what)
122
122
  wd_find_all_by(how, what)
123
123
  else
124
124
  find_all_by_multiple
@@ -270,6 +270,12 @@ module Watir
270
270
  scope.find_elements(how, what)
271
271
  end
272
272
 
273
+ def wd_supported?(how, what)
274
+ return false unless WD_FINDERS.include?(how)
275
+ return false unless what.kind_of?(String) || what.kind_of?(Regexp)
276
+ return false if [:class, :class_name].include?(how) && what.kind_of?(String) && what.include?(' ')
277
+ true
278
+ end
273
279
  end
274
280
  end
275
281
  end
@@ -22,7 +22,9 @@ module Watir
22
22
  # @param [String] input_value
23
23
  #
24
24
 
25
- def set!(input_value)
25
+ def set!(*args)
26
+ raise ArgumentError, "#set! does not support special keys, use #set instead" if args.any? { |v| v.kind_of?(::Symbol) }
27
+ input_value = args.join
26
28
  set input_value[0]
27
29
  element_call { execute_js(:setValue, @element, input_value[0..-2]) }
28
30
  append(input_value[-1])
@@ -8,8 +8,8 @@ module WatirSpec
8
8
  class << self
9
9
  attr_accessor :browser_args, :unguarded, :implementation
10
10
 
11
- def html
12
- @html ||= File.expand_path("../../spec/watirspec/html", __FILE__)
11
+ def htmls
12
+ @htmls ||= [File.expand_path("../../spec/watirspec/html", __FILE__)]
13
13
  end
14
14
 
15
15
  def run!
@@ -12,15 +12,15 @@ module WatirSpec
12
12
  when %r{/set_cookie}
13
13
  respond("<html>C is for cookie, it's good enough for me</html>", 'Content-Type' => 'text/html', 'Set-Cookie' => 'monster=1')
14
14
  when css_file?
15
- respond(File.read("#{WatirSpec.html}/#{path}"), 'Content-Type' => 'text/css')
15
+ respond(file_read(path), 'Content-Type' => 'text/css')
16
16
  when js_file?
17
- respond(File.read("#{WatirSpec.html}/#{path}"), 'Content-Type' => 'application/javascript')
17
+ respond(file_read(path), 'Content-Type' => 'application/javascript')
18
18
  when png_file?
19
- respond(File.binread("#{WatirSpec.html}/#{path}"), 'Content-Type' => 'image/png')
19
+ respond(file_binread(path), 'Content-Type' => 'image/png')
20
20
  when gif_file?
21
- respond(File.read("#{WatirSpec.html}/#{path}"), 'Content-Type' => 'image/gif')
21
+ respond(file_read(path), 'Content-Type' => 'image/gif')
22
22
  when static_file?
23
- respond(File.read("#{WatirSpec.html}/#{path}"))
23
+ respond(file_read(path))
24
24
  else
25
25
  respond('')
26
26
  end
@@ -33,30 +33,44 @@ module WatirSpec
33
33
  end
34
34
 
35
35
  def css_file?
36
- proc { |path| static_files.include?(path) && path.end_with?('.css') }
36
+ proc { |path| static_file(path) && path.end_with?('.css') }
37
37
  end
38
38
 
39
39
  def js_file?
40
- proc { |path| static_files.include?(path) && path.end_with?('.js') }
40
+ proc { |path| static_file(path) && path.end_with?('.js') }
41
41
  end
42
42
 
43
43
  def png_file?
44
- proc { |path| static_files.include?(path) && path.end_with?('.png') }
44
+ proc { |path| static_file(path) && path.end_with?('.png') }
45
45
  end
46
46
 
47
47
  def gif_file?
48
- proc { |path| static_files.include?(path) && path.end_with?('.gif') }
48
+ proc { |path| static_file(path) && path.end_with?('.gif') }
49
49
  end
50
50
 
51
51
  def static_file?
52
- proc { |path| static_files.include?(path) }
52
+ proc { |path| static_file(path) }
53
53
  end
54
54
 
55
55
  def static_files
56
- Dir["#{WatirSpec.html}/**/*"].map do |file|
57
- file.sub(WatirSpec.html, '')
56
+ WatirSpec.htmls.flat_map do |html|
57
+ Dir["#{html}/**/*"]
58
58
  end
59
59
  end
60
+
61
+ def static_file(path)
62
+ static_files.find do |file|
63
+ file.end_with?(path)
64
+ end
65
+ end
66
+
67
+ def file_read(path)
68
+ File.read(static_file(path))
69
+ end
70
+
71
+ def file_binread(path)
72
+ File.binread(static_file(path))
73
+ end
60
74
  end
61
75
  end
62
76
  end
@@ -59,6 +59,24 @@ describe Watir::Locators::Element::Locator do
59
59
 
60
60
  locate_one [:data_view, false]
61
61
  end
62
+
63
+ it "handles selector with class attribute presence" do
64
+ expect_one :xpath, ".//*[@class]"
65
+
66
+ locate_one class: true
67
+ end
68
+
69
+ it "handles selector with multiple classes in array" do
70
+ expect_one :xpath, ".//*[(contains(concat(' ', @class, ' '), ' a ') and contains(concat(' ', @class, ' '), ' b '))]"
71
+
72
+ locate_one class: ["a", "b"]
73
+ end
74
+
75
+ it "handles selector with multiple classes in string" do
76
+ expect_one :xpath, ".//*[contains(concat(' ', @class, ' '), ' a b ')]"
77
+
78
+ locate_one class: "a b"
79
+ end
62
80
  end
63
81
 
64
82
  describe "with special cased selectors" do
@@ -346,6 +364,24 @@ describe Watir::Locators::Element::Locator do
346
364
  :dir , "foo",
347
365
  :title , 'bar']
348
366
  end
367
+
368
+ it "handles selector with class attribute presence" do
369
+ expect_all :xpath, ".//*[@class]"
370
+
371
+ locate_all class: true
372
+ end
373
+
374
+ it "handles selector with multiple classes in array" do
375
+ expect_all :xpath, ".//*[(contains(concat(' ', @class, ' '), ' a ') and contains(concat(' ', @class, ' '), ' b '))]"
376
+
377
+ locate_all class: ["a", "b"]
378
+ end
379
+
380
+ it "handles selector with multiple classes in string" do
381
+ expect_all :xpath, ".//*[contains(concat(' ', @class, ' '), ' a b ')]"
382
+
383
+ locate_all class: "a b"
384
+ end
349
385
  end
350
386
 
351
387
  describe "with regexp selectors" do
@@ -92,13 +92,14 @@ describe Watir::Element do
92
92
  end
93
93
 
94
94
  describe "#hover" do
95
- not_compliant_on :internet_explorer, :safari, %i(remote firefox) do
95
+ not_compliant_on :internet_explorer, :safari do
96
96
  it "should hover over the element" do
97
97
  browser.goto WatirSpec.url_for('hover.html')
98
98
  link = browser.a
99
99
 
100
100
  expect(link.style("font-size")).to eq "10px"
101
101
  link.hover
102
+ link.wait_until { |l| l.style("font-size") == "20px" }
102
103
  expect(link.style("font-size")).to eq "20px"
103
104
  end
104
105
  end
@@ -49,6 +49,18 @@ describe "Browser#cookies" do
49
49
  browser.cookies.add 'foo', 'bar'
50
50
  verify_cookies_count 2
51
51
  end
52
+
53
+ it 'adds a cookie with a string expires value' do
54
+ browser.goto set_cookie_url
55
+ verify_cookies_count 1
56
+
57
+ expire_time = Time.now + 10000
58
+
59
+ browser.cookies.add 'foo', 'bar', {expires: expire_time.to_s}
60
+
61
+ cookie = browser.cookies[:foo]
62
+ expect(cookie[:expires]).to be_kind_of(Time)
63
+ end
52
64
  end
53
65
 
54
66
  # TODO - Split this up into multiple tests or figure out which parts are not compliant
@@ -112,18 +124,20 @@ describe "Browser#cookies" do
112
124
  end
113
125
  end
114
126
 
115
- describe '#load' do
116
- it 'loads cookies from file' do
117
- browser.cookies.clear
118
- browser.cookies.load file
119
- expected = browser.cookies.to_a
120
- actual = YAML.load(IO.read(file))
127
+ bug "https://github.com/mozilla/geckodriver/issues/1000", :firefox do
128
+ describe '#load' do
129
+ it 'loads cookies from file' do
130
+ browser.cookies.clear
131
+ browser.cookies.load file
132
+ expected = browser.cookies.to_a
133
+ actual = YAML.load(IO.read(file))
121
134
 
122
- # https://code.google.com/p/selenium/issues/detail?id=6834
123
- expected.each { |cookie| cookie.delete(:expires) }
124
- actual.each { |cookie| cookie.delete(:expires) }
135
+ # https://code.google.com/p/selenium/issues/detail?id=6834
136
+ expected.each { |cookie| cookie.delete(:expires) }
137
+ actual.each { |cookie| cookie.delete(:expires) }
125
138
 
126
- expect(actual).to eq(expected)
139
+ expect(actual).to eq(expected)
140
+ end
127
141
  end
128
142
  end
129
143
  end
@@ -308,6 +308,11 @@ describe "Element" do
308
308
  it "raises ArgumentError error if selector hash with :css has multiple entries" do
309
309
  expect { browser.div(css: "div", class: "foo").exists? }.to raise_error(ArgumentError)
310
310
  end
311
+
312
+ it "finds element by Selenium name locator" do
313
+ expect(browser.element(name: "new_user_first_name")).to exist
314
+ expect(browser.element(name: /new_user_first_name/)).to exist
315
+ end
311
316
  end
312
317
 
313
318
  describe '#send_keys' do
@@ -151,6 +151,10 @@ describe "IFrame" do
151
151
  expect(browser.iframe(index: 0).text_field(name: 'senderElement').value).to eq "new value"
152
152
  end
153
153
 
154
+ it 'will suggest looking in an iframe when iframes exist' do
155
+ expect {browser.text_field(name: 'senderElement').set('no') }.to raise_unknown_object_exception('Maybe look in an iframe?')
156
+ end
157
+
154
158
  describe "#execute_script" do
155
159
  bug "Safari does not strip text", :safari do
156
160
  it "executes the given javascript in the specified frame" do
@@ -303,6 +303,18 @@ describe "SelectList" do
303
303
  expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
304
304
  end
305
305
 
306
+ it "selects each item in an Array" do
307
+ browser.select_list(name: "new_user_languages").clear
308
+ browser.select_list(name: "new_user_languages").select(["Danish", "Swedish"])
309
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
310
+ end
311
+
312
+ it "selects each item in a parameter list" do
313
+ browser.select_list(name: "new_user_languages").clear
314
+ browser.select_list(name: "new_user_languages").select("Danish", "Swedish")
315
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
316
+ end
317
+
306
318
  bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
307
319
  it "selects empty options" do
308
320
  browser.select_list(id: "delete_user_username").select("")
@@ -364,7 +376,7 @@ describe "SelectList" do
364
376
  end
365
377
 
366
378
  it "raises a TypeError if argument is not a String, Regexp or Numeric" do
367
- expect { browser.select_list(id: "new_user_languages").select([]) }.to raise_error(TypeError)
379
+ expect { browser.select_list(id: "new_user_languages").select({}) }.to raise_error(TypeError)
368
380
  end
369
381
  end
370
382
 
@@ -416,6 +428,18 @@ describe "SelectList" do
416
428
  expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
417
429
  end
418
430
 
431
+ it "selects each item in an Array" do
432
+ browser.select_list(name: "new_user_languages").clear
433
+ browser.select_list(name: "new_user_languages").select!(["Danish", "Swedish"])
434
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
435
+ end
436
+
437
+ it "selects each item in a parameter list" do
438
+ browser.select_list(name: "new_user_languages").clear
439
+ browser.select_list(name: "new_user_languages").select!("Danish", "Swedish")
440
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
441
+ end
442
+
419
443
  bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
420
444
  it "selects empty options" do
421
445
  browser.select_list(id: "delete_user_username").select!("")
@@ -452,7 +476,7 @@ describe "SelectList" do
452
476
 
453
477
  it "raises a TypeError if argument is not a String, Regexp or Numeric" do
454
478
  browser.select_list(id: "new_user_languages").clear
455
- expect { browser.select_list(id: "new_user_languages").select!([]) }.to raise_error(TypeError)
479
+ expect { browser.select_list(id: "new_user_languages").select!({}) }.to raise_error(TypeError)
456
480
  end
457
481
  end
458
482
 
@@ -469,6 +493,18 @@ describe "SelectList" do
469
493
  expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["EN", "NO"]
470
494
  end
471
495
 
496
+ it "selects all options in an Array" do
497
+ browser.select_list(name: "new_user_languages").clear
498
+ browser.select_list(name: "new_user_languages").select_all([/ish/, /Latin/])
499
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
500
+ end
501
+
502
+ it "selects all options in a parameter list" do
503
+ browser.select_list(name: "new_user_languages").clear
504
+ browser.select_list(name: "new_user_languages").select_all(/ish/, /Latin/)
505
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
506
+ end
507
+
472
508
  it "returns the first matching value if there are multiple matches" do
473
509
  expect(browser.select_list(name: "new_user_languages").select_all(/ish/)).to eq "Danish"
474
510
  end
@@ -493,6 +529,18 @@ describe "SelectList" do
493
529
  expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["EN", "NO"]
494
530
  end
495
531
 
532
+ it "selects all options in an Array" do
533
+ browser.select_list(name: "new_user_languages").clear
534
+ browser.select_list(name: "new_user_languages").select_all!([/ish/, /Latin/])
535
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
536
+ end
537
+
538
+ it "selects all options in a parameter list" do
539
+ browser.select_list(name: "new_user_languages").clear
540
+ browser.select_list(name: "new_user_languages").select_all!(/ish/, /Latin/)
541
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "EN", "Swedish", "Azeri - Latin", "Latin"]
542
+ end
543
+
496
544
  it "returns the first matching value if there are multiple matches" do
497
545
  expect(browser.select_list(name: "new_user_languages").select_all!(/ish/)).to eq "Danish"
498
546
  end
@@ -297,6 +297,16 @@ describe "TextField" do
297
297
  expect(browser.text_field(name: "new_user_occupation").value).to eq "ijij"
298
298
  end
299
299
 
300
+ it "sets the value to a concatenation of multiple arguments" do
301
+ browser.text_field(id: 'new_user_email').set('Bye', 'Cruel', 'World')
302
+ expect(browser.text_field(id: "new_user_email").value).to eq 'ByeCruelWorld'
303
+ end
304
+
305
+ it "sets the value to blank when no arguments are provided" do
306
+ browser.text_field(id: 'new_user_email').set
307
+ expect(browser.text_field(id: "new_user_email").value).to eq ''
308
+ end
309
+
300
310
  it "raises UnknownObjectException if the text field doesn't exist" do
301
311
  expect { browser.text_field(id: "no_such_id").set('secret') }.to raise_unknown_object_exception
302
312
  end
@@ -333,6 +343,20 @@ describe "TextField" do
333
343
  expect(browser.text_field(name: "new_user_occupation").value).to eq "ijij"
334
344
  end
335
345
 
346
+ it "sets the value to a concatenation of multiple arguments" do
347
+ browser.text_field(id: 'new_user_email').set!('Bye', 'Cruel', 'World')
348
+ expect(browser.text_field(id: "new_user_email").value).to eq 'ByeCruelWorld'
349
+ end
350
+
351
+ it "sets the value to blank when no arguments are provided" do
352
+ browser.text_field(id: 'new_user_email').set!
353
+ expect(browser.text_field(id: "new_user_email").value).to eq ''
354
+ end
355
+
356
+ it "raises ArgumentError for special keys" do
357
+ expect { browser.text_field(id: 'new_user_email').set!('a', :tab) }.to raise_error(ArgumentError)
358
+ end
359
+
336
360
  it "raises UnknownObjectException if the text field doesn't exist" do
337
361
  expect { browser.text_field(id: "no_such_id").set!('secret') }.to raise_unknown_object_exception
338
362
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.8.4'
5
+ s.version = '6.9.0'
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']
@@ -29,7 +29,7 @@ It facilitates the writing of automated tests by mimicing the behavior of a user
29
29
  s.add_development_dependency 'rake', '~> 0.9.2'
30
30
  s.add_development_dependency 'fuubar'
31
31
  s.add_development_dependency 'nokogiri'
32
- s.add_development_dependency 'activesupport', '~> 3.0' # for pluralization during code generation
32
+ s.add_development_dependency 'activesupport', '~> 4.0', '>= 4.1.11' # for pluralization during code generation
33
33
  s.add_development_dependency 'pry'
34
34
  s.add_development_dependency 'coveralls'
35
35
  s.add_development_dependency 'yard-doctest', '>= 0.1.8'
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.8.4
4
+ version: 6.9.0
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-09-09 00:00:00.000000000 Z
12
+ date: 2017-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver
@@ -121,14 +121,20 @@ dependencies:
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.0'
124
+ version: '4.0'
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 4.1.11
125
128
  type: :development
126
129
  prerelease: false
127
130
  version_requirements: !ruby/object:Gem::Requirement
128
131
  requirements:
129
132
  - - "~>"
130
133
  - !ruby/object:Gem::Version
131
- version: '3.0'
134
+ version: '4.0'
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 4.1.11
132
138
  - !ruby/object:Gem::Dependency
133
139
  name: pry
134
140
  requirement: !ruby/object:Gem::Requirement