guanghu/tests/smoke/generate-commit-message.spec.ts
冰朔 8739805f99
Some checks failed
Auto-update PR branches / Update open PR branches (push) Has been cancelled
CI / Frontend Static Quality Checks (push) Has been cancelled
CI / Frontend Tests & Coverage (push) Has been cancelled
CI / Rust Tests & Quality Checks (push) Has been cancelled
CI / Linux build verification (push) Has been cancelled
Release (Alpha) / Compute alpha version (push) Has been cancelled
Release (Alpha) / Build release artifacts (push) Has been cancelled
Release (Alpha) / GitHub Release (alpha) (push) Has been cancelled
Release (Alpha) / Update docs and release pages (push) Has been cancelled
Deploy docs / Build VitePress site (push) Has been cancelled
Deploy docs / Deploy to GitHub Pages (push) Has been cancelled
光湖开源源码快照 · Tolaria AGPL 分叉基线 · 独立更新链
2026-07-05 17:45:16 +08:00

25 lines
1.1 KiB
TypeScript

import { expect, test } from '@playwright/test'
import { executeCommand, openCommandPalette, sendShortcut } from './helpers'
test.setTimeout(60_000)
test('command palette generates an editable commit message from the current diff', async ({ page }) => {
await page.goto('/', { timeout: 45_000, waitUntil: 'domcontentloaded' })
await expect(page.getByRole('heading', { name: 'Inbox' })).toBeVisible({ timeout: 20_000 })
await openCommandPalette(page)
await executeCommand(page, 'Generate Commit Message from Diff')
const messageInput = page.locator('textarea[placeholder="Commit message..."]')
await expect(page.getByRole('heading', { name: 'Commit & Push' })).toBeVisible()
await expect(messageInput).toHaveValue('Update 4 notes', { timeout: 5_000 })
await expect(messageInput).toBeFocused()
await expect(page.getByRole('button', { name: 'Commit & Push' })).toBeEnabled()
await sendShortcut(page, 'a', ['Control'])
await page.keyboard.type('Update generated commit draft')
await sendShortcut(page, 'Enter', ['Control'])
await expect(page.locator('.fixed.bottom-8')).toContainText('Committed and pushed', { timeout: 5_000 })
})