<% if with_lib == 'true' -%> $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib')) <% end -%> require 'rspec-expectations' <% unless pageobject_driver.downcase == 'none' -%> require 'page-object' <% end -%> <% if with_gametel == 'true' -%> require 'gametel' <% end -%> <% if with_mohawk == 'true' -%> require 'mohawk' require 'win32screenshot' <% end -%> <% if with_lib == 'true' -%> require 'require_all' require_all 'lib' <% end -%> <% if with_gametel == 'true' -%> World(Gametel::Navigation) keystore = { :path => File.expand_path('~/.android/debug.keystore'), :alias => 'androiddebugkey', :password => 'android', :keystore_password => 'android' } Gametel.apk_path = PATH_TO_APK Gametel.keystore = keystore Before do @driver = Gametel.start(ACTIVITY_NAME_GOES_HERE) end After do Gametel.stop end <% end -%> <% unless pageobject_driver.downcase == 'none' -%> World(PageObject::PageFactory) <% end -%> <% if with_mohawk == 'true' -%> World(Mohawk::Navigation) Mohawk.app_path = PATH_TO_EXECUTABLE def capture_screenshot(name) Dir.mkdir('screenshots') unless Dir.exist? 'screenshots' now = Time.now.to_s.gsub(/\W+/, '.') Win32::Screenshot::Take.of(:desktop).write("screenshots/#{now}.#{name}.png") end Before do Mohawk.start end After do |scenario| capture_screenshot(scenario.name.gsub(/\W+/,'_')) if scenario.failed? Mohawk.stop end <% end -%>