class Scoutui::Commands::WhileDo
Public Class Methods
new(driver)
click to toggle source
# File lib/scoutui/commands/clauses/while_do.rb, line 7 def initialize(driver) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WhileDo.init()" @drv=driver @pageElt=nil @passed=true @executed_result=nil end
Public Instance Methods
_process(untilList)
click to toggle source
# File lib/scoutui/commands/clauses/while_do.rb, line 21 def _process(untilList) Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " _process(#{untilList})" if untilList.is_a?(Array) && untilList.size==1 && (untilList[0]==true || untilList[0]==false) return untilList[0] end rc=Scoutui::Base::VisualTestFramework::processAsserts(@drv, untilList, false) Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " _process(#{untilList}) => #{rc}" rc end
execute(pageElt)
click to toggle source
# File lib/scoutui/commands/clauses/while_do.rb, line 17 def execute(pageElt) setResult(while_do(pageElt)) end
while_do(pageElt)
click to toggle source
# File lib/scoutui/commands/clauses/while_do.rb, line 39 def while_do(pageElt) Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " do_until : #{pageElt}" thenList=nil untilList=nil whenPassed=nil whenFailed=nil _alwaystrue=false if pageElt.is_a?(Hash) && pageElt.has_key?('page') if pageElt['page'].has_key?('while') && pageElt['page'].has_key?('do') thenList=pageElt['page']['do'] whileList=pageElt['page']['while'] elsif pageElt['page'].has_key?('do') thenList=pageElt['page']['do'] end if pageElt['page'].has_key?('whenPassed') && pageElt['page']['whenPassed'].is_a?(Array) whenPassed=pageElt['page']['whenPassed'] end if pageElt['page'].has_key?('whenFailed') && pageElt['page']['whenFailed'].is_a?(Array) whenFailed=pageElt['page']['whenFailed'] end elsif pageElt.is_a?(Hash) && pageElt.has_key?('while') && pageElt.has_key?('do') thenList = pageElt['do'] whileList = pageElt['while'] if pageElt.has_key?('whenPassed') && pageElt['whenPassed'].is_a?(Array) whenPassed=pageElt['whenPassed'] end if pageElt.has_key?('whenFailed') && pageElt['whenFailed'].is_a?(Array) whenFailed=pageElt['whenFailed'] end end if thenList # !pageElt.nil? && pageElt['page'].has_key?('do') && pageElt['page'].has_key?('until') _max = 25 _i=0 _historyElts={} begin while (_i < _max) && _process(whileList) do Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == process #{_i}. #{thenList}" rc=Scoutui::Commands.simpleCommands(@drv, thenList) Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " == returned process #{_i} => #{rc}" _i+=1 end # while() rescue => ex Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex.message}" Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}" end end Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ==== While Do Pause"; #STDIN.gets setResult(@passed) end