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

84 lines
3.1 KiB
TypeScript

import { expect, test } from './utils/insights-playwright-test-base'
import { start } from './utils/setup'
import { createTour, mockProductToursApi } from './product-tours/utils'
import { Z_INDEX_TOURS, Z_INDEX_SURVEYS, Z_INDEX_CONVERSATIONS } from '@/constants'
const startOptions = {
options: {
disable_product_tours: false,
},
flagsResponseOverrides: {
surveys: true,
productTours: true,
},
url: './playground/cypress/index.html',
}
const survey = {
id: 'zindex-survey',
name: 'Z-index test survey',
type: 'popover' as const,
start_date: '2021-01-01T00:00:00Z',
questions: [{ type: 'open', question: 'Feedback?', id: 'q1' }],
}
test.describe('z-index hierarchy', () => {
test('tours have higher z-index than surveys, surveys higher than support', async ({ page, context }) => {
// Mock surveys API
const surveysRoute = page.route('**/surveys/**', async (route) => {
await route.fulfill({ json: { surveys: [survey] } })
})
// Mock product tours API
const tour = createTour({ id: 'zindex-tour' })
const toursRoute = mockProductToursApi(page, [tour])
await start(startOptions, page, context)
await surveysRoute
await toursRoute
// Wait for both to render
await expect(page.locator('.InsightsSurvey-zindex-survey .survey-form')).toBeVisible()
await expect(page.locator('.ph-product-tour-container-zindex-tour .ph-tour-tooltip')).toBeVisible()
// Enable conversations widget
await page.evaluate(() => {
const insights = (window as any).insights
if (insights?.conversations) {
insights.conversations.onRemoteConfig({
conversations: {
enabled: true,
token: 'test-token',
widgetEnabled: true,
},
})
}
})
// Wait for conversations widget to render (container has no dimensions, check for the button inside)
await expect(page.locator('#ph-conversations-widget-container button')).toBeVisible()
// Read computed z-index values
const tourZIndex = await page
.locator('.ph-product-tour-container-zindex-tour .ph-tour-tooltip')
.evaluate((el) => parseInt(getComputedStyle(el).zIndex, 10))
const surveyZIndex = await page
.locator('.InsightsSurvey-zindex-survey .survey-form')
.evaluate((el) => parseInt(getComputedStyle(el).zIndex, 10))
const conversationsZIndex = await page
.locator('#ph-conversations-widget-container > div')
.evaluate((el) => parseInt(getComputedStyle(el).zIndex, 10))
// Assert hierarchy: tours > surveys > support
expect(tourZIndex).toBeGreaterThan(surveyZIndex)
expect(surveyZIndex).toBeGreaterThan(conversationsZIndex)
// Assert exact values match constants
expect(tourZIndex).toBe(Z_INDEX_TOURS + 1) // tooltip is calc(base + 1)
expect(surveyZIndex).toBe(Z_INDEX_SURVEYS)
expect(conversationsZIndex).toBe(Z_INDEX_CONVERSATIONS)
})
})