Sha256: 282a9e7785dce5a090e7c6268b9185f198ef2c53fd9641f74d5ec2cefaead29b

Contents?: true

Size: 1.34 KB

Versions: 20

Compression:

Stored size: 1.34 KB

Contents


module Scoutui::Commands

  class ExistsAlert < Command


    def execute(drv=nil)
      @drv=drv if !drv.nil?

      _action = @cmd.match(/(get_*alert|clickjsconfirm|clickjsprompt|clickjsalert)\s*\((.*)\)/i)[2].to_s.strip

      Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert(#{_action})"  if Scoutui::Utils::TestUtils.instance.isDebug?

      rc=false

      alert=nil

      begin
        alert=@drv.switch_to.alert

        Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert => #{alert.class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?

        if alert.is_a?(Selenium::WebDriver::Alert)
          if _action.match(/accept/i)
            alert.accept
          elsif _action.match(/dismiss/i)
            alert.dismiss
          end

          rc=true
        end


      rescue Selenium::WebDriver::Error::NoSuchAlertError
        ;
      end

      _req = Scoutui::Utils::TestUtils.instance.getReq()

      Testmgr::TestReport.instance.getReq(_req).testcase(_action).add(!alert.nil?, "Verify alert exists")
      Testmgr::TestReport.instance.getReq(_req).testcase(_action).add(rc, "Verify processed alert")

      Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert() => #{rc.to_s}"  if Scoutui::Utils::TestUtils.instance.isDebug?
      rc

    end


  end



end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
scoutui-2.0.3.18.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.17.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.16.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.15.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.14.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.13.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.12.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.11.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.10.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.9.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.8.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.7.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.6.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.5.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.4.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.2.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.1.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.3.pre lib/scoutui/commands/exists_alert.rb
scoutui-2.0.2 lib/scoutui/commands/exists_alert.rb
scoutui-2.0.1 lib/scoutui/commands/exists_alert.rb