feat: 编辑器实时探测并显示已关联虚拟环境

fix: 按系统 ANSI 代码页解码子进程输出,修复中文日志乱码
This commit is contained in:
2026-10-24 22:30:10 +08:00
parent 23565b40a4
commit dd7612bc74
20 changed files with 1508 additions and 48 deletions
+27
View File
@@ -1,5 +1,20 @@
import { mkdirSync, writeFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { expect, test, type APIRequestContext } from '@playwright/test'
const venvProject = fileURLToPath(
new URL('../../.e2e-data/venv-project', import.meta.url),
)
function createVenvFixture(): string {
const scripts = join(venvProject, '.venv', 'Scripts')
mkdirSync(scripts, { recursive: true })
writeFileSync(join(venvProject, '.venv', 'pyvenv.cfg'), 'home = C:\\Python\n')
writeFileSync(join(scripts, 'python.exe'), '')
return venvProject
}
const taskPayload = {
id: 'e2e_echo',
name: 'E2E echo',
@@ -56,6 +71,18 @@ test('manages a task and reads a real run log', async ({ page, request }) => {
path: 'test-results/dashboard-task-editor.png',
fullPage: true,
})
const workingDir = createVenvFixture()
await newTaskDialog.getByLabel(/项目工作目录/).fill(workingDir)
await expect(
newTaskDialog.locator('.env-status-badge.ok code'),
).toHaveText('.venv\\Scripts\\python.exe')
await expect(newTaskDialog.getByText(/已关联虚拟环境/)).toBeVisible()
await page.screenshot({
path: 'test-results/dashboard-venv-detected.png',
fullPage: true,
})
const addArgumentButton = newTaskDialog.getByRole('button', {
name: '+ 添加参数',
})