Merge pull request #3074 from ehuss/fix-flaky-gui

Fix flaky gui tests
This commit is contained in:
Eric Huss 2026-04-21 01:56:02 +00:00 committed by GitHub
commit 2bad8058fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 44 deletions

View file

@ -9,38 +9,39 @@ assert-text: (".current-header", "Heading 1")
// Collapsed elements do not have "expanded" class. // Collapsed elements do not have "expanded" class.
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"}) assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"})
assert-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "none"})
assert-property: ("div.on-this-page", {"innerHTML": '<ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-1" class="header-in-summary current-header">Heading 1</a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-11" class="header-in-summary">Heading 1.1</a></span></li><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-12" class="header-in-summary">Heading 1.2</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-121" class="header-in-summary">Heading 1.2.1</a></span></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-122" class="header-in-summary">Heading 1.2.2</a></span></li></ol></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-13" class="header-in-summary">Heading 1.3</a></span></li></ol></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-2" class="header-in-summary">Heading 2</a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-21" class="header-in-summary">Heading 2.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-211" class="header-in-summary">Heading 2.1.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-2111" class="header-in-summary">Heading 2.1.1.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-21111" class="header-in-summary">Heading 2.1.1.1.1</a></span></li></ol></li></ol></li></ol></li></ol></li></ol>'}) assert-property: ("div.on-this-page", {"innerHTML": '<ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-1" class="header-in-summary current-header">Heading 1</a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-11" class="header-in-summary">Heading 1.1</a></span></li><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-12" class="header-in-summary">Heading 1.2</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-121" class="header-in-summary">Heading 1.2.1</a></span></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-122" class="header-in-summary">Heading 1.2.2</a></span></li></ol></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-13" class="header-in-summary">Heading 1.3</a></span></li></ol></li><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-2" class="header-in-summary">Heading 2</a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-21" class="header-in-summary">Heading 2.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-211" class="header-in-summary">Heading 2.1.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item"><span class="chapter-link-wrapper"><a href="#heading-2111" class="header-in-summary">Heading 2.1.1.1</a><a class="chapter-fold-toggle header-toggle"><div>❱</div></a></span><ol class="section"><li class="header-item expanded"><span class="chapter-link-wrapper"><a href="#heading-21111" class="header-in-summary">Heading 2.1.1.1.1</a></span></li></ol></li></ol></li></ol></li></ol></li></ol>'})
// Click 1.2, expands it. // Click 1.2, expands it.
click: "a.header-in-summary[href='#heading-12']" click: "a.header-in-summary[href='#heading-12']"
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item expanded"}) wait-for-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item expanded"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "block"}) wait-for-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "block"})
// Click 1.1, should collapse it. // Click 1.1, should collapse it.
click: "a.header-in-summary[href='#heading-11']" click: "a.header-in-summary[href='#heading-11']"
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"}) wait-for-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"})
// Click the chevron, should expand it. // Click the chevron, should expand it.
click: "a.header-in-summary[href='#heading-12'] ~ a.header-toggle" click: "a.header-in-summary[href='#heading-12'] ~ a.header-toggle"
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item expanded"}) wait-for-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item expanded"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "block"}) wait-for-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "block"})
assert-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "none"})
// Click 1.3 // Click 1.3
click: "a.header-in-summary[href='#heading-13']" click: "a.header-in-summary[href='#heading-13']"
// Everything should be collapsed // Everything should be collapsed
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"}) wait-for-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"})
assert-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "none"}) wait-for-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "none"})
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-211'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-2111'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-211'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-2111'])", {"class": "header-item"})
// Scroll to bottom of page // Scroll to bottom of page
press-key: 'PageDown' press-key: 'PageDown'
@ -48,11 +49,11 @@ press-key: 'PageDown'
press-key: 'PageDown' press-key: 'PageDown'
press-key: 'PageDown' press-key: 'PageDown'
// 2.1.1.1.1 should be visible, and all the chevrons should be open, and expanded should be on each one // 2.1.1.1.1 should be visible, and all the chevrons should be open, and expanded should be on each one
assert-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"}) wait-for-attribute: ("li:has(> span > a[href='#heading-12'])", {"class": "header-item"})
assert-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item expanded"}) wait-for-attribute: ("li:has(> span > a[href='#heading-21'])", {"class": "header-item expanded"})
assert-attribute: ("li:has(> span > a[href='#heading-211'])", {"class": "header-item expanded"}) wait-for-attribute: ("li:has(> span > a[href='#heading-211'])", {"class": "header-item expanded"})
assert-attribute: ("li:has(> span > a[href='#heading-2111'])", {"class": "header-item expanded"}) wait-for-attribute: ("li:has(> span > a[href='#heading-2111'])", {"class": "header-item expanded"})
assert-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"}) wait-for-css: ("//a[@href='#heading-12']/../following-sibling::ol", {"display": "none"})
assert-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "block"}) wait-for-css: ("//a[@href='#heading-21']/../following-sibling::ol", {"display": "block"})
assert-css: ("//a[@href='#heading-211']/../following-sibling::ol", {"display": "block"}) wait-for-css: ("//a[@href='#heading-211']/../following-sibling::ol", {"display": "block"})
assert-css: ("//a[@href='#heading-2111']/../following-sibling::ol", {"display": "block"}) wait-for-css: ("//a[@href='#heading-2111']/../following-sibling::ol", {"display": "block"})

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|})