Skip to content

Instantly share code, notes, and snippets.

@ndrluis
Last active December 28, 2015 23:19
Show Gist options
  • Select an option

  • Save ndrluis/7578001 to your computer and use it in GitHub Desktop.

Select an option

Save ndrluis/7578001 to your computer and use it in GitHub Desktop.
Rukuli Spec 1
IMAGE_VIEWER:
darwin:
'Preview'
cygwin|mswin|mingw|bccwin|wince|emx:
"Paint"
FILE_EXPLORER:
darwin:
'Finder'
cygwin|mswin|mingw|bccwin|wince|emx:
"Explorer"
TEXT_EDIT:
darwin|mac os:
'TextEdit'
cygwin|mswin|mingw|bccwin|wince|emx:
"Note Pad"
require 'java'
require 'yaml'
require 'rspec'
require 'rukuli'
APPLICATIONS = YAML.load(File.open("#{Dir.pwd}/spec/support/applications.yml"))
Rukuli::Config.logging = false
def application(app)
APPLICATIONS[app].select { |k, _| k =~ /#{RbConfig::CONFIG['host_os']}/ }.shift[1]
end
def setup_test_area
Rukuli::Config.image_path = "#{Dir.pwd}/spec/support/images/"
screen = Rukuli::Screen.new
app = Rukuli::App.new(application "IMAGE_VIEWER")
app.focus()
center = screen.find("#{Dir.pwd}/spec/support/images/smiley_face.png")
test_area = Rukuli::Region.new(center.x - 212, center.y - 212, 503, 503)
test_area.highlight
test_area
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment