rwebspec 4.3.5 → 5.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,12 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 5.0
5
+ [Change] Support Watir 5.0, watir-classic/ie no longer available
6
+
7
+ 4.4
8
+ [Enhancement] add enter_text_with_id to support HTML5 elements on IE10 (which fail to identify email field as text field)
9
+
4
10
  4.3.5
5
11
  [Change] Add licence (MIT) into gemspec
6
12
  [Fixes] check_checkbox not working when there is hidden input with same name as checkbox
data/Rakefile CHANGED
@@ -78,7 +78,7 @@ end
78
78
  spec = Gem::Specification.new do |s|
79
79
  s.platform= Gem::Platform::RUBY
80
80
  s.name = "rwebspec"
81
- s.version = "4.3.5"
81
+ s.version = "5.0"
82
82
  s.summary = "Web application functional specification in Ruby"
83
83
  s.description = "Executable functional specification for web applications in RSpec syntax with Watir or Selenium"
84
84
 
@@ -103,8 +103,11 @@ spec = Gem::Specification.new do |s|
103
103
  s.add_dependency(%q<rspec-mocks>, [">= 2.13.0"])
104
104
  s.add_dependency(%q<rspec-expectations>, [">= 2.13"])
105
105
  s.add_dependency("commonwatir", ">= 4.0.0")
106
+
106
107
  unless RUBY_PLATFORM =~ /mingw/
107
108
  s.add_dependency("selenium-webdriver")
109
+ else
110
+ s.add_dependency("watir-classic", ">= 4.0.0")
108
111
  end
109
112
  end
110
113
 
@@ -299,7 +299,7 @@ module RWebSpec
299
299
  # page.check_checkbox('bad_ones', 'Chicken Little')
300
300
  # page.check_checkbox('good_ones', ['Cars', 'Toy Story'])
301
301
  #
302
- [:set_form_element, :click_link_with_text, :click_link_with_id, :submit, :click_button_with_id, :click_button_with_name, :click_button_with_caption, :click_button_with_value, :click_radio_option, :clear_radio_option, :check_checkbox, :uncheck_checkbox, :select_option].each do |method|
302
+ [:set_form_element, :click_link_with_text, :click_link_with_id, :submit, :click_button_with_id, :click_button_with_name, :click_button_with_caption, :click_button_with_value, :click_radio_option, :clear_radio_option, :check_checkbox, :uncheck_checkbox, :select_option, :element].each do |method|
303
303
  define_method method do |* args|
304
304
  perform_operation { @web_browser.send(method, * args) if @web_browser }
305
305
  end
@@ -314,8 +314,24 @@ module RWebSpec
314
314
  alias clear_radio_button clear_radio_option
315
315
 
316
316
  # for text field can be easier to be identified by attribute "id" instead of "name", not recommended though
317
- def enter_text_with_id(textfield_id, value)
318
- perform_operation { text_field(:id, textfield_id).set(value) }
317
+ #
318
+ # params opts takes :appending => true or false, if true, won't clear the text field.
319
+ def enter_text_with_id(textfield_id, value, opts = {})
320
+ # For IE10, it seems unable to identify HTML5 elements
321
+ #
322
+ # However for IE10, the '.' is omitted.
323
+ perform_operation {
324
+
325
+ begin
326
+ text_field(:id, textfield_id).set(value)
327
+ rescue => e
328
+ # However, this approach is not reliable with Watir (IE)
329
+ # for example, for entering email, the dot cannot be entered, try ["a@b", :decimal, "com"]
330
+ the_elem = element(:xpath, "//input[@id='#{textfield_id}']")
331
+ the_elem.send_keys(:clear) unless opts[:appending]
332
+ the_elem.send_keys(value)
333
+ end
334
+ }
319
335
  end
320
336
 
321
337
  def perform_operation(& block)
@@ -3,27 +3,6 @@
3
3
  #* Distributed open-source, see full license in MIT-LICENSE
4
4
  #***********************************************************
5
5
 
6
- =begin
7
-
8
- begin
9
- require 'watir'
10
- # require 'watir/contrib/enabled_popup'
11
- # require 'watir/close_all'
12
- # require 'watir/screen_capture'
13
- # NO need any more
14
- require 'watir-classic/ie'
15
- # require 'watir/contrib/visible'
16
- $watir_loaded = true
17
- rescue LoadError => e
18
- puts "!!!Error on loading watir: #{e}"
19
- $watir_loaded = false
20
- end
21
-
22
- if RUBY_PLATFORM =~ /mingw/
23
- raise "You have must at least Watir installed" unless $watir_loaded
24
- end
25
-
26
- =end
27
6
 
28
7
  module RWebSpec
29
8
 
@@ -73,7 +52,7 @@ module RWebSpec
73
52
 
74
53
  def self.reuse(base_url, options)
75
54
  if self.is_windows? && ($TESTWISE_BROWSER != "Firefox" && $TESTWISE_BROWSER != "Firefox")
76
- require 'watir-classic/ie'
55
+ require 'watir-classic'
77
56
  # try to avoid
78
57
  # lib/ruby/1.8/dl/win32.rb:11:in `sym': unknown type specifier 'v'
79
58
  Watir::IE.each do |browser_window|
data/lib/rwebspec.rb CHANGED
@@ -16,7 +16,7 @@ end
16
16
  require 'rspec'
17
17
 
18
18
  unless defined? RWEBSPEC_VERSION
19
- RWEBSPEC_VERSION = RWEBUNIT_VERSION = "4.3.5"
19
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "5.0"
20
20
  end
21
21
 
22
22
  $testwise_polling_interval = 1 # seconds
@@ -66,7 +66,11 @@ module RWebSpec
66
66
  def load_watir
67
67
  # puts "Loading Watir"
68
68
  require 'watir'
69
- require 'watir-classic/ie'
69
+
70
+ if RUBY_PLATFORM =~ /mingw/i
71
+ require 'watir-classic'
72
+ end
73
+
70
74
  load(File.dirname(__FILE__) + "/rwebspec-watir/web_browser.rb")
71
75
  load(File.dirname(__FILE__) + "/rwebspec-watir/driver.rb")
72
76
  require File.dirname(__FILE__) + "/extensions/watir_extensions"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwebspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.5
4
+ version: '5.0'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire: rwebspec
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-06 00:00:00.000000000 Z
12
+ date: 2013-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec