mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
Release announcements: * https://www.ruby-lang.org/en/news/2025/07/24/ruby-3-2-9-released/ * https://www.ruby-lang.org/en/news/2025/03/26/ruby-3-2-8-released/ * https://www.ruby-lang.org/en/news/2025/02/04/ruby-3-2-7-released/ * https://www.ruby-lang.org/en/news/2024/10/30/ruby-3-2-6-released/ * https://www.ruby-lang.org/en/news/2024/07/26/ruby-3-2-5-released/ * https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-2-4-released/ * https://www.ruby-lang.org/en/news/2024/01/18/ruby-3-2-3-released/ * https://www.ruby-lang.org/en/news/2023/03/30/ruby-3-2-2-released/ * https://www.ruby-lang.org/en/news/2023/02/08/ruby-3-2-1-released/ * https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/ Also autocorrect new offenses.
30 lines
1.1 KiB
Ruby
30 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module CupriteHelpers
|
|
# Drop #pause anywhere in a test to stop the execution.
|
|
# Useful when you want to checkout the contents of a web page in the middle of a test
|
|
# running in a headful mode.
|
|
def pause
|
|
page.driver.pause
|
|
end
|
|
|
|
# Drop #debug anywhere in a test to open a Chrome inspector and pause the execution
|
|
def debug(*)
|
|
page.driver.debug(*)
|
|
end
|
|
|
|
# Use our `Capybara.save_path` to store screenshots with other capybara artifacts
|
|
# (Rails screenshots path is not configurable https://github.com/rails/rails/blob/49baf092439fc74fc3377b12e3334c3dd9d0752f/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb#L79)
|
|
def absolute_image_path
|
|
Rails.root.join("#{Capybara.save_path}/screenshots/#{image_name.parameterize}.png")
|
|
end
|
|
|
|
# Make failure screenshots compatible with multi-session setup.
|
|
# That's where we use Capybara.last_used_session introduced before.
|
|
def take_screenshot
|
|
return super unless Capybara.last_used_session
|
|
|
|
Capybara.using_session(Capybara.last_used_session) { super }
|
|
end
|
|
end
|