mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-30 14:58:08 +00:00
59 lines
2.3 KiB
TypeScript
59 lines
2.3 KiB
TypeScript
import { test, expect, type Page } from '@playwright/test'
|
||
import { serveExport } from './export'
|
||
import { signIn, answer } from '../session'
|
||
|
||
/**
|
||
* THE COMPOSER HAS NO LEGAL FOOT.
|
||
*
|
||
* A free model's data-share choice is made once, at onboarding. Chat does not
|
||
* repeat it under the composer, on the free lane or the paid one. Both
|
||
* directions are asserted, because a line that renders on only one of them
|
||
* would still be a footer.
|
||
*/
|
||
const FREE = { data: [{ id: 'free' }] }
|
||
const PAID = { data: [{ id: 'qwen3-coder' }] }
|
||
|
||
const room = (page: Page) => page.locator('main')
|
||
|
||
test('a signed-in reader on the free lane sees the room and no note under the composer', async ({ page }) => {
|
||
await signIn(page)
|
||
await answer(page, '/v1/models', FREE)
|
||
const site = await serveExport()
|
||
try {
|
||
await page.setViewportSize({ width: 1440, height: 900 })
|
||
await page.goto(`${site.url}/chat`)
|
||
const main = room(page)
|
||
await expect(main).toContainText(/What can I help with\?|What’s up/, { timeout: 20_000 })
|
||
const said = await main.innerText()
|
||
expect(said, 'no free-lane footer').not.toContain('Free chat is data-shared')
|
||
expect(said, 'no caution over the composer').not.toContain('can make mistakes')
|
||
expect(said, 'no banner over the room').not.toContain('may be used to improve models')
|
||
await expect(main.getByRole('link', { name: 'Privacy' })).toHaveCount(0)
|
||
await expect(main.getByRole('link', { name: 'Terms' })).toHaveCount(0)
|
||
} finally {
|
||
await site.close()
|
||
}
|
||
})
|
||
|
||
test('a paid route has the same empty foot', async ({ page }) => {
|
||
await signIn(page)
|
||
await answer(page, '/v1/models', PAID)
|
||
const site = await serveExport()
|
||
try {
|
||
await page.setViewportSize({ width: 1440, height: 900 })
|
||
await page.goto(`${site.url}/chat`)
|
||
|
||
// Wait for the room before reading its absence, or this passes on an empty
|
||
// page — the failure every "must not contain" assertion invites.
|
||
const main = room(page)
|
||
await expect(main).toContainText(/What can I help with\?|What’s up/, { timeout: 20_000 })
|
||
expect(await main.innerText(), 'a paid route claims its messages are shared').not.toContain(
|
||
'Free chat is data-shared',
|
||
)
|
||
await expect(main.getByRole('link', { name: 'Terms' })).toHaveCount(0)
|
||
await expect(main.getByRole('link', { name: 'Privacy' })).toHaveCount(0)
|
||
} finally {
|
||
await site.close()
|
||
}
|
||
})
|