Skip to content

test(modal): change click to mouse down in flaky test#6131

Closed
TomJGooding wants to merge 1 commit into
Textualize:mainfrom
TomJGooding:test-modal-flaky-test-redux
Closed

test(modal): change click to mouse down in flaky test#6131
TomJGooding wants to merge 1 commit into
Textualize:mainfrom
TomJGooding:test-modal-flaky-test-redux

Conversation

@TomJGooding

Copy link
Copy Markdown
Contributor

test_modal_pop_screen() is apparently still flaky in CI even after increasing the pauses in #6116.

Try changing the Footer click to mouse_down instead to avoid the NoWidget error in the pilot mouse events.

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

`test_modal_pop_screen()` is apparently still flaky in CI even after
increasing the pauses in #6116.

Try changing the Footer `click` to `mouse_down` instead to avoid the
`NoWidget` error in the pilot mouse events.
@TomJGooding TomJGooding marked this pull request as ready for review September 22, 2025 11:41
Comment thread tests/test_modal.py
await app.wait_for_refresh()
# Check clicking the footer brings up the quit screen
await pilot.click(Footer)
await pilot.mouse_down(Footer)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this change the nature of the test significantly? IIRC a click occurs on mouse up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch that. I see that the Footer reacts to MouseDown, not Click.

@willmcgugan

Copy link
Copy Markdown
Member

I'm hoping that #6137 will provide a better solution to avoiding jank in the footer that doesn't introduce flakiness to the tests.

@willmcgugan

Copy link
Copy Markdown
Member

I think #6137 resolves this.

@TomJGooding

Copy link
Copy Markdown
Contributor Author

My thinking is that the NoWidget error is actually on the mouse up, rather than the mouse down of the click, since now the screen is the modal screen.

@TomJGooding

TomJGooding commented Sep 29, 2025

Copy link
Copy Markdown
Contributor Author

@willmcgugan Since this still doesn't look fixed, can I suggest at least trying this?

[EDIT: Exploring this in new PR #6142]

    async with app.run_test() as pilot:
        # Pause to ensure the footer is fully composed to avoid flakiness in CI
        await pilot.pause(0.4)
        await app.wait_for_refresh()
        # Check clicking the footer brings up the quit screen
        footer_key_clicked = await pilot.mouse_down("FooterKey")
        assert footer_key_clicked is True # Sanity check
        await pilot.pause()
        assert isinstance(pilot.app.screen, QuitScreen)

@TomJGooding TomJGooding deleted the test-modal-flaky-test-redux branch October 6, 2025 14:27
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