rwebspec 5.0.1 → 5.0.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: 243d65b66503ee097eabcb5bdd0406d02465ffa9
4
- data.tar.gz: da2288b12f703955fd454021db39ae63bd116342
3
+ metadata.gz: 2041946ebad32da51c5a1d38287e5d7d163f42cf
4
+ data.tar.gz: d990a25e840ff641f77468ca5190add30f289486
5
5
  SHA512:
6
- metadata.gz: 47a592a6142b92fa68fe450e2a3c747ebb46528cef8f46dcaa18605c572bd53c07b628eab3c303f6fcacfe38ddc5db8002a81e1ee609e6c4fa6db86d72d9913d
7
- data.tar.gz: c26663c841e53f7a54f3deaa7ebf7d2062dae86207819e37f6a19b0827033daaaad68813ffeca8bda447185d3bc6e89e40402a7a73579e7db47b212bd80ae0e9
6
+ metadata.gz: b46b84544367e452b5c6f62c1fb51370e9def09f17612734ed3dee7514dd9e541d3a58e79ff12c6cbcd842afcf48a104e4d66e29d53912693f5586347e27592c
7
+ data.tar.gz: 75ba170f172248dfd53ef5424b457e3c5b30dcfc9b855df68f4ffb82a7ce7b98702a3c2d29e88273d88a79a738dd66cd0c1e1686d71a5b923695e1a8e82f1948
data/CHANGELOG CHANGED
@@ -1,6 +1,9 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 5.0.2
5
+ [Fixes] inconsistency enter_text_with_id() between Watir and Selenium
6
+
4
7
  5.0.1
5
8
  [New] browser.execute_script
6
9
 
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ end
77
77
  spec = Gem::Specification.new do |s|
78
78
  s.platform= Gem::Platform::RUBY
79
79
  s.name = "rwebspec"
80
- s.version = "5.0.1"
80
+ s.version = "5.0.2"
81
81
  s.summary = "Web application functional specification in Ruby"
82
82
  s.description = "Executable functional specification for web applications in RSpec syntax with Watir or Selenium"
83
83
 
@@ -20,7 +20,7 @@ module RWebSpec
20
20
  #
21
21
  #
22
22
  # New Options:
23
- # :browser => :ie | :firefox | :chrome
23
+ # :browser => :ie | :firefox | :chrome | :safari
24
24
  def open_browser(opts = {})
25
25
  puts "[INFO] RWebSpec.Framework currently set to => #{RWebSpec.framework }"
26
26
  =begin
@@ -320,6 +320,11 @@ module RWebSpec
320
320
  # For IE10, it seems unable to identify HTML5 elements
321
321
  #
322
322
  # However for IE10, the '.' is omitted.
323
+ if opts.nil? || opts.empty?
324
+ # for Watir, default is clear
325
+ opts[:appending] = false
326
+ end
327
+
323
328
  perform_operation {
324
329
 
325
330
  begin
@@ -321,14 +321,24 @@ module RWebSpec
321
321
  alias clear_radio_button clear_radio_option
322
322
 
323
323
  # for text field can be easier to be identified by attribute "id" instead of "name", not recommended though
324
- def enter_text_with_id(textfield_id, value)
324
+ # params opts takes :appending => true or false, if true, won't clear the text field.
325
+ def enter_text_with_id(textfield_id, value, opts = {})
326
+
327
+ if opts.nil? || opts.empty?
328
+ opts[:appending] = true
329
+ end
330
+
325
331
  perform_operation {
326
332
  elements = find_elements(:id, textfield_id)
327
333
  if elements.size == 1 then
328
- elements[0].send_keys(value)
334
+ the_element = elements[0]
335
+ the_element.clear unless opts[:appending]
336
+ the_element.send_keys(value)
329
337
  else
330
338
  smaller_set = elements.select {|x| x.tag_name == "textarea" || (x.tag_name == "input" && x.attribute("text")) }
331
- smaller_set[0].send_keys(value)
339
+ the_element = smaller_set[0]
340
+ the_element.clear unless opts[:appending]
341
+ the_element.send_keys(value)
332
342
  end
333
343
  }
334
344
  end
@@ -34,6 +34,8 @@ module RWebSpec
34
34
  initialize_firefox_browser(existing_browser, base_url, options)
35
35
  when "chrome"
36
36
  initialize_chrome_browser(existing_browser, base_url, options)
37
+ when "safari"
38
+ initialize_safari_browser(existing_browser, base_url, options)
37
39
  when "ie"
38
40
  initialize_ie_browser(existing_browser, options)
39
41
  when "htmlunit"
@@ -68,9 +70,18 @@ module RWebSpec
68
70
  @browser = Selenium::WebDriver.for :chrome
69
71
  @browser.navigate.to base_url
70
72
  end
73
+
74
+ def initialize_safari_browser(existing_browser, base_url, options)
75
+ if existing_browser then
76
+ @browser = existing_browser
77
+ return
78
+ end
79
+
80
+ @browser = Selenium::WebDriver.for :safari
81
+ @browser.navigate.to base_url
82
+ end
71
83
 
72
84
  def initialize_htmlunit_browser(base_url, options)
73
- puts "XXXXX start HtmlUnit..."
74
85
  require 'json'
75
86
  caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => false)
76
87
  client = Selenium::WebDriver::Remote::Http::Default.new
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 = "5.0.1"
19
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "5.0.2"
20
20
  end
21
21
 
22
22
  $testwise_polling_interval = 1 # seconds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwebspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhimin Zhan
8
8
  autorequire: rwebspec
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-05 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - none
152
152
  rubyforge_project: rwebspec
153
- rubygems_version: 2.0.3
153
+ rubygems_version: 2.1.11
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Web application functional specification in Ruby