Class: Scoutui::Commands::UploadFiles

Inherits:
Command
  • Object
show all
Defined in:
lib/scoutui/commands/upload_files.rb

Instance Attribute Summary

Attributes inherited from Command

#bm, #cmd, #description, #drv, #enableAssert, #executed, #executed_result, #locator, #rc, #stanza

Instance Method Summary collapse

Methods inherited from Command

#assert?, #disableAssert, #disableAsserts, #enableAsserts, #executedResult, #getLocator, #initialize, #passed?, #result, #run, #setBenchmark, #setLocator, #setResult, #wasExecuted?

Constructor Details

This class inherits a constructor from Scoutui::Commands::Command

Instance Method Details

#execute(drv, _e = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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)

  #    puts __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)
      puts "++ CLOSED DLG **"; # STDIN.gets
    end



  end



  setResult(rc)

end