rwebspec 4.3.2 → 4.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,11 @@
1
1
  CHANGELOG
2
2
  =========
3
+ 4.3.3
4
+ [Fixes] assert_option_equals for Selenium
5
+ [Fixes] assert_option_present for Selenium
6
+ [Fixes] assert_text_present_in_table for Selenium
7
+ [Enhancement] Add more UI tests and test project can be run in TestWise
8
+
3
9
  4.3.2
4
10
  [Fixes] typo on attaching browser for webdriver
5
11
  [Update] Change gemspec work with latest RSpec 2.14
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.2"
81
+ s.version = "4.3.3"
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
 
@@ -141,22 +141,39 @@ module RWebSpec
141
141
  # select
142
142
  def assert_option_value_not_present(select_name, option_value)
143
143
  @web_browser.select_lists.each { |select|
144
- continue unless select.name == select_name
145
- select.options.each do |option| # items in the list
146
- perform_assertion { assert(!(option.value == option_value), "unexpected select option: #{option_value} for #{select_name} found") }
144
+ the_element_name = element_name(select)
145
+ next unless the_element_name == select_name
146
+
147
+ if RWebSpec.framework =~ /watir/i
148
+ select.options.each do |option| # items in the list
149
+ perform_assertion { assert(!(option.value == option_value), "unexpected select option: #{option_value} for #{select_name} found") }
150
+ end
151
+ else
152
+ select.find_elements(:tag_name => "option" ).each do |option|
153
+ fail("unexpected option value: #{option_label} found") if option.value == option_value
154
+ end
147
155
  end
148
156
  }
149
157
  end
150
158
 
151
159
  alias assert_select_value_not_present assert_option_value_not_present
152
160
 
161
+
153
162
  def assert_option_not_present(select_name, option_label)
154
163
  @web_browser.select_lists.each { |select|
155
164
  the_element_name = element_name(select)
156
165
  next unless the_element_name == select_name
157
- select.options.each do |option| # items in the list
158
- perform_assertion { assert(!(option.text == option_label), "unexpected select option: #{option_label} for #{select_name} found") }
166
+
167
+ if RWebSpec.framework =~ /watir/i
168
+ select.options.each do |option| # items in the list
169
+ perform_assertion { assert(!(option.text == option_label), "unexpected select option: #{option_label} for #{select_name} found") }
170
+ end
171
+ else
172
+ select.find_elements(:tag_name => "option" ).each do |option|
173
+ fail("unexpected option label: #{option_label} found") if option.text == option_label
174
+ end
159
175
  end
176
+
160
177
  }
161
178
  end
162
179
 
@@ -358,7 +375,13 @@ module RWebSpec
358
375
  if RWebSpec.framework == "Watir"
359
376
  perform_assertion { assert_not(eval("#{tag}(:id, '#{element_id.to_s}').exists?"), "Unexpected element'#{tag}' + with id: '#{element_id}' found")}
360
377
  else
361
- perform_assertion { assert_not( @web_browser.driver.find_element(:tag_name => tag, :id => element_id))}
378
+ perform_assertion {
379
+ begin
380
+ @web_browser.driver.find_element(:tag_name => tag, :id => element_id)
381
+ fail("the element #{tag}##{element_id} found")
382
+ rescue =>e
383
+ end
384
+ }
362
385
  end
363
386
  end
364
387
 
@@ -414,14 +437,16 @@ module RWebSpec
414
437
  # Examples
415
438
  # assert_text_present_in_table("t1", ">A<") # => true
416
439
  # assert_text_present_in_table("t1", ">A<", :just_plain_text => true) # => false
417
- def assert_text_present_in_table(table_id, text, options = { :just_plain_text => false })
418
- perform_assertion { assert(table_source(table_id, options).include?(text), "the text #{text} not found in table #{table_id}") }
440
+ def assert_text_present_in_table(table_id, text, options = {})
441
+ options[:just_plain_text] ||= false
442
+ perform_assertion { assert(the_table_source(table_id, options).include?(text), "the text #{text} not found in table #{table_id}") }
419
443
  end
420
444
 
421
445
  alias assert_text_in_table assert_text_present_in_table
422
446
 
423
- def assert_text_not_present_in_table(table_id, text, options = { :just_plain_text => false })
424
- perform_assertion { assert_not(table_source(table_id, options).include?(text), "the text #{text} not found in table #{table_id}") }
447
+ def assert_text_not_present_in_table(table_id, text, options = {})
448
+ options[:just_plain_text] ||= false
449
+ perform_assertion { assert_not(the_table_source(table_id, options).include?(text), "the text #{text} not found in table #{table_id}") }
425
450
  end
426
451
 
427
452
  alias assert_text_not_in_table assert_text_not_present_in_table
@@ -469,7 +494,7 @@ module RWebSpec
469
494
  # end
470
495
 
471
496
  private
472
- def table_source(table_id, options)
497
+ def the_table_source(table_id, options)
473
498
  elem_table = RWebSpec.framework == "Watir" ? table(:id, table_id.to_s) : @web_browser.driver.find_element(:id => table_id)
474
499
  elem_table_text = elem_table.text
475
500
  elem_table_html = RWebSpec.framework == "Watir" ? elem_table.html : elem_table["innerHTML"];
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.2"
19
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "4.3.3"
20
20
  end
21
21
 
22
22
  $testwise_polling_interval = 1 # seconds
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.2
4
+ version: 4.3.3
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-07-13 00:00:00.000000000 Z
12
+ date: 2013-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec