Sha256: 3db96ddd77b10c78ec44bd0b4bc1c8797c95c9b48ae393afb1eca05ecdf05aae

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

require 'singleton'
require 'eyes_selenium'

module Scoutui::Eyes


  class EyeFactory
    include Singleton

    attr_accessor :eyesList

    def initialize
      @eyesList=Array.new()
    end

    def createScout()
      browserType = Scoutui::Base::UserVars.instance.getBrowserType()

      puts __FILE__ + (__LINE__).to_s + "BrowserType : #{browserType}"
      eyeScout = EyeScout.new(browserType)
    end

    def createEyes()

      use_eyes = Scoutui::Utils::TestUtils.instance.eyesEnabled?

      Scoutui::Logger::LogMgr.instance.info  __FILE__ + (__LINE__).to_s + " create(#{use_eyes})" if Scoutui::Utils::TestUtils.instance.isDebug?
      eyes=nil


      if use_eyes
        license_key=nil

        licFile=Scoutui::Utils::TestUtils.instance.getLicenseFile()

        if !licFile.empty?

          valid_json=false
          begin
            jFile = File.read(licFile)
            jLicense=jsonData=JSON.parse(jFile)
            license_key=jLicense['api_key'].to_s
            valid_json=true
          rescue => ex
            ;
          end

        elsif ENV.has_key?('APPLITOOLS_API_KEY')
          Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " APPLITOOLS_API_KEY from ENV"
          license_key=ENV['APPLITOOLS_API_KEY'].to_s
        end


        if !license_key.nil?
          eyes=Applitools::Eyes.new()
          Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Eyes Object created #{eyes}"
          eyes.api_key = license_key
          eyes.force_fullpage_screenshot = true

          match_level = Scoutui::Base::UserVars.instance.getVar('eyes.match_level')

          eyes.match_level = Applitools::Eyes::MATCH_LEVEL[match_level.to_sym]

          eyes.viewport_size = Scoutui::Base::UserVars.instance.getViewPort()

          Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " eyes => #{eyes}"
        end

        ## TBD - eyes.open()


      end

    #  eyes
      @eyesList << eyes
      @eyesList.last()
    end

  end



end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scoutui-2.0.3.11.pre lib/scoutui/eyes/eye_factory.rb