class AutomationObject::State::Screen

Screen composite for managing state

Attributes

automatic_screen_changes[RW]

@return [AutomaticScreenChanges]

modal[RW]
previous_screen_name[RW]
window_handle[RW]

Public Instance Methods

activate() click to toggle source

@return [void]

# File lib/automation_object/state/screen.rb, line 39
def activate
  @active = true
  self.window_handle = driver.window_handle

  return if blue_prints.automatic_screen_changes.empty?

  # Add automatic screen change to a new thread and test for screen changes
  self.automatic_screen_changes = AutomaticScreenChanges.new(driver,
                                                             blue_prints.automatic_screen_changes,
                                                             :automatic_screen_changes,
                                                             self,
                                                             location + '[automatic_screen_changes]')
  automatic_screen_changes.activate
end
close() click to toggle source

@return [void]

# File lib/automation_object/state/screen.rb, line 72
def close
  utilize
  driver.close
  deactivate
end
closed?() click to toggle source

@return [Boolean]

# File lib/automation_object/state/screen.rb, line 79
def closed?
  !driver.window_handles.include?(window_handle)
end
deactivate() click to toggle source

@return [void]

# File lib/automation_object/state/screen.rb, line 55
def deactivate
  automatic_screen_changes&.deactivate

  self.automatic_screen_changes, self.window_handle = nil
  @active = false

  modals.values.map(&:deactivate)
  reset
end
utilize() click to toggle source

@return [void]

# File lib/automation_object/state/screen.rb, line 66
def utilize
  raise ScreenNotActiveError, name unless active?
  driver.window_handle = window_handle
end