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

#driver, #interface, #pages

Instance Method Summary collapse

Methods inherited from BaseInterface

#current_url, #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

#initialize(pages:) ⇒ NullInterface

Returns a new instance of NullInterface.



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

def initialize(pages:)
  @driver = NullDriver.new
  @driver.interface = @interface
  super
end

Dynamic Method Handling

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

Instance Attribute Details

#variablesObject

Returns the value of attribute variables.



8
9
10
# File 'lib/rutl/interface/null_interface.rb', line 8

def variables
  @variables
end

Instance Method Details

#current_pageObject



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

def current_page
  # Default to @pages.first if not set?

  # A browser can alwasy check its current URL but the null driver can't.

  @current_page || @pages.first
end

#set_current_page(page) ⇒ Object



16
17
18
# File 'lib/rutl/interface/null_interface.rb', line 16

def set_current_page(page)
  @current_page = page
end

#wait_for_transition(destinations) ⇒ Object



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

def wait_for_transition(destinations)
  @current_page = find_page(destinations.first)
end