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
This commit is contained in:
Go MAEDA
2025-09-11 04:07:18 +00:00
parent e1129f237d
commit a56c55a628

View File

@@ -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