fix(gui): use class selectors for sidebar-scrollbox in GUI tests

Fixes CI failure in sidebar-scroll.goml where mdbook-sidebar-scrollbox custom element not found (timing issue in headless Linux Chrome). The class is always present in generated HTML (<mdbook-sidebar-scrollbox class="sidebar-scrollbox">).
This commit is contained in:
Jonathan Hult 2026-03-10 20:37:34 -05:00
parent 30e0e1d102
commit edf704aa4d
No known key found for this signature in database
GPG key ID: 3512C8F82E2F2A16
2 changed files with 18 additions and 18 deletions

View file

@ -2,16 +2,16 @@
go-to: |DOC_PATH| + "all-summary/index.html" go-to: |DOC_PATH| + "all-summary/index.html"
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1") assert-text: (".sidebar-scrollbox a.active", "Prefix 1")
go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html" go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html"
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1") assert-text: (".sidebar-scrollbox a.active", "3. P1 C1")
go-to: |DOC_PATH| + "all-summary/index.html?highlight=test" go-to: |DOC_PATH| + "all-summary/index.html?highlight=test"
assert-text: ("mdbook-sidebar-scrollbox a.active", "Prefix 1") assert-text: (".sidebar-scrollbox a.active", "Prefix 1")
go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html?highlight=test" go-to: |DOC_PATH| + "all-summary/part-1/chapter-1.html?highlight=test"
assert-text: ("mdbook-sidebar-scrollbox a.active", "3. P1 C1") assert-text: (".sidebar-scrollbox a.active", "3. P1 C1")

View file

@ -3,15 +3,15 @@
store-value: (windowHeight, 900) store-value: (windowHeight, 900)
set-window-size: (1200, |windowHeight|) set-window-size: (1200, |windowHeight|)
go-to: |DOC_PATH| + "sidebar-scroll/index.html" go-to: |DOC_PATH| + "sidebar-scroll/index.html"
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0}) assert-property: (".sidebar-scrollbox", {"scrollTop": 0})
click: ".chapter a[href='chapter_2.html']" click: ".chapter a[href='chapter_2.html']"
assert-text: ("title", "Chapter 2 - sidebar-scroll") assert-text: ("title", "Chapter 2 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0}) assert-property: (".sidebar-scrollbox", {"scrollTop": 0})
click: ".chapter a[href='chapter_10.html']" click: ".chapter a[href='chapter_10.html']"
assert-text: ("title", "Chapter 10 - sidebar-scroll") assert-text: ("title", "Chapter 10 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0}) assert-property: (".sidebar-scrollbox", {"scrollTop": 0})
// Check that heading nav of chapter 10 pushes 11 off the bottom. // Check that heading nav of chapter 10 pushes 11 off the bottom.
store-position: (".chapter a[href='chapter_11.html']", {"y": chapter_y}) store-position: (".chapter a[href='chapter_11.html']", {"y": chapter_y})
@ -21,16 +21,16 @@ assert: |chapter_y| > |windowHeight|
// in position since there are only a few lines above. // in position since there are only a few lines above.
click: ".chapter a[href='chapter_11.html']" click: ".chapter a[href='chapter_11.html']"
assert-text: ("title", "Chapter 11 - sidebar-scroll") assert-text: ("title", "Chapter 11 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": 0}) assert-property: (".sidebar-scrollbox", {"scrollTop": 0})
// Scroll down a little, and click on a chapter that can stay in place when // Scroll down a little, and click on a chapter that can stay in place when
// clicked. // clicked.
scroll-element-to: ("mdbook-sidebar-scrollbox", (0, 230)) scroll-element-to: (".sidebar-scrollbox", (0, 230))
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop}) store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
assert: |sidebarScrollTop| > 0 assert: |sidebarScrollTop| > 0
click: ".chapter a[href='chapter_35.html']" click: ".chapter a[href='chapter_35.html']"
assert-text: ("title", "Chapter 35 - sidebar-scroll") assert-text: ("title", "Chapter 35 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
// Go to the next chapter, and verify that it scrolls to the middle. // Go to the next chapter, and verify that it scrolls to the middle.
press-key: "ArrowRight" press-key: "ArrowRight"
@ -42,24 +42,24 @@ assert: |active_y| > 400
assert: |active_y| < 450 assert: |active_y| < 450
// Go to something near the top, it shouldn't scroll. // Go to something near the top, it shouldn't scroll.
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop}) store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_24.html']" click: ".chapter a[href='chapter_24.html']"
assert-text: ("title", "Chapter 24 - sidebar-scroll") assert-text: ("title", "Chapter 24 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
// Go to the last chapter, and verify it is scrolled to the bottom. // Go to the last chapter, and verify it is scrolled to the bottom.
go-to: |DOC_PATH| + "sidebar-scroll/chapter_100.html" go-to: |DOC_PATH| + "sidebar-scroll/chapter_100.html"
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": scrollTop, "scrollHeight": scrollHeight, "clientHeight": clientHeight}) store-property: (".sidebar-scrollbox", {"scrollTop": scrollTop, "scrollHeight": scrollHeight, "clientHeight": clientHeight})
// This needs to be approximate since there is a slight difference. // This needs to be approximate since there is a slight difference.
assert: |scrollTop| >= |scrollHeight| - |clientHeight| - 1 assert: |scrollTop| >= |scrollHeight| - |clientHeight| - 1
// Clicking upwards shouldn't scroll. // Clicking upwards shouldn't scroll.
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop}) store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_97.html']" click: ".chapter a[href='chapter_97.html']"
assert-text: ("title", "Chapter 97 - sidebar-scroll") assert-text: ("title", "Chapter 97 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
store-property: ("mdbook-sidebar-scrollbox", {"scrollTop": sidebarScrollTop}) store-property: (".sidebar-scrollbox", {"scrollTop": sidebarScrollTop})
click: ".chapter a[href='chapter_76.html']" click: ".chapter a[href='chapter_76.html']"
assert-text: ("title", "Chapter 76 - sidebar-scroll") assert-text: ("title", "Chapter 76 - sidebar-scroll")
assert-property: ("mdbook-sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) assert-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})