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(storybook): await object tags story mount before querying it (#108665)

Raúl Negrón-Oterodd1e371aa549
diff --git a/frontend/src/lib/components/ObjectTags/ObjectTags.stories.tsx b/frontend/src/lib/components/ObjectTags/ObjectTags.stories.tsx
index c938c0ddd339..d150f88760a8 100644
--- a/frontend/src/lib/components/ObjectTags/ObjectTags.stories.tsx
+++ b/frontend/src/lib/components/ObjectTags/ObjectTags.stories.tsx
@@ -43,11 +43,12 @@ export const EditableTagsInNarrowContainer: Story = {
</div>
),
play: async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
- const container = canvasElement.querySelector<HTMLElement>('[data-attr="narrow-tags-container"]')
+ const editButton = await within(canvasElement).findByText('Edit tags')
+ const container = editButton.closest<HTMLElement>('[data-attr="narrow-tags-container"]')
if (!container) {
throw new Error('Expected a narrow tags container')
}
- await userEvent.click(within(container).getByText('Edit tags'))
+ await userEvent.click(editButton)
await waitFor(() => {
const editor = container.querySelector<HTMLElement>('[data-attr="new-tag-input"]')
const editorBounds = editor?.getBoundingClientRect()