From a56c55a6285d934ec341fe1bcde95772eb0fecb7 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 11 Sep 2025 04:07:18 +0000 Subject: [PATCH] Add system test for Edit heading visibility (#42684, #43143). Patch by Mizuki ISHIKAWA (user:ishikawa999). git-svn-id: https://svn.redmine.org/redmine/trunk@23971 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/system/sticky_issue_header_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/system/sticky_issue_header_test.rb b/test/system/sticky_issue_header_test.rb index 5c67b36f3..c4fcf449b 100644 --- a/test/system/sticky_issue_header_test.rb +++ b/test/system/sticky_issue_header_test.rb @@ -35,4 +35,26 @@ class StickyIssueHeaderSystemTest < ApplicationSystemTestCase page.execute_script("window.scrollTo(0, 0)") assert_no_selector "#sticky-issue-header", text: issue.subject end + + test "edit heading is not hidden behind sticky header when edit link is clicked" do + log_user('jsmith', 'jsmith') + issue = Issue.find(1) + visit issue_path(issue) + + click_link 'Edit', match: :first + + sleep 0.5 # Wait for scrolling to complete + assert_selector "#sticky-issue-header.is-visible", visible: true + assert_selector 'h3', text: 'Edit', visible: true + + # More strictly check whether the Edit heading is visually accessible using JavaScript + is_edit_heading_visible_to_user = page.evaluate_script(<<~JS) + (function() { + const stickyIssueHeader = document.querySelector('#sticky-issue-header'); + const editHeading = document.querySelector("#update > h3"); + return stickyIssueHeader.getBoundingClientRect().bottom < editHeading.getBoundingClientRect().top; + })(); + JS + assert is_edit_heading_visible_to_user, "Edit heading is visually covered by the sticky header" + end end