mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
23 lines
735 B
TypeScript
23 lines
735 B
TypeScript
import { Page } from '@playwright/test'
|
|
|
|
export function randomString(prefix = ''): string {
|
|
const id = Math.floor(Math.random() * 1e6)
|
|
return `${prefix}-${id}`
|
|
}
|
|
|
|
export async function getSwitchValue(page: Page, label: string): Promise<boolean | null> {
|
|
const button = page.getByLabel(label)
|
|
const parent = button.locator('..')
|
|
const classNames = await parent.getAttribute('class')
|
|
return classNames?.includes('Switch--checked') || null
|
|
}
|
|
|
|
export async function setSwitchValue(page: Page, label: string, value: boolean): Promise<void> {
|
|
const button = page.getByLabel(label)
|
|
const currentValue = await getSwitchValue(page, label)
|
|
|
|
if (value !== currentValue) {
|
|
await button.click()
|
|
}
|
|
}
|