Module: Percy::Capybara::Bedrock::Anywhere
- Defined in:
- lib/percy/capybara/bedrock/anywhere.rb
Overview
Simple block runner for self-contained Capybara tests.
Usage:
Percy::::Bedrock::Anywhere.run(SERVER, WEB_ROOT, ASSETS_BASE_URL) do |page|
page.visit('/')
sleep(2)
Percy::.snapshot(page, name: 'main page')
end
Class Method Summary collapse
Class Method Details
.run(server, web_root, assets_base_url = nil) {|page| ... } ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/percy/capybara/bedrock/anywhere.rb', line 18 def self.run(server, web_root, assets_base_url = nil) if ENV['PERCY_TOKEN'].nil? raise 'Whoops! You need to setup the PERCY_TOKEN environment variable.' end ::.run_server = false ::.app_host = server page = ::::Session.new(:poltergeist) Percy::.use_loader(Loader, web_root: web_root, base_url: assets_base_url) build = Percy::.initialize_build yield(page) Percy::.finalize_build puts puts 'Done! Percy snapshots are now processing...' puts "--> #{build['data']['attributes']['web-url']}" end |