Top Level Namespace

Defined Under Namespace

Modules: Appium, Kernel, Pages

Instance Method Summary collapse

Instance Method Details

#define_reload(paths) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/web_console.rb', line 9

def define_reload paths
  Pry.send(:define_singleton_method, :_reload) do
    paths.each do |p|
      # If a page obj is deleted then load will error.
      begin
        load p
      rescue # LoadError: cannot load such file
      end
    end
  end
  nil
end

#pageObject

loop through all pages and output the methods



85
86
87
88
89
90
91
# File 'lib/start.rb', line 85

def page
  Pages.constants.each do |page|
    methods = Pages.const_get(page).singleton_methods
    methods.each { |m| puts "#{page.to_s.downcase}.#{m}" }
  end
  nil
end

#promote_page_object_methodsObject

Promote methods to top level for Pry Pages module is hard coded.



23
24
25
26
27
28
29
# File 'lib/start.rb', line 23

def promote_page_object_methods
  ::Pages.constants.each do |class_name|
    Kernel.send(:define_method, class_name.to_s.downcase) do
      Pages.const_get(class_name)
    end
  end
end

#reloadObject



31
32
33
34
35
# File 'lib/start.rb', line 31

def reload
  Pry.send :_reload
  promote_page_object_methods
  nil
end

#set_wait(seconds) ⇒ Object



37
38
39
# File 'lib/start.rb', line 37

def set_wait seconds
  $driver.manage.timeouts.implicit_wait = seconds
end

#xObject



65
66
67
68
# File 'lib/start.rb', line 65

def x
  $driver.quit if $driver
  exit
end