Ruby test framework integration
RSpec with Capybara
require 'vizzly'
RSpec.describe 'Homepage', type: :feature do it 'renders correctly' do visit '/'
image_data = page.driver.browser.screenshot_as(:png)
Vizzly.screenshot('homepage', image_data, properties: { browser: Capybara.current_driver.to_s } ) endendHelper module
module VizzlyHelpers def capture_screenshot(name, **options) image_data = page.driver.browser.screenshot_as(:png)
Vizzly.screenshot(name, image_data, **options) endendForward the full options hash so callers can still set comparison options and request timeouts.
Minitest
image_data = page.driver.browser.screenshot_as(:png)Vizzly.screenshot('dashboard', image_data)Cucumber
When('I capture a screenshot named {string}') do |name| image_data = page.driver.browser.screenshot_as(:png) Vizzly.screenshot(name, image_data)endGood habits
- Use stable screenshot names.
- Add variant metadata in
propertiesand configure those keys for baseline matching. - Run through
vizzly runin CI when you want cloud results.