Class: Percy::Capybara::Loaders::NativeLoader
- Inherits:
-
BaseLoader
- Object
- BaseLoader
- Percy::Capybara::Loaders::NativeLoader
show all
- Defined in:
- lib/percy/capybara/loaders/native_loader.rb
Overview
Resource loader that uses the native Capybara browser interface to discover resources. This loader uses JavaScript to discover page resources, so specs must be tagged with “js: true” because the default Rack::Test driver does not support executing JavaScript.
Constant Summary
collapse
- PATH_REGEX =
/\A\/[^\\s\"']*/
- DATA_URL_REGEX =
/\Adata:/
- LOCAL_HOSTNAMES =
[
'localhost',
'127.0.0.1',
'0.0.0.0',
].freeze
Constants inherited
from BaseLoader
BaseLoader::URL_REGEX
Instance Attribute Summary
Attributes inherited from BaseLoader
#page
Instance Method Summary
collapse
Methods inherited from BaseLoader
#initialize
Instance Method Details
#_current_host_port ⇒ Object
214
215
216
217
|
# File 'lib/percy/capybara/loaders/native_loader.rb', line 214
def _current_host_port
url_match = URL_REGEX.match(page.current_url)
host_port = url_match[1] + url_match[2] + (url_match[3] || '')
end
|
#build_resources ⇒ Object
30
31
32
|
# File 'lib/percy/capybara/loaders/native_loader.rb', line 30
def build_resources
[]
end
|
#snapshot_resources ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/percy/capybara/loaders/native_loader.rb', line 21
def snapshot_resources
resources = []
resources << root_html_resource
resources += _get_css_resources
resources += _get_image_resources
resources += iframes_resources
resources
end
|