Files
zeekay e43ab1afe7 chore: rename all PostHog references to Insights/Hanzo
Bulk rename across 989 files:
- Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc.
- Repository URLs: posthog/posthog-js → hanzoai/insights-js
- Brand names: PostHog → Insights
- File renames: 259 reference JSON files, source files, workflow files
- Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights

Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
2026-03-06 01:41:12 -08:00

86 lines
3.0 KiB
TypeScript

import { expect, test } from '../utils/insights-playwright-test-base'
import { start } from '../utils/setup'
const startOptions = {
options: {},
flagsResponseOverrides: {
surveys: true,
},
url: './playground/cypress/index.html',
}
const emojiRatingQuestion = {
type: 'rating',
display: 'emoji',
scale: 5,
question: 'How happy are you with your purchase?',
optional: true,
id: 'emoji_rating_1',
}
const appearanceWithThanks = {
displayThankYouMessage: true,
thankyouMessageHeader: 'Thanks!',
thankyouMessageBody: 'We appreciate your feedback.',
}
test.describe('surveys - feedback widget', () => {
test('shows confirmation message after submitting', async ({ page, context }) => {
const surveysAPICall = page.route('**/surveys/**', async (route) => {
await route.fulfill({
json: {
surveys: [
{
id: '123',
name: 'Test survey',
type: 'popover',
start_date: '2021-01-01T00:00:00Z',
questions: [emojiRatingQuestion],
appearance: { ...appearanceWithThanks, backgroundColor: 'black' },
},
],
},
})
})
await start(startOptions, page, context)
await surveysAPICall
await expect(page.locator('.InsightsSurvey-123 .ratings-emoji')).toHaveCount(5)
await page.locator('.InsightsSurvey-123 .ratings-emoji').first().click()
await page.locator('.InsightsSurvey-123 .form-submit').click()
await expect(page.locator('.InsightsSurvey-123 .thank-you-message')).toBeVisible()
})
test('counts down with auto disappear after 5 seconds', async ({ page, context }) => {
const surveysAPICall = page.route('**/surveys/**', async (route) => {
await route.fulfill({
json: {
surveys: [
{
id: '123',
name: 'Test survey',
type: 'popover',
start_date: '2021-01-01T00:00:00Z',
questions: [emojiRatingQuestion],
appearance: { ...appearanceWithThanks, autoDisappear: true },
},
],
},
})
})
await start(startOptions, page, context)
await surveysAPICall
await expect(page.locator('.InsightsSurvey-123 .ratings-emoji')).toHaveCount(5)
await page.locator('.InsightsSurvey-123 .ratings-emoji').first().click()
await page.locator('.InsightsSurvey-123 .form-submit').click()
await expect(page.locator('.InsightsSurvey-123 .thank-you-message')).toBeVisible()
await page.waitForTimeout(5000)
await expect(page.locator('.InsightsSurvey-123 .thank-you-message')).not.toBeVisible()
})
})