248fc5d3e7
* test: update sign_in_as system test helper to be more generic and support fixture users with more than one board * test: backfill a test for the card "back link" when coming from a board filter page * Fix back navigation to filter views from cards When navigating from a filter view to a card, the back link now shows the filter's label and navigates back to the filter URL instead of the card's board. The turbo-navigation Stimulus controller stores the page title alongside the referrer URL in sessionStorage. On the card show page, a referrerBackLink target rewrites the back link's href and label from the stored values. This is scoped only to the card show page to avoid navigation loops in multi-level deep pages. * Add referrer allowlist to prevent stale referrer rewrites The back link is only rewritten when the stored referrer's path matches an allowlist of paths passed via prefer_referrer. This prevents stale referrers from unrelated pages (e.g., settings) from overriding the card's back link. * Move back link navigation tests to dedicated system test file Extract back link tests from smoke_test.rb into their own file since they test specific JavaScript behavior that needs regression coverage. Move sign_in_as helper to ApplicationSystemTestCase for reuse. * Move markdown paste tests to dedicated system test file
38 lines
1.4 KiB
Ruby
38 lines
1.4 KiB
Ruby
require "test_helper"
|
|
|
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|
browser_options = Selenium::WebDriver::Chrome::Options.new.tap do |opts|
|
|
opts.add_argument("--window-size=1200,800")
|
|
opts.add_argument("--disable-extensions")
|
|
# Disable non-foreground tabs from getting a lower process priority
|
|
opts.add_argument("--disable-renderer-backgrounding")
|
|
# Normally, Chrome will treat a 'foreground' tab instead as backgrounded if the surrounding
|
|
# window is occluded (aka visually covered) by another window. This flag disables that.
|
|
opts.add_argument("--disable-backgrounding-occluded-windows")
|
|
# Suppress all permission prompts by automatically denying them.
|
|
opts.add_argument("--deny-permission-prompts")
|
|
opts.add_argument("--enable-automation")
|
|
end
|
|
|
|
Capybara.register_driver :chrome_headless do |app|
|
|
browser_options.add_argument("--headless")
|
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
|
|
end
|
|
|
|
Capybara.register_driver :chrome do |app|
|
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
|
|
end
|
|
|
|
if ENV["SYSTEM_TESTS_BROWSER"]
|
|
driven_by :chrome, screen_size: [ 1200, 1000 ]
|
|
else
|
|
driven_by :chrome_headless, screen_size: [ 1200, 1000 ]
|
|
end
|
|
|
|
private
|
|
def sign_in_as(user)
|
|
visit session_transfer_url(user.identity.transfer_id, script_name: nil)
|
|
assert_current_path root_path
|
|
end
|
|
end
|