$ cd /path/to/bedrock
$ bundle add percy-capybara-bedrock
Define your tests
# <bedrock>/percy.rb
require "percy/capybara/bedrock/anywhere"
# URL pointing to the local or remote host
server = "http://localhost:8080"
# Absolute path to a web root directory
web_root = File.expand_path("../web/", __FILE__)
# Path where your webserver hosts the WordPress site
assets_base_url = "/"
Percy::Capybara::Bedrock::Anywhere.run(server, web_root, assets_base_url) do|page|
page.visit("/")
sleep(2)
Percy::Capybara.snapshot(page, name:"Homepage")
end
Where/how did you place your percy settings files? I placed my in the top dir. percy, site, trellis
Do you see any issues with this setup?
# <bedrock>/percy.rb
require "percy/capybara/bedrock/anywhere"
# URL pointing to the local or remote host
server = "http://my-site.test"
# Absolute path to a web root directory
web_root = File.expand_path("../../site/web", __FILE__)
# Path where your webserver hosts the WordPress site
assets_base_url = ""
# Capybara.register_driver :poltergeist do |app|
# Capybara::Poltergeist::Driver.new(app, {js_errors: false})
# end
Percy::Capybara::Bedrock::Anywhere.run(server, web_root, assets_base_url) do|page|
page.visit("/")
sleep(3)
Percy::Capybara.snapshot(page, name:"Homepage")
end
As long as web_root is pointing to the correct folder, where to put percy.rb and Gemfile (or gems.rb) doesn’t matter.
It’s up to you to organize your code.