Harden move-between-pages and sidebar-scroll tests

These tests have been randomly failing on CI. I'm not entirely certain
why there is a race for these conditions. I'm not sure how
browser-ui-test waits when the document reloads on navigation.

There's also some javascript triggers that happen after the page loads,
and I don't remember if that runs before DOMContentLoaded.
This commit is contained in:
Eric Huss 2026-04-20 15:46:20 -07:00
parent c4efaffc1d
commit dc2fbde515
2 changed files with 20 additions and 19 deletions

View file

@ -3,41 +3,41 @@
go-to: |DOC_PATH| + "all-summary/index.html" go-to: |DOC_PATH| + "all-summary/index.html"
// default page is the first chapter // default page is the first chapter
assert-text: ("title", "Prefix 1 - all-summary") wait-for-text: ("title", "Prefix 1 - all-summary")
// Trying to move to the left beyond the prefix pages - nothing changes // Trying to move to the left beyond the prefix pages - nothing changes
press-key: 'ArrowLeft' press-key: 'ArrowLeft'
assert-text: ("title", "Prefix 1 - all-summary") wait-for-text: ("title", "Prefix 1 - all-summary")
// Move left // Move left
go-to: |DOC_PATH| + "all-summary/intro.html" go-to: |DOC_PATH| + "all-summary/intro.html"
assert-text: ("title", "Introduction - all-summary") wait-for-text: ("title", "Introduction - all-summary")
press-key: 'ArrowLeft' press-key: 'ArrowLeft'
assert-text: ("title", "Prefix 2 - all-summary") wait-for-text: ("title", "Prefix 2 - all-summary")
press-key: 'ArrowLeft' press-key: 'ArrowLeft'
assert-text: ("title", "Prefix 1 - all-summary") wait-for-text: ("title", "Prefix 1 - all-summary")
// Move right // Move right
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "Prefix 2 - all-summary") wait-for-text: ("title", "Prefix 2 - all-summary")
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "Introduction - all-summary") wait-for-text: ("title", "Introduction - all-summary")
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "P1 C1 - all-summary") wait-for-text: ("title", "P1 C1 - all-summary")
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "P2 C1 - all-summary") wait-for-text: ("title", "P2 C1 - all-summary")
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "Suffix 1 - all-summary") wait-for-text: ("title", "Suffix 1 - all-summary")
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "Suffix 2 - all-summary") wait-for-text: ("title", "Suffix 2 - all-summary")
// Try to go beyond the last page // Try to go beyond the last page
press-key: 'ArrowRight' press-key: 'ArrowRight'
assert-text: ("title", "Suffix 2 - all-summary") wait-for-text: ("title", "Suffix 2 - all-summary")

View file

@ -7,11 +7,11 @@ 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: (".sidebar-scrollbox", {"scrollTop": 0}) wait-for-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: (".sidebar-scrollbox", {"scrollTop": 0}) wait-for-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,7 +21,7 @@ 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: (".sidebar-scrollbox", {"scrollTop": 0}) wait-for-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.
@ -30,11 +30,12 @@ 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: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) wait-for-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"
assert-text: ("title", "Chapter 36 - sidebar-scroll") assert-text: ("title", "Chapter 36 - sidebar-scroll")
wait-for: ".chapter a.active"
// The active link should be roughly in the middle of the screen. // The active link should be roughly in the middle of the screen.
store-position: (".chapter a.active", {"y": active_y}) store-position: (".chapter a.active", {"y": active_y})
// Approximate check just in case the browser has slight rendering differences. // Approximate check just in case the browser has slight rendering differences.
@ -45,7 +46,7 @@ assert: |active_y| < 450
store-property: (".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: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) wait-for-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"
@ -57,9 +58,9 @@ assert: |scrollTop| >= |scrollHeight| - |clientHeight| - 1
store-property: (".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: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) wait-for-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})
store-property: (".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: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|}) wait-for-property: (".sidebar-scrollbox", {"scrollTop": |sidebarScrollTop|})