Class: Applitools::Calabash::EyesSettings

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/applitools/calabash/eyes_settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEyesSettings

Returns a new instance of EyesSettings.



14
15
16
17
18
19
20
# File 'lib/applitools/calabash/eyes_settings.rb', line 14

def initialize
  @tmp_dir = 'tmp'
  @screenshot_dir = 'screenshots'
  @log_dir = 'logs'
  @log_file = 'applitools.log'
  @needs_setting_up = true
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



8
9
10
# File 'lib/applitools/calabash/eyes_settings.rb', line 8

def app_name
  @app_name
end

#applitools_api_keyObject

Returns the value of attribute applitools_api_key.



8
9
10
# File 'lib/applitools/calabash/eyes_settings.rb', line 8

def applitools_api_key
  @applitools_api_key
end

#eyesObject

Returns the value of attribute eyes.



8
9
10
# File 'lib/applitools/calabash/eyes_settings.rb', line 8

def eyes
  @eyes
end

#log_dirObject

Returns the value of attribute log_dir.



9
10
11
# File 'lib/applitools/calabash/eyes_settings.rb', line 9

def log_dir
  @log_dir
end

#log_fileObject

Returns the value of attribute log_file.



9
10
11
# File 'lib/applitools/calabash/eyes_settings.rb', line 9

def log_file
  @log_file
end

#needs_setting_upObject

Returns the value of attribute needs_setting_up.



10
11
12
# File 'lib/applitools/calabash/eyes_settings.rb', line 10

def needs_setting_up
  @needs_setting_up
end

#screenshot_dirObject

Returns the value of attribute screenshot_dir.



9
10
11
# File 'lib/applitools/calabash/eyes_settings.rb', line 9

def screenshot_dir
  @screenshot_dir
end

#test_nameObject

Returns the value of attribute test_name.



8
9
10
# File 'lib/applitools/calabash/eyes_settings.rb', line 8

def test_name
  @test_name
end

#tmp_dirObject

Returns the value of attribute tmp_dir.



9
10
11
# File 'lib/applitools/calabash/eyes_settings.rb', line 9

def tmp_dir
  @tmp_dir
end

#viewport_sizeObject

Returns the value of attribute viewport_size.



8
9
10
# File 'lib/applitools/calabash/eyes_settings.rb', line 8

def viewport_size
  @viewport_size
end

Instance Method Details

#log_prefixObject



32
33
34
# File 'lib/applitools/calabash/eyes_settings.rb', line 32

def log_prefix
  File.join(Dir.getwd, log_dir)
end

#options_for_openObject



22
23
24
25
26
# File 'lib/applitools/calabash/eyes_settings.rb', line 22

def options_for_open
  result = { app_name: app_name, test_name: test_name }
  return result unless viewport_size
  result.merge!(viewport_size: viewport_size)
end

#screenshot_namesObject



36
37
38
39
40
41
42
# File 'lib/applitools/calabash/eyes_settings.rb', line 36

def screenshot_names
  @names ||= Enumerator.new do |y|
    loop do
      y << { prefix: screenshot_prefix, name: "#{SecureRandom.uuid}.png" }
    end
  end
end

#screenshot_prefixObject



28
29
30
# File 'lib/applitools/calabash/eyes_settings.rb', line 28

def screenshot_prefix
  File.join(Dir.getwd, tmp_dir, screenshot_dir, '')
end