Defect #43143 » 0002-Add-system-test-for-Edit-heading-visibility.patch
| test/system/sticky_issue_header_test.rb | ||
|---|---|---|
| 35 | 35 |
page.execute_script("window.scrollTo(0, 0)")
|
| 36 | 36 |
assert_no_selector "#sticky-issue-header", text: issue.subject |
| 37 | 37 |
end |
| 38 | ||
| 39 |
test "edit heading is not hidden behind sticky header when edit link is clicked" do |
|
| 40 |
log_user('jsmith', 'jsmith')
|
|
| 41 |
issue = Issue.find(1) |
|
| 42 |
visit issue_path(issue) |
|
| 43 | ||
| 44 |
click_link 'Edit', match: :first |
|
| 45 | ||
| 46 |
sleep 0.5 # Wait for scrolling to complete |
|
| 47 |
assert_selector "#sticky-issue-header.is-visible", visible: true |
|
| 48 |
assert_selector 'h3', text: 'Edit', visible: true |
|
| 49 | ||
| 50 |
# More strictly check whether the Edit heading is visually accessible using JavaScript |
|
| 51 |
is_edit_heading_visible_to_user = page.evaluate_script(<<~JS) |
|
| 52 |
(function() {
|
|
| 53 |
const stickyIssueHeader = document.querySelector('#sticky-issue-header');
|
|
| 54 |
const editHeading = document.querySelector("#update > h3");
|
|
| 55 |
return stickyIssueHeader.getBoundingClientRect().bottom < editHeading.getBoundingClientRect().top; |
|
| 56 |
})(); |
|
| 57 |
JS |
|
| 58 |
assert is_edit_heading_visible_to_user, "Edit heading is visually covered by the sticky header" |
|
| 59 |
end |
|
| 38 | 60 |
end |