Skip to content

fix(dashboards): Wait for dashboard widget deletion to save - #126679

Merged
scttcper merged 1 commit into
masterfrom
scttcper/acceptance-request-teardown
Oct 7, 2026
Merged

scttcper merged 1 commit into
masterfrom
scttcper/acceptance-request-teardown

Conversation

@scttcper

@scttcper scttcper commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

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_mode deadlocks during database cleanup, then passes on retry. Locally confirmed the save/cleanup overlap, not the exact deadlock.

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
scttcper marked this pull request as ready for review October 7, 2026 17:13
@scttcper scttcper changed the title fix(tests): Wait for dashboard widget deletion to save fix(dashboards): Wait for dashboard widget deletion to save Oct 7, 2026
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')]")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Success toasts explicitly render role="status", so this selector is valid, and acceptance CI passed on this commit.

@scttcper
scttcper merged commit fb1ea7c into master Oct 7, 2026
69 checks passed
@scttcper
scttcper deleted the scttcper/acceptance-request-teardown branch October 7, 2026 18:03
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