Class: Aaet::ApplitoolEyes

Inherits:
Object
  • Object
show all
Defined in:
lib/aaet/common/applitools.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ ApplitoolEyes

Returns a new instance of ApplitoolEyes.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/aaet/common/applitools.rb', line 8

def initialize settings
  puts "\nRun Applitools Tests: true\n".green
  self.eyes = Applitools::Selenium::Eyes.new
  self.applitools_settings = settings[:config][:applitools][0]
  eyes.api_key = applitools_settings[:key]
  eyes.save_failed_tests = settings[:options][:updateBaseline]
  batch_info = Applitools::BatchInfo.new(caps[:appPackage]) #app name, locale, orientation
  batch_info.id = Digest::MD5.hexdigest(settings[:run_time]).scan(/\d/).join('')
  eyes.batch = batch_info
  eyes.match_level = :strict
  self.uuid = settings[:config][:caps][:udid]
end

Instance Attribute Details

#applitools_settingsObject

Returns the value of attribute applitools_settings.



6
7
8
# File 'lib/aaet/common/applitools.rb', line 6

def applitools_settings
  @applitools_settings
end

#eyesObject

Returns the value of attribute eyes.



6
7
8
# File 'lib/aaet/common/applitools.rb', line 6

def eyes
  @eyes
end

#uuidObject

Returns the value of attribute uuid.



6
7
8
# File 'lib/aaet/common/applitools.rb', line 6

def uuid
  @uuid
end

Instance Method Details

#close_eyesObject



30
31
32
33
34
# File 'lib/aaet/common/applitools.rb', line 30

def close_eyes
  results = eyes.close(false)
  eyes.abort_if_not_closed
  results
end

#eyes_open(app_name, test_name) ⇒ Object



21
22
23
# File 'lib/aaet/common/applitools.rb', line 21

def eyes_open app_name, test_name
  eyes.open(driver: driver, app_name: app_name, test_name: test_name)
end

#testsObject



36
37
38
39
# File 'lib/aaet/common/applitools.rb', line 36

def tests
  applitools_settings.delete(:key)
  applitools_settings.map { |test| { name: test[0].to_s }.merge!(test[1]) }
end

#upload_to_applitools(app_name, test_name, tag) ⇒ Object



25
26
27
28
# File 'lib/aaet/common/applitools.rb', line 25

def upload_to_applitools app_name, test_name, tag
  eyes_open app_name, test_name
  eyes.check_window tag
end