skillhub/web/e2e/landing-quick-start-cli.spec.ts
XiaoSeS beecc34b88
feat(web): unify landing, dashboard, and paginated lists (#825)
* feat(web): unify landing and dashboard experience

Closes #824

Made-with: Proma
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): clamp skill card summaries

Keep skill grids compact by reserving a stable three-line summary region while exposing the full description via the title attribute.

Made-with: Proma
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(web): align e2e with redesigned experience

Update real-service E2E assertions for the current landing and dashboard flows, and make settings card headings distinct from their page headings.

Made-with: Proma

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* Revert "test(web): align e2e with redesigned experience"

This reverts commit 3f78115277.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): align dashboard layout footer spacing

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): restore footer access links

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): link footer API to Swagger UI

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): refine footer resource links

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): link landing CTA to open source resources

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(frontend): restore responsive navigation contracts

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): wrap narrow search controls

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(web): derive landing guide origin

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): remove landing statistics strip

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* test(web): align landing guide assertion

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): address follow-up review feedback

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): update landing CLI version

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-09-09 18:31:18 +08:00

64 lines
2.9 KiB
TypeScript

import { expect, test } from '@playwright/test'
import { setEnglishLocale } from './helpers/auth-fixtures'
test.describe('Landing access methods (Real API)', () => {
test.beforeEach(async ({ page }) => {
await setEnglishLocale(page)
})
test('renders three access methods and exposes current CLI commands', async ({ page }) => {
await page.goto('/')
const agentMode = page.getByRole('button', { name: /Agent integration/ })
const cliMode = page.getByRole('button', { name: /\bCLI\b/ })
const webMode = page.getByRole('button', { name: /Web interface/ })
await expect(agentMode).toBeVisible({ timeout: 15_000 })
await expect(cliMode).toBeVisible()
await expect(webMode).toBeVisible()
await expect(agentMode).toHaveAttribute('aria-pressed', 'true')
await cliMode.click()
await expect(cliMode).toHaveAttribute('aria-pressed', 'true')
await expect(agentMode).toHaveAttribute('aria-pressed', 'false')
await expect(webMode).toHaveAttribute('aria-pressed', 'false')
await expect(page.getByText('npx -y @astron-team/skillhub@0.1.12 --version', { exact: true })).toBeVisible()
await expect(page.getByText(/npx -y @astron-team\/skillhub@0\.1\.12 search weather/)).toBeVisible()
await expect(page.getByText(/npx -y @astron-team\/skillhub@0\.1\.12 install @global\/weather/)).toBeVisible()
await expect(page.getByRole('link', { name: 'CLI docs' })).toHaveAttribute(
'href',
'https://github.com/iflytek/skillhub/tree/main/cli',
)
})
test('agent views expose Registry configuration and implicit discovery', async ({ page }) => {
await page.goto('/')
const registryTab = page.getByRole('tab', { name: 'Registry setup' })
const discoveryTab = page.getByRole('tab', { name: 'Implicit discovery' })
await expect(registryTab).toHaveAttribute('aria-selected', 'true')
await expect(page.getByText(/registry\/skill\.md/).first()).toBeVisible()
await discoveryTab.click()
await expect(discoveryTab).toHaveAttribute('aria-selected', 'true')
await expect(page.getByText('Search SkillHub Registry')).toBeVisible()
await expect(page.getByText('Match @global/weather · v1.3.0')).toBeVisible()
const guideResponse = await page.request.get('/registry/skill.md')
expect(guideResponse.status()).toBe(200)
const guide = await guideResponse.text()
expect(guide).toContain('name: skillhub-cli')
expect(guide).toContain('removing the trailing `/registry/skill.md`')
expect(guideResponse.headers()['cache-control']).toContain('no-cache')
const hostileHostResponse = await page.request.get('/registry/skill.md', {
headers: { Host: 'attacker.example' },
})
expect(hostileHostResponse.status()).toBe(403)
const extensionHostResponse = await page.request.get('/registry/skill.md', {
headers: { Host: 'chrome-extension:evil;echo_injected' },
})
expect(extensionHostResponse.status()).toBe(400)
})
})