Sha256: d5f782cf28d4301562a2ff91c7a3b1b7e6bff3940ef8a58043dc9a1a419f2b3b

Contents?: true

Size: 1.73 KB

Versions: 9

Compression:

Stored size: 1.73 KB

Contents

module Scoutui::Commands

  class Highlight < Command


    def _highlight(obj, e=nil)
      _rc=false

      if !obj.nil?

        if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('style')
          style=e['page']['style']
          obj=Scoutui::Base::QBrowser.highlight(@drv, obj, style)
        else
          obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
        end

        _rc=true
      end

      _rc
    end

    def execute(drv, e=nil)
      rc=true
      _req = Scoutui::Utils::TestUtils.instance.getReq()

      Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Highlight.execute(#{@cmd})"

      @drv=drv if !drv.nil?

      begin

        locators=[]

        if @cmd.match(/highlight\s*\((.*)\)/)
          _locator = @cmd.match(/highlight\s*\((.*)\)/)[1].to_s.strip
          locators << _locator
        elsif e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('locators')
          locators = e['page']['locators']
        end

        locators.each do |loc|
          obj = Scoutui::Base::QBrowser.getObject(@drv, loc, Scoutui::Commands::Utils.instance.getTimeout)
          _rc = _highlight(obj, e)

          rc &&= _rc

          Testmgr::TestReport.instance.getReq(_req).testcase('highlight').add(!obj.nil?, "Verify object #{_locator} to highlight exists : #{obj.class.to_s}")
          Testmgr::TestReport.instance.getReq(_req).testcase('highlight').add(_rc, "Verify highlight #{_rc} performed for #{_locator}")

        end

      rescue => ex
        Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
        Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
      end


      setResult(rc)
    end



  end


end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scoutui-2.0.3.21.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.20.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.19.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.18.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.17.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.16.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.15.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.14.pre lib/scoutui/commands/highlight.rb
scoutui-2.0.3.13.pre lib/scoutui/commands/highlight.rb