module RWebSpec::RSpecHelper

Public Instance Methods

be_odd_number() click to toggle source

RSpec Matchers

Example,

a_number.should be_odd_number
# File lib/rwebspec-common/rspec_helper.rb, line 90
def be_odd_number
  simple_matcher("must be odd number") { |actual| actual && actual.to_id % 2 == 1}
end
button_by_id(button_id) click to toggle source
# File lib/rwebspec-common/rspec_helper.rb, line 47
def button_by_id(button_id)
  button(:id, button_id)
end
buttons_by_caption(text) click to toggle source
# File lib/rwebspec-common/rspec_helper.rb, line 51
def buttons_by_caption(text)
  button(:text, text)
end
Also aliased as: buttons_by_text
buttons_by_text(text)
Alias for: buttons_by_caption
debugging?() click to toggle source

When running

# File lib/rwebspec-common/rspec_helper.rb, line 82
def debugging?
  ($TESTWISE_DEBUGGING && $TESTWISE_RUNNING_AS == "test_case")
end
element_source(elem_id) click to toggle source

TODO: is it working?

# File lib/rwebspec-common/rspec_helper.rb, line 42
def element_source(elem_id)
  @web_browser.get_html_in_element(elem_id)
end
element_text(elem_id) click to toggle source
# File lib/rwebspec-common/rspec_helper.rb, line 36
def element_text(elem_id)
  @web_browser.element_value(elem_id)
end
Also aliased as: element_text_by_id
element_text_by_id(elem_id)
Alias for: element_text
save_content_to_file(content, file_name = nil) click to toggle source
# File lib/rwebspec-common/rspec_helper.rb, line 75
def save_content_to_file(content, file_name = nil)
  file_name ||= Time.now.strftime("%Y%m%d%H%M%S") + ".html"
  puts "about to save page: #{File.expand_path(file_name)}"
  File.open(file_name, "w").puts content
end
save_page(file_name = nil) click to toggle source
# File lib/rwebspec-common/rspec_helper.rb, line 71
def save_page(file_name = nil)
  @web_browser.save_page(file_name)
end
table_source(table_id) click to toggle source

Content

# File lib/rwebspec-common/rspec_helper.rb, line 28
def table_source(table_id)
  table(:id, table_id).innerHTML
  # elem = @web_browser.document.getElementById(table_id)

  # raise "The element '#{table_id}' is not a table or there are multple elements with same id" unless elem.name.uppercase == "TABLE"

  # elem.innerHTML

end
Also aliased as: table_source_by_id
table_source_by_id(table_id)
Alias for: table_source