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 in helpers. That keeps threshold, min_cluster_size, full_page, build_id, and request_timeout available instead of accidentally dropping everything except properties.
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
propertiesfor variants like device, theme, or state. - Run through
vizzly runin CI when you want cloud results.