Class: TestSteps::Handlers::OpenUrl

Inherits:
Base
  • Object
show all
Defined in:
lib/functions/handlers/open_url.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#login_button, #login_check, #login_process, #mem_word_check, #open_url_process, perform, #portal_mem_word, register

Class Method Details

.check_current_url(url) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/functions/handlers/open_url.rb', line 24

def self.check_current_url(url)
  url_check = Browser.b.url
  if url_check == url
    MyLog.log.info("Opened URL: #{url}")
    return true
  else
    MyLog.log.warn("URL not open: #{url} - opened #{url_check} instead")
    return false
  end
end

Instance Method Details

#perform(step_attributes) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/functions/handlers/open_url.rb', line 10

def perform(step_attributes)
  url = step_attributes[:testvalue]

  Browser.open_browser

  url = if ENV[url]
          ENV[url.to_s]
        else
          step_attributes[:testvalue]
        end
  Browser.b.goto(url)
  OpenUrl.check_current_url(url)
end