Class: RedGlass
- Inherits:
-
Object
- Object
- RedGlass
- Defined in:
- lib/red-glass/red_glass.rb
Constant Summary collapse
- PROJ_ROOT =
File.dirname(__FILE__).to_s
Instance Attribute Summary collapse
-
#archive_dir ⇒ Object
Returns the value of attribute archive_dir.
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#event_sequence ⇒ Object
Returns the value of attribute event_sequence.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#page_metadata ⇒ Object
Returns the value of attribute page_metadata.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#port ⇒ Object
Returns the value of attribute port.
-
#recording ⇒ Object
Returns the value of attribute recording.
-
#test_id ⇒ Object
Returns the value of attribute test_id.
Instance Method Summary collapse
-
#initialize(driver, opts = {}) ⇒ RedGlass
constructor
A new instance of RedGlass.
- #pause ⇒ Object
- #reload ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #take_snapshot ⇒ Object
Constructor Details
#initialize(driver, opts = {}) ⇒ RedGlass
Returns a new instance of RedGlass.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/red-glass/red_glass.rb', line 12 def initialize(driver, opts={}) @driver = driver @opts = opts opts[:listener].red_glass = self if opts[:listener] @test_id = opts[:test_id] || UUID.new.generate @server_log = opts[:server_log] || false @event_sequence = [] @page_metadata = {} @recording = false end |
Instance Attribute Details
#archive_dir ⇒ Object
Returns the value of attribute archive_dir.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def archive_dir @archive_dir end |
#driver ⇒ Object
Returns the value of attribute driver.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def driver @driver end |
#event_sequence ⇒ Object
Returns the value of attribute event_sequence.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def event_sequence @event_sequence end |
#opts ⇒ Object
Returns the value of attribute opts.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def opts @opts end |
#page_metadata ⇒ Object
Returns the value of attribute page_metadata.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def @page_metadata end |
#pid ⇒ Object
Returns the value of attribute pid.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def pid @pid end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def port @port end |
#recording ⇒ Object
Returns the value of attribute recording.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def recording @recording end |
#test_id ⇒ Object
Returns the value of attribute test_id.
8 9 10 |
# File 'lib/red-glass/red_glass.rb', line 8 def test_id @test_id end |
Instance Method Details
#pause ⇒ Object
36 37 38 |
# File 'lib/red-glass/red_glass.rb', line 36 def pause @recording = false end |
#reload ⇒ Object
30 31 32 33 34 |
# File 'lib/red-glass/red_glass.rb', line 30 def reload set_config start_server load_js end |
#start ⇒ Object
23 24 25 26 27 28 |
# File 'lib/red-glass/red_glass.rb', line 23 def start set_config start_server load_js @recording = true end |
#stop ⇒ Object
40 41 42 43 |
# File 'lib/red-glass/red_glass.rb', line 40 def stop Process.kill('INT', @pid) if @pid @recording = false end |
#take_snapshot ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/red-glass/red_glass.rb', line 45 def take_snapshot create_page_archive_directory take_screenshot capture_page_source load_js serialize_dom end |