mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
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)
67 lines
2.4 KiB
TypeScript
67 lines
2.4 KiB
TypeScript
import {
|
|
assertAutocapturedEventsWorkAndAreAccessibleViaApi,
|
|
assertConfigOptionsChangeAutocaptureBehaviourAccordingly,
|
|
assertCustomEventsWorkAndAreAccessibleViaApi,
|
|
} from './checks'
|
|
import { test } from '../fixtures'
|
|
|
|
test.describe('ingestion', () => {
|
|
test.use({
|
|
url: '/playground/cypress-full/index.html',
|
|
insightsOptions: {
|
|
request_batching: false,
|
|
bootstrap: {
|
|
distinctID: 'automated-tester', // We set this to get around the ingestion delay for new distinctIDs
|
|
isIdentifiedID: true,
|
|
},
|
|
opt_out_useragent_filter: true,
|
|
},
|
|
mockIngestion: false,
|
|
})
|
|
|
|
test('Custom events work and are accessible via /api/event', async ({ page, events, insights, ingestion }) => {
|
|
await insights.init()
|
|
await events.waitForEvent('$pageview')
|
|
await page.click('[data-cy-custom-event-button]')
|
|
await events.waitForEvent('custom-event')
|
|
events.expectCountMap({
|
|
$pageview: 1,
|
|
$autocapture: 1,
|
|
'custom-event': 1,
|
|
})
|
|
await page.delay(1000)
|
|
ingestion.addSessionCheck(insights, 3, assertCustomEventsWorkAndAreAccessibleViaApi)
|
|
})
|
|
|
|
test('Autocaptured events work and are accessible via /api/event', async ({ page, events, insights, ingestion }) => {
|
|
await insights.init()
|
|
await page.delay(500)
|
|
await page.click('[data-cy-link-mask-text]')
|
|
await page.click('[data-cy-button-sensitive-attributes]')
|
|
await page.delay(1000)
|
|
events.expectCountMap({
|
|
$pageview: 1,
|
|
$autocapture: 2,
|
|
})
|
|
await page.delay(1000)
|
|
ingestion.addSessionCheck(insights, 3, assertAutocapturedEventsWorkAndAreAccessibleViaApi)
|
|
})
|
|
|
|
test('Config options change autocapture behavior accordingly', async ({ page, insights, events, ingestion }) => {
|
|
await insights.init({
|
|
mask_all_text: true,
|
|
mask_all_element_attributes: true,
|
|
})
|
|
await page.delay(500)
|
|
await page.click('[data-cy-link-mask-text]')
|
|
await page.click('[data-cy-button-sensitive-attributes]')
|
|
await page.delay(1000)
|
|
events.expectCountMap({
|
|
$pageview: 1,
|
|
$autocapture: 2,
|
|
})
|
|
await page.delay(1000)
|
|
ingestion.addSessionCheck(insights, 3, assertConfigOptionsChangeAutocaptureBehaviourAccordingly)
|
|
})
|
|
})
|