Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

4.4 KB
Raw Blame
import { expect, test } from '@playwright/test'
import { readFile } from 'node:fs/promises'

for (const slug of ['ollama-cloud', 'featherless', 'venice', 'chutes', 'infermatic', 'arliai', 'cerebras-code', 'backyard-ai', 'sillyhost']) {
  test(`${slug} has readable, keyboard-scrollable comparison rows on mobile`, async ({ page }, testInfo) => {
    await page.route('**/*', async (route) => {
      const url = new URL(route.request().url())
      if (url.hostname !== 'lu-docs.test') return route.abort()
      const path = url.pathname === `/vs/${slug}/` ? `docs/vs/${slug}/index.html` : url.pathname === '/assets/lu.css' ? 'docs/assets/lu.css' : null
      if (!path) return route.fulfill({ status: 404, body: '' })
      await route.fulfill({ contentType: path.endsWith('.css') ? 'text/css' : 'text/html', body: await readFile(path) })
    })
    await page.setViewportSize({ width: 390, height: 844 })
    await page.goto(`http://lu-docs.test/vs/${slug}/`)
    const region = page.getByRole('region', { name: 'Plan and usage comparison' })
    await region.focus()
    await expect(region).toBeFocused()
    await page.keyboard.press('ArrowRight')
    await expect.poll(() => region.evaluate((el) => el.scrollLeft)).toBeGreaterThan(0)
    expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true)
    await expect(page.locator('[data-comparison-row]')).toHaveCount(3)
    await expect(page.getByRole('link', { name: 'Review LU packs and calculator' })).toHaveAttribute('href', 'https://lu-labs.ai/pricing?tab=credits&src=luc')
    if (slug === 'venice') {
      await expect(region).toContainText('API requests are metered separately')
      await expect(region).toContainText('100 monthly credits')
    }
    if (slug === 'chutes') {
      await expect(region).toContainText('USD 4.17 and USD 8.33')
      await expect(region).toContainText('low-volume API traffic')
    }
    if (slug === 'infermatic') {
      await expect(region).toContainText('2,048 under UI Token Responses')
      await expect(region).toContainText('separate keys and base URLs')
    }
    if (slug === 'arliai') {
      await expect(region).toContainText('Pro allows two and Max six')
      await expect(region).toContainText('LoRA variants can behave differently')
    }
    if (slug === 'cerebras-code') {
      await expect(region).toContainText('historical launch prices, not a verified current offer')
      await expect(region).toContainText('minute limits and the available budget still apply')
    }
    if (slug === 'backyard-ai') {
      await expect(region).toContainText('300 messages per week for Free')
      await expect(region).toContainText('not evidence of an unlimited developer API')
    }
    if (slug === 'sillyhost') {
      await expect(region).toContainText('limited-time welcome-back offer')
      await expect(region).toContainText('not an unlimited inference allowance')
    }
    if (['venice', 'chutes', 'infermatic', 'arliai', 'cerebras-code', 'backyard-ai', 'sillyhost'].includes(slug)) {
      await page.screenshot({ path: testInfo.outputPath(`${slug}-mobile.png`), fullPage: true })
      const luSource = region.locator('td:last-child a').last()
      await luSource.focus()
      await expect(luSource).toBeFocused()
      // Die Zusage ist: der letzte Quellenlink der LU-Spalte ist mit der
      // Tastatur erreichbar, und die Tabelle bleibt dabei gerollt. Gemessen am
      // 12.09.2026 auf 390x844: sechs der sieben Seiten rollen bis ans Ende
      // (scrollLeft 330 von 330), backyard-ai bleibt bei 40, den Schritt aus
      // dem ArrowRight davor. Grund ist der Umbruch der LU-Zelle nach der
      // Textaenderung aus R6-4: die zweite Zeile des Links beginnt fuenf Pixel
      // vor dem sichtbaren Rand, und Chromium rollt beim Fokus nur, wenn gar
      // nichts vom Element zu sehen ist. Die Schwelle 100 hat diesen Abstand
      // zufaellig getroffen, nicht die Zusage. Bindend ist deshalb: gerollt und
      // gerollt geblieben, also groesser 0, mit 40 als kleinstem gemessenem Wert.
      await expect.poll(() => region.evaluate((el) => el.scrollLeft)).toBeGreaterThan(0)
      await page.screenshot({ path: testInfo.outputPath(`${slug}-mobile-lu.png`), fullPage: true })
      await page.setViewportSize({ width: 1280, height: 900 })
      await region.evaluate((el) => { el.scrollLeft = 0 })
      await page.screenshot({ path: testInfo.outputPath(`${slug}-desktop.png`), fullPage: true })
    }
  })
}