Closed fotinakis closed 5 years ago
Sounds right. Let me know if you need help reproducing this. 👍
Temporarily fixed with custom loader workaround:
assets_dir = 'vendor/assets/bower_components/app-assets/dist/assets/images'
class CustomLoader < Percy::Capybara::Loaders::SprocketsLoader
def build_resources
resources = Percy::Capybara::Loaders::BaseLoader.new._resources_from_dir(
assets_dir,
base_url: '/assets',
)
super + resources
end
end
# Then, in spec_helper.rb:
Percy::Capybara.use_loader(CustomLoader)
I'm closing this issue as the new percy-capybara
4.x version does not use loaders and therefore avoids these issues 🎉
An upgrade guide from v3 to v4 is available for those interested in upgrading.
With this config:
Then image is then correctly referenced like:
For some reason, the Percy resource URL ends up being:
instead of:
so the images are broken in percy.
We use
ActionController::Base.helpers.asset_path
(https://github.com/percy/percy-capybara/blob/v3.0.2/lib/percy/capybara/loaders/sprockets_loader.rb#L50) to find the asset path, perhaps it is wrong in this case?