Skip to content

test(modal): add sanity check for flaky test in CI#6142

Closed
TomJGooding wants to merge 3 commits into
Textualize:mainfrom
TomJGooding:test-modal-flaky-test-redux-redux
Closed

test(modal): add sanity check for flaky test in CI#6142
TomJGooding wants to merge 3 commits into
Textualize:mainfrom
TomJGooding:test-modal-flaky-test-redux-redux

Conversation

@TomJGooding

@TomJGooding TomJGooding commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

Note that the test will even fail locally with this change instead:

-        footer_key_clicked = await pilot.mouse_down("FooterKey")
+        footer_key_clicked = await pilot.click("FooterKey")
         assert footer_key_clicked is True  # Sanity check
         await pilot.pause()
>           assert footer_key_clicked is True  # Sanity check
E           assert False is True

Since the footer reacts to mouse down, when the click has finished on mouse up the screen is now the modal screen.

@TomJGooding

TomJGooding commented Sep 29, 2025

Copy link
Copy Markdown
Contributor Author

And fails in CI with this change:

-        await pilot.pause(0.4)
+        await pilot.pause()
FAILED tests/test_modal.py::test_modal_pop_screen - textual.css.query.NoMatches: No nodes match 'FooterKey' on Screen(id='_default')

@TomJGooding TomJGooding marked this pull request as ready for review September 29, 2025 11:57
@TomJGooding

Copy link
Copy Markdown
Contributor Author

Maybe there is a better fix, but this should hopefully unblock for the time being and at least the sanity check will help debug if the footer key is actually clicked.

@willmcgugan

Copy link
Copy Markdown
Member

Going with the other branch. Although the fix isn't all that satisfactory, it avoids the arbitrary sleep which is often a red flag and addresses some genuine issues.

@TomJGooding TomJGooding deleted the test-modal-flaky-test-redux-redux branch October 6, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants