mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { NEXT, NOW } from '../../lib/zen'
|
|
import { serveExport } from './export'
|
|
|
|
/**
|
|
* THE MODEL IN RESEARCH PREVIEW IS LISTED, AND IT IS NOT A WAY IN.
|
|
*
|
|
* /models and /zen draw the next Zen generation beside the one that
|
|
* answers: muted, not a link to a page or a playground, saying it is a
|
|
* research preview, with one action — asking for access — which lands on
|
|
* /research-access. Held at a laptop and a phone.
|
|
*/
|
|
const SIZES = [
|
|
{ width: 1440, height: 900 },
|
|
{ width: 390, height: 844 },
|
|
] as const
|
|
|
|
test.describe('the research preview', () => {
|
|
let base: string
|
|
let stop: () => Promise<void>
|
|
test.beforeAll(async () => {
|
|
const served = await serveExport()
|
|
base = served.url
|
|
stop = served.close
|
|
})
|
|
test.afterAll(async () => stop())
|
|
|
|
for (const size of SIZES) {
|
|
for (const path of ['/models', '/zen']) {
|
|
test(`at ${size.width}px ${path} lists ${NEXT.name} disabled, and its request lands on ${NEXT.request}`, async ({ page }) => {
|
|
await page.setViewportSize(size)
|
|
await page.goto(base + path)
|
|
|
|
const card = page.locator('[data-access="research"]').filter({ hasText: NEXT.name })
|
|
await expect(card).toHaveCount(1)
|
|
await expect(card).toBeVisible()
|
|
await expect(card).toContainText('Research preview')
|
|
// Not a link itself, and inside no link.
|
|
expect(await card.evaluate((el) => el.tagName === 'A' || !!el.closest('a'))).toBe(false)
|
|
// On the family's page, in the same row of generations as the one that answers.
|
|
if (path === '/zen') await expect(card.locator('xpath=..')).toContainText(NOW.name)
|
|
expect(await page.evaluate(() => document.documentElement.scrollWidth > document.documentElement.clientWidth + 1)).toBe(false)
|
|
|
|
await card.getByRole('link', { name: 'Request access' }).click()
|
|
await page.waitForURL(`${base}${NEXT.request}`)
|
|
// The Zen track's title since 4fba776e, which renamed its preview tags.
|
|
await expect(page.locator('h1')).toHaveText(`${NEXT.name} Frontier Foundation`)
|
|
})
|
|
}
|
|
}
|
|
})
|