Module: Percy::Capybara
- Defined in:
- lib/percy/capybara.rb,
lib/percy/capybara/client.rb,
lib/percy/capybara/version.rb,
lib/percy/capybara/anywhere.rb,
lib/percy/capybara/httpfetcher.rb,
lib/percy/capybara/client/builds.rb,
lib/percy/capybara/client/snapshots.rb,
lib/percy/capybara/client/user_agent.rb,
lib/percy/capybara/loaders/base_loader.rb,
lib/percy/capybara/loaders/native_loader.rb,
lib/percy/capybara/loaders/sprockets_loader.rb,
lib/percy/capybara/loaders/filesystem_loader.rb,
lib/percy/capybara/loaders/ember_cli_rails_loader.rb
Defined Under Namespace
Modules: Anywhere, HttpFetcher, Loaders Classes: Client
Constant Summary collapse
- VERSION =
'3.1.2'.freeze
Class Method Summary collapse
- .capybara_client(options = {}) ⇒ Object
-
.disable! ⇒ Object
Manually disable Percy for the current capybara client.
-
.finalize_build ⇒ Object
Finalize the current build.
-
.initialize_build(options = {}) ⇒ Object
Creates a new build.
-
.reset! ⇒ Object
(also: reset)
Reset the global Percy::Capybara module state.
-
.snapshot(page, options = {}) ⇒ Object
Takes a snapshot of the given page HTML and its assets.
- .use_loader(loader, options = {}) ⇒ Object
Class Method Details
.capybara_client(options = {}) ⇒ Object
9 10 11 |
# File 'lib/percy/capybara.rb', line 9 def self.( = {}) @capybara_client ||= Percy::Capybara::Client.new() end |
.disable! ⇒ Object
Manually disable Percy for the current capybara client. This can also be done with the PERCY_ENABLE=0 environment variable.
52 53 54 |
# File 'lib/percy/capybara.rb', line 52 def self.disable! .disable! end |
.finalize_build ⇒ Object
Finalize the current build.
This must be called to indicate that the build is complete after all snapshots have been taken. It will silently return if no build or snapshots were created.
38 39 40 41 |
# File 'lib/percy/capybara.rb', line 38 def self.finalize_build return unless .build_initialized? .finalize_current_build end |
.initialize_build(options = {}) ⇒ Object
Creates a new build.
This usually does not need to be called explictly because the build is automatically created the first time a snapshot is created. However, this method might be useful in situations like multi-process tests where a single build must be created before forking.
28 29 30 |
# File 'lib/percy/capybara.rb', line 28 def self.initialize_build( = {}) .initialize_build() end |
.reset! ⇒ Object Also known as: reset
Reset the global Percy::Capybara module state.
44 45 46 |
# File 'lib/percy/capybara.rb', line 44 def self.reset! @capybara_client = nil end |
.snapshot(page, options = {}) ⇒ Object
17 18 19 |
# File 'lib/percy/capybara.rb', line 17 def self.snapshot(page, = {}) .snapshot(page, ) end |
.use_loader(loader, options = {}) ⇒ Object
56 57 58 |
# File 'lib/percy/capybara.rb', line 56 def self.use_loader(loader, = {}) (loader: loader, loader_options: ) end |