Class: Dommy::Interaction::Debug

Inherits:
Object
  • Object
show all
Defined in:
lib/dommy/interaction/debug.rb

Overview

A read-only debugging view over a DOM scope (a document or any element), built on DomSummary. Dommy::Rack::Session and Dommy::Browser expose it as #debug (scoped to the current within), but it wraps a plain node so it works on any document too — e.g. Dommy::Interaction::Debug.new(dom) in a request/view spec.

browser.debug.dom_summary   # readable forms/links/buttons/fields
browser.debug.buttons       # structured [{label:, type:, selector:}]

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ Debug

Returns a new instance of Debug.



14
15
16
# File 'lib/dommy/interaction/debug.rb', line 14

def initialize(scope)
  @scope = scope
end

Instance Method Details

#aria_snapshotObject



32
# File 'lib/dommy/interaction/debug.rb', line 32

def aria_snapshot = Internal::AriaSnapshot.serialize(aria_tree)

#aria_treeObject

The accessibility tree / Playwright-compatible ARIA snapshot of the current scope.



31
# File 'lib/dommy/interaction/debug.rb', line 31

def aria_tree = Internal::AccessibilityTree.build(@scope)

#buttonsObject



23
# File 'lib/dommy/interaction/debug.rb', line 23

def buttons = DomSummary.buttons(@scope)

#dom_summaryObject

A readable, sectioned summary of the visible controls.



19
# File 'lib/dommy/interaction/debug.rb', line 19

def dom_summary = DomSummary.to_text(@scope)

#fieldsObject



24
# File 'lib/dommy/interaction/debug.rb', line 24

def fields = DomSummary.fields(@scope)

#formsObject



21
# File 'lib/dommy/interaction/debug.rb', line 21

def forms = DomSummary.forms(@scope)


22
# File 'lib/dommy/interaction/debug.rb', line 22

def links = DomSummary.links(@scope)

#visible_textObject

The scope's collapsed visible text content.



27
# File 'lib/dommy/interaction/debug.rb', line 27

def visible_text = DomSummary.text(@scope)