Class: Repla::Test::LogHelper
- Inherits:
-
Object
- Object
- Repla::Test::LogHelper
- Defined in:
- lib/repla/logger/test/lib/log_helper.rb
Overview
Log helper
Constant Summary collapse
- TEST_CLASS_JAVASCRIPT =
'document.body.lastChild.classList[0]'.freeze
- TEST_MESSAGE_JAVASCRIPT =
'document.body.lastChild.innerText'.freeze
- TEST_MESSAGE_COUNT_JAVASCRIPT =
'document.body.children.length'.freeze
- TEST_JAVASCRIPT_DIRECTORY =
File.join(File.dirname(__FILE__), '..', 'js')
- TEST_JAVASCRIPT_FILE =
File.join(TEST_JAVASCRIPT_DIRECTORY, 'test_view_helper.js')
Instance Method Summary collapse
-
#initialize(window_id, view_id) ⇒ LogHelper
constructor
A new instance of LogHelper.
- #last_log_class ⇒ Object
- #last_log_message ⇒ Object
- #log_message_at_index(index) ⇒ Object
- #number_of_log_messages ⇒ Object
Constructor Details
#initialize(window_id, view_id) ⇒ LogHelper
14 15 16 17 18 |
# File 'lib/repla/logger/test/lib/log_helper.rb', line 14 def initialize(window_id, view_id) @view = Repla::View.new(window_id, view_id) javascript = File.read(TEST_JAVASCRIPT_FILE) @view.do_javascript(javascript) end |
Instance Method Details
#last_log_class ⇒ Object
32 33 34 |
# File 'lib/repla/logger/test/lib/log_helper.rb', line 32 def last_log_class @view.do_javascript(TEST_CLASS_JAVASCRIPT) end |
#last_log_message ⇒ Object
28 29 30 |
# File 'lib/repla/logger/test/lib/log_helper.rb', line 28 def @view.do_javascript(TEST_MESSAGE_JAVASCRIPT) end |
#log_message_at_index(index) ⇒ Object
20 21 22 |
# File 'lib/repla/logger/test/lib/log_helper.rb', line 20 def (index) @view.do_javascript_function('innerTextOfBodyChildAtIndex', [index]) end |
#number_of_log_messages ⇒ Object
24 25 26 |
# File 'lib/repla/logger/test/lib/log_helper.rb', line 24 def @view.do_javascript(TEST_MESSAGE_COUNT_JAVASCRIPT) end |