mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
106 lines
4.2 KiB
TypeScript
106 lines
4.2 KiB
TypeScript
import { Locator, Page, expect } from '@playwright/test'
|
|
|
|
import { TableHelper } from '../utils/table-helper'
|
|
|
|
export class PersonsPage {
|
|
readonly page: Page
|
|
|
|
readonly table: Locator
|
|
readonly searchInput: Locator
|
|
readonly tabs: Locator
|
|
readonly propertiesTab: Locator
|
|
readonly eventsTab: Locator
|
|
readonly cohortsTab: Locator
|
|
readonly addPropertyButton: Locator
|
|
readonly personDistinctId: Locator
|
|
readonly splitIdsButton: Locator
|
|
readonly deletePersonButton: Locator
|
|
|
|
constructor(page: Page) {
|
|
this.page = page
|
|
|
|
this.table = page.getByTestId('persons-table')
|
|
this.searchInput = page.getByTestId('persons-search')
|
|
this.tabs = page.getByTestId('persons-tabs')
|
|
this.propertiesTab = page.getByTestId('persons-properties-tab')
|
|
this.eventsTab = page.getByTestId('persons-events-tab')
|
|
this.cohortsTab = page.getByTestId('persons-cohorts-tab')
|
|
this.addPropertyButton = page.getByTestId('add-prop-button')
|
|
this.personDistinctId = page.getByTestId('person-distinct-id')
|
|
this.splitIdsButton = page.locator('[data-attr="merge-person-button"]')
|
|
this.deletePersonButton = page.locator('[data-attr="delete-person"]').first()
|
|
}
|
|
|
|
detailTable(): TableHelper {
|
|
return new TableHelper(this.page.locator('table').first())
|
|
}
|
|
|
|
async goToList(): Promise<void> {
|
|
await this.page.goto('/persons')
|
|
// Wait for the initial data load to complete (at least one person link visible)
|
|
await expect(this.table.getByRole('link').first()).toBeVisible()
|
|
}
|
|
|
|
async searchFor(query: string, expectedCount: number = 1): Promise<void> {
|
|
await this.searchInput.fill(query)
|
|
// Wait for the filtered results with an explicit timeout — the search involves
|
|
// a debounce + API round-trip that can be slow under CI load.
|
|
await expect(this.table.getByRole('link')).toHaveCount(expectedCount, { timeout: 30_000 })
|
|
}
|
|
|
|
async clickFirstPerson(): Promise<void> {
|
|
const link = this.table.getByRole('link').first()
|
|
const href = await link.getAttribute('href')
|
|
await this.page.goto(href!, { waitUntil: 'load' })
|
|
await expect(this.tabs).toBeVisible()
|
|
}
|
|
|
|
async clickNthPerson(n: number = 0): Promise<void> {
|
|
const link = this.table.getByRole('link').nth(n)
|
|
const href = await link.getAttribute('href')
|
|
await this.page.goto(href!, { waitUntil: 'load' })
|
|
await expect(this.tabs).toBeVisible()
|
|
}
|
|
|
|
async goToPropertiesTab(): Promise<void> {
|
|
await this.propertiesTab.click()
|
|
await expect(this.addPropertyButton).toBeVisible()
|
|
}
|
|
|
|
async goToEventsTab(): Promise<void> {
|
|
await this.eventsTab.click()
|
|
await expect(this.page.getByText('Select events')).toBeVisible()
|
|
}
|
|
|
|
async addProperty(key: string, value: string): Promise<void> {
|
|
await this.addPropertyButton.click()
|
|
await this.page.locator('#propertyKey').fill(key)
|
|
await this.page.locator('#propertyValue').fill(value)
|
|
await this.page.getByRole('button', { name: 'Save' }).click()
|
|
await expect(this.page.getByText('Person property added')).toBeVisible()
|
|
}
|
|
|
|
async deleteProperty(key: string): Promise<void> {
|
|
const propRow = this.page.locator('tr').filter({ hasText: key })
|
|
await propRow.getByTestId('delete-prop-button').click()
|
|
await expect(this.page.getByText('Are you sure you want to delete property')).toBeVisible()
|
|
await this.page.getByRole('button', { name: 'Delete' }).click()
|
|
await expect(this.page.getByText('Person property deleted')).toBeVisible()
|
|
}
|
|
|
|
async openSplitIdsModal(): Promise<void> {
|
|
await this.splitIdsButton.click()
|
|
await expect(this.page.getByText('This will split all Distinct IDs')).toBeVisible()
|
|
}
|
|
|
|
async openDeleteModal(): Promise<void> {
|
|
await this.deletePersonButton.click()
|
|
await expect(this.page.getByText('Are you sure you want to delete')).toBeVisible()
|
|
}
|
|
|
|
async cancelDeleteModal(): Promise<void> {
|
|
await this.page.locator('[data-attr="delete-person-cancel"]').click()
|
|
await expect(this.page.getByText('Are you sure you want to delete')).not.toBeVisible()
|
|
}
|
|
}
|