Class: NullInterface

Inherits:
BaseInterface show all
Defined in:
lib/rutl/interface/null_interface.rb

Overview

Interface-level code for fake browser.

Constant Summary

Constants included from Utilities

Utilities::DEFAULT_TIMEOUT, Utilities::POLL_SLEEP_TIME

Instance Attribute Summary collapse

Attributes inherited from BaseInterface

#camera, #driver, #pages

Instance Method Summary collapse

Methods inherited from BaseInterface

#find_page, #find_state, #goto, #method_missing, #quit, #respond_to_missing?

Methods included from Utilities

#await, #class_info, #location, #page?, #raise_if_not_page

Constructor Details

#initializeNullInterface

Returns a new instance of NullInterface.



7
8
9
10
11
12
13
# File 'lib/rutl/interface/null_interface.rb', line 7

def initialize
  context = ElementContext.new(destinations: nil,
                               interface: self,
                               selectors: [])
  @driver = NullDriver.new(context)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BaseInterface

Instance Attribute Details

#current_pageObject



19
20
21
22
23
# File 'lib/rutl/interface/null_interface.rb', line 19

def current_page
  # Default to @pages.first if not set?
  # A browser can always check its current URL but the null driver can't.
  @current_page ||= @pages.first
end

Instance Method Details

#wait_for_transition(destinations) ⇒ Object



25
26
27
28
29
30
# File 'lib/rutl/interface/null_interface.rb', line 25

def wait_for_transition(destinations)
  # TODO: Setting @current page didn't do it beacause that set
  # context.interface.current_page and we wanted this in the browser.
  @current_page = destinations.first.new(self)
  $browser.current_page = @current_page
end