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.

chore(growth): stabilize scoring story snapshots (#108005)

Raúl Negrón-Otero06872a78fbbf
diff --git a/products/growth/frontend/aiEnrichment/EnrichmentScoring.stories.tsx b/products/growth/frontend/aiEnrichment/EnrichmentScoring.stories.tsx
index b72eb0cc3453..454555b2c9d5 100644
--- a/products/growth/frontend/aiEnrichment/EnrichmentScoring.stories.tsx
+++ b/products/growth/frontend/aiEnrichment/EnrichmentScoring.stories.tsx
@@ -1,5 +1,5 @@
import { Meta, StoryObj } from '@storybook/react'
-import { within } from '@testing-library/react'
+import { waitFor, within } from '@testing-library/react'
import { mswDecorator } from '~/mocks/browser'
@@ -76,10 +76,20 @@ type Story = StoryObj<typeof meta>
export const Editor: Story = {}
export const TenCompanies: Story = {
- play: async ({ canvasElement }) => {
+ play: async ({ canvasElement }): Promise<void> => {
const canvas = within(canvasElement)
- const previewButton = await canvas.findByText('Test 10 companies')
+ const previewButton = await canvas.findByRole('button', { name: 'Test 10 companies' })
+ await waitFor(() => {
+ if (canvasElement.querySelector('.CodeEditor')?.getAttribute('data-editor-ready') !== 'true') {
+ throw new Error('Scoring editor is not ready')
+ }
+ })
enrichmentScoringLogic.actions.setSource(CONFIG.source.replace("'b2b', 10", "'b2b', 15"))
+ await waitFor(() => {
+ if (!/'b2b',\s*15,\s*0/.test(canvasElement.querySelector('.view-lines')?.textContent ?? '')) {
+ throw new Error('Edited scoring formula is not visible')
+ }
+ })
previewButton.click()
await canvas.findByText('Example company 10')
},