feat: 拆分任务类型并支持脚本语言联动

- 任务类型改为「执行脚本 / 发起 HTTP 请求 / 运行二进制程序」,脚本类型下新增语言选择(Python / Shell / Node / Lua)
- 语言联动表单:Python 才显示虚拟环境、解释器和 uv 状态;Shell/Node/Lua 隐藏这些字段并切换脚本标签、占位符和调用预览
- 切换语言时自动设置解释器与默认脚本,Shell 通过 cmd.exe /C 执行批处理,Node/Lua 使用对应解释器
- TaskAction 新增可选 language,旧任务按解释器推断;补 Shell 执行测试、语言切换单测与 Playwright 用例
This commit is contained in:
2026-11-04 22:07:14 +08:00
parent 8e6b3b92b9
commit 917674880b
15 changed files with 513 additions and 79 deletions
+30
View File
@@ -174,6 +174,36 @@ test('manages a task and reads a real run log', async ({ page, request }) => {
await expect(page.getByText('还没有任务')).toBeVisible()
})
test('switches script language and adapts the form fields', async ({ page }) => {
await page.goto('/')
await page.getByRole('button', { name: '+ 新建任务' }).click()
const dialog = page.getByRole('dialog', { name: '新建定时任务' })
await expect(dialog).toBeVisible()
await dialog.getByRole('button', { name: 'Python', exact: true }).click()
await page.getByRole('option', { name: 'Shell (cmd)' }).click()
await expect(dialog.getByText(/虚拟环境目录/)).toHaveCount(0)
await expect(dialog.getByLabel('批处理文件或相对路径')).toHaveValue('run.bat')
await expect(dialog.locator('.cli-line-cmd')).toContainText(
'cmd.exe /C run.bat',
)
await dialog.getByRole('button', { name: 'Shell (cmd)' }).click()
await page.getByRole('option', { name: 'Node.js' }).click()
await expect(dialog.getByLabel('JavaScript 文件或相对路径')).toHaveValue(
'index.js',
)
await expect(dialog.locator('.cli-line-cmd')).toContainText(
'node.exe index.js',
)
await page.screenshot({
path: 'test-results/dashboard-script-language.png',
fullPage: true,
})
await dialog.getByRole('button', { name: '取消' }).click()
})
test('keeps the dashboard usable on a narrow viewport', async ({
page,
request,