lib/calabash-cucumber/tests_helpers.rb in calabash-cucumber-0.9.163.pre6 vs lib/calabash-cucumber/tests_helpers.rb in calabash-cucumber-0.9.163.pre7

- old
+ new

@@ -1,11 +1,11 @@ -require 'calabash-cucumber/core' +require 'calabash-cucumber/failure_helpers' module Calabash module Cucumber - module TestsHelpers - include Calabash::Cucumber::Core + module TestsHelpers #=> http + include Calabash::Cucumber::FailureHelpers def navigation_path(*args) #navigation_path( # [:a , 2], @@ -49,19 +49,10 @@ def check_view_with_mark_exists(expected_mark) check_element_exists("view marked:'#{expected_mark}'") end - def screenshot_and_raise(msg, options={:prefix => nil, :name => nil, :label => nil}) - screenshot_embed(options) - raise(msg) - end - - def fail(msg="Error. Check log for details.", options={:prefix => nil, :name => nil, :label => nil}) - screenshot_and_raise(msg, options) - end - def each_cell(opts={:query => "tableView", :post_scroll => 0.3, :animate => true}, &block) uiquery = opts[:query] || "tableView" skip = opts[:skip_if] check_element_exists(uiquery) secs = query(uiquery,:numberOfSections).first @@ -98,39 +89,9 @@ sleep(post_back) if post_back > 0 end end - - - def screenshot_embed(options={:prefix => nil, :name => nil, :label => nil}) - path = screenshot(options) - embed(path, "image/png", options[:label] || File.basename(path)) - end - - def screenshot(options={:prefix => nil, :name => nil}) - prefix = options[:prefix] - name = options[:name] - - @@screenshot_count ||= 0 - res = http({:method => :get, :path => 'screenshot'}) - prefix = prefix || ENV['SCREENSHOT_PATH'] || "" - if name.nil? - name = "screenshot" - else - if File.extname(name).downcase == ".png" - name = name.split(".png")[0] - end - end - - path = "#{prefix}#{name}_#{@@screenshot_count}.png" - File.open(path, 'wb') do |f| - f.write res - end - @@screenshot_count += 1 - path - end - end end end