Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/acceptance/test_organization_dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def test_delete_widget_in_view_mode(self) -> None:
self.browser.element('[data-test-id="delete-widget"]').click()
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.

self.page.wait_until_loaded()
assert not DashboardWidget.objects.filter(id=existing_widget.id).exists()

def test_deleting_stacked_widgets_by_context_menu_does_not_trigger_confirm_on_edit_cancel(
self,
Expand Down
Loading