Sha256: 318047638e48a9e5a72fbe4b1f14634d383fbb1e829c48442a1878f69744b49a

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

<% 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 'win32/screenshot'
<% 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 -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
testgen-0.8.5 lib/testgen/generators/project/env.rb.tt
testgen-0.8.4 lib/testgen/generators/project/env.rb.tt