Class: Cello::PageObjects::Hub

Inherits:
Object
  • Object
show all
Defined in:
lib/cello/pageobjects/hub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hub_url, caps) ⇒ Hub

Returns a new instance of Hub.



10
11
12
13
14
15
16
17
# File 'lib/cello/pageobjects/hub.rb', line 10

def initialize hub_url, caps
  @browser = 
    Watir::Browser.new(  
                       :remote,  
                       :url => hub_url,  
                       :desired_capabilities => caps
    )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object



47
48
49
# File 'lib/cello/pageobjects/hub.rb', line 47

def method_missing method_name, *arguments
  @context.send method_name, *arguments
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



8
9
10
# File 'lib/cello/pageobjects/hub.rb', line 8

def browser
  @browser
end

#context(page) ⇒ Object

Returns the value of attribute context.



7
8
9
# File 'lib/cello/pageobjects/hub.rb', line 7

def context
  @context
end

Instance Method Details

#closeObject



31
32
33
# File 'lib/cello/pageobjects/hub.rb', line 31

def close
  @browser.close
end

#get_screenshotObject



35
36
37
# File 'lib/cello/pageobjects/hub.rb', line 35

def get_screenshot
  @browser.driver.save_screenshot 'screenshot.png'
end

#response_timeObject



43
44
45
# File 'lib/cello/pageobjects/hub.rb', line 43

def response_time
  #pending
end

#search(text) ⇒ Object



27
28
29
# File 'lib/cello/pageobjects/hub.rb', line 27

def search text 
 @browser.text.include? text 
end

#titleObject



39
40
41
# File 'lib/cello/pageobjects/hub.rb', line 39

def title
  @browser.title
end

#visitObject



19
20
21
# File 'lib/cello/pageobjects/hub.rb', line 19

def visit
  @context.visit
end