Repository navigation
fix(dashboards): Wait for dashboard widget deletion to save - #126679
Merged
Merged
Conversation
The widget disappears before the save request finishes, letting acceptance teardown flush the database while the request is still writing. Wait for the success toast and check that the widget was deleted. Co-Authored-By: Codex <noreply@openai.com>
scttcper
marked this pull request as ready for review
October 7, 2026 17:13
| self.browser.element('[data-test-id="confirm-button"]').click() | ||
|
|
||
| # The widget disappears optimistically, before the save finishes. | ||
| self.browser.wait_until(xpath="//*[@role='status'][contains(., 'Dashboard updated')]") |
Contributor
There was a problem hiding this comment.
Bug: The XPath selector used to find a toast notification is likely too restrictive and will cause the test to fail with a timeout.
Severity: MEDIUM
Suggested Fix
Update the XPath selector to match the one used in a similar, existing test. Change "//*[@role='status'][contains(., 'Dashboard updated')]" to "//*[contains(text(),'Dashboard updated')]" to ensure the toast notification element is found correctly.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: tests/acceptance/test_organization_dashboards.py#L142
Potential issue: The test waits for a toast notification using the XPath selector
`"//*[@role='status'][contains(., 'Dashboard updated')]"`. However, evidence from a
similar existing test suggests the toast element does not have the `role="status"`
attribute. The existing, working test uses the selector `"//*[contains(text(),'Dashboard
updated')]"`. If the new, more restrictive selector fails to find the element, the
`wait_until` call will raise a `TimeoutException`, causing the test to fail. This would
prevent the intended fix for a race condition from being validated.
Did we get this right? 👍 / 👎 to inform future reviews.
Member
Author
There was a problem hiding this comment.
Success toasts explicitly render role="status", so this selector is valid, and acceptance CI passed on this commit.
evanpurkhiser
approved these changes
Oct 7, 2026
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wait for the dashboard save and verify deletion before cleanup. The widget disappears optimistically, and the test currently passes even if the save fails.
CI example:
test_delete_widget_in_view_modedeadlocks during database cleanup, then passes on retry. Locally confirmed the save/cleanup overlap, not the exact deadlock.