Wait for the Habits table scene's tables before reading its habits

This commit is contained in:
waozi committed 2026-10-23 02:24:11 -03:00
1 parent a18cba0561
commit 1306dadcb0
1 file changed
+12 -3
+12 -3
View File
@@ -203,10 +203,19 @@ with contextlib.ExitStack() as stack:
return driver.wait(contains="Inactive habits", role="button")
screen_pixels = [411, 760]
def seeded_order():
"""The habits' order once the scene has created and seeded its tables."""
try:
return order()
except sqlite3.OperationalError:
return ""
# The screenshot scene seeds its habits after the window and database
# appear; wait for the seed instead of assuming a fixed startup time.
wait_for(lambda: database.exists() and order() == ORDER,
lambda: f"initial order: got {order()!r}, expected {ORDER!r}")
# appear, and the file exists before its tables do; wait for the seed
# instead of assuming a fixed startup time.
wait_for(lambda: database.exists() and seeded_order() == ORDER,
lambda: f"initial order: got {seeded_order()!r}, expected {ORDER!r}")
driver.wait(contains="Inactive habits", role="button")
# Opening a habit's details or the inactive habits never makes a scrollbar