class Scoutui::Commands::UploadFiles

Public Instance Methods

execute(drv, _e=nil) click to toggle source
# File lib/scoutui/commands/upload_files.rb, line 8
def execute(drv, _e=nil)

  Scoutui::Logger::LogMgr.instance.debug __FILE__  + (__LINE__).to_s + " uploadFiles(#{_e})"

  _rc=true

  @drv=drv if !drv.nil?


  filelist=_e['page']['with']
  to=_e['page']['to']
  submit=_e['page']['submit']
  close=_e['page']['close']
  waitList=_e['page']['wait']

  if filelist.is_a?(Array)

    filelist.each do |_f|
      Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "   upload #{_f}"

      if _e['page'].has_key?('by')

        test_settings={}
        test_settings['dut']=_e['page']['by']
   #     Scoutui::Base::VisualTestFramework::processFile(eyeScout, test_settings, strategy=nil)
        _typeCmd={ 'page' => {'action' => "click(#{_e['page']['by']})"} }
        _c = Scoutui::Commands::ClickObject.new(_typeCmd)
        _c.run(driver: @drv, dut: nil)
      end

      _typeCmd={ 'page' => {'action' => "type(#{to}, #{_f})"} }
    #  _typeCmd['page']['action']="type(#{to}, #{_f}"
      _c = Scoutui::Commands::Type.new(_typeCmd, @drv)
      _c.run(driver: @drv)

  #    Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "  Uploaded - pause"; STDIN.gets;

      _typeCmd={ 'page' => {'action' => "click(#{submit})"} }
      _c = Scoutui::Commands::ClickObject.new(_typeCmd)
      _c.run(driver: @drv, dut: nil)


      Scoutui::Base::VisualTestFramework::processAsserts(@drv, waitList, false)

      _typeCmd={ 'page' => {'action' => "click(#{close})"} }
      _c = Scoutui::Commands::ClickObject.new(_typeCmd)
      _c.run(driver: @drv, dut: nil)
      Scoutui::Logger::LogMgr.instance.debug "++ CLOSED DLG **"; # STDIN.gets
    end



  end



  setResult(rc)

end