Class: Percy::Capybara::Loaders::NativeLoader
- Inherits:
-
BaseLoader
- Object
- BaseLoader
- Percy::Capybara::Loaders::NativeLoader
- 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::MAX_FILESIZE_BYTES, BaseLoader::SKIP_RESOURCE_EXTENSIONS, BaseLoader::URL_REGEX
Instance Attribute Summary
Attributes inherited from BaseLoader
Instance Method Summary collapse
- #build_resources ⇒ Object
-
#initialize(options = {}) ⇒ NativeLoader
constructor
A new instance of NativeLoader.
- #snapshot_resources ⇒ Object
Methods inherited from BaseLoader
#_find_files, #_resources_from_dir, #_uri_join
Constructor Details
#initialize(options = {}) ⇒ NativeLoader
Returns a new instance of NativeLoader.
20 21 22 23 24 25 26 |
# File 'lib/percy/capybara/loaders/native_loader.rb', line 20 def initialize( = {}) super() @asset_hostnames = [:asset_hostnames] || [] @assets_from_stylesheets = [:include_assets_from_stylesheets] || :all @assets_from_stylesheets = ->(_) { true } if @assets_from_stylesheets == :all end |
Instance Method Details
#build_resources ⇒ Object
37 38 39 |
# File 'lib/percy/capybara/loaders/native_loader.rb', line 37 def build_resources [] end |
#snapshot_resources ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/percy/capybara/loaders/native_loader.rb', line 28 def snapshot_resources resources = [] resources << root_html_resource resources += _get_css_resources resources += _get_image_resources resources += iframes_resources resources end |