Class: AutomationObject::State::Screen

Inherits:
Base show all
Includes:
ContainerHelper
Defined in:
lib/automation_object/state/screen.rb

Overview

Screen composite for managing state

Instance Attribute Summary collapse

Attributes included from ContainerHelper

#active

Attributes inherited from Base

#blue_prints, #driver

Attributes inherited from Composite

#children, #location, #name, #parent

Instance Method Summary collapse

Methods included from ContainerHelper

#active?, #changes, #element_to_container, #go, #reset

Methods inherited from Base

#get_child, #get_children, #initialize, #screen, #top

Methods inherited from Composite

#add_has_many_relationships, #add_has_one_relationships, #get_child, #get_children, has_many, has_many_relationships, has_one, has_one_relationships, #initialize, #top

Methods included from Reflection

#add_alias, #add_attribute

Methods included from CompositeHook

#after_create_run, #before_create_run, included

Constructor Details

This class inherits a constructor from AutomationObject::State::Base

Instance Attribute Details

#automatic_screen_changesAutomaticScreenChanges



26
27
28
# File 'lib/automation_object/state/screen.rb', line 26

def automatic_screen_changes
  @automatic_screen_changes
end

Returns the value of attribute modal



23
24
25
# File 'lib/automation_object/state/screen.rb', line 23

def modal
  @modal
end

#previous_screen_nameObject

Returns the value of attribute previous_screen_name



23
24
25
# File 'lib/automation_object/state/screen.rb', line 23

def previous_screen_name
  @previous_screen_name
end

#window_handleObject

Returns the value of attribute window_handle



23
24
25
# File 'lib/automation_object/state/screen.rb', line 23

def window_handle
  @window_handle
end

Instance Method Details

#activatevoid

This method returns an undefined value.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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

#closevoid

This method returns an undefined value.



72
73
74
75
76
# File 'lib/automation_object/state/screen.rb', line 72

def close
  utilize
  driver.close
  deactivate
end

#closed?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/automation_object/state/screen.rb', line 79

def closed?
  !driver.window_handles.include?(window_handle)
end

#deactivatevoid

This method returns an undefined value.



55
56
57
58
59
60
61
62
63
# 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

#utilizevoid

This method returns an undefined value.



66
67
68
69
# File 'lib/automation_object/state/screen.rb', line 66

def utilize
  raise ScreenNotActiveError, name unless active?
  driver.window_handle = window_handle
end