Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(notebooks): wait for dashboard story trigger (#106892)

Matt Pua41f2a5a1cae3
diff --git a/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx
index 7c30c21453fa..ef17d4dcb92c 100644
--- a/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx
+++ b/products/notebooks/frontend/NotebookDashboardWidget/NotebookDashboardWidget.stories.tsx
@@ -209,9 +209,10 @@ export const AddToDashboard: Story = {
},
testOptions: { snapshotTargetSelector: 'body', viewportWidths: ['narrow', 'wide'] },
},
- play: async () => {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
const screen = within(document.body)
- await userEvent.click(screen.getByRole('button', { name: 'Add to dashboard' }))
+ await userEvent.click(await canvas.findByRole('button', { name: 'Add to dashboard' }))
await waitFor(() => {
expect(screen.getByRole('button', { name: 'Choose a dashboard' })).not.toHaveClass('LemonButton--loading')
})