- 16 个业务模块,856 个测试用例,40 个 E2E 测试 - 单一 React 19 前端 + PlatformSwitcher 二合一切换 - Flask 后端支持 scenario/dcloud_module/dcloud_e2e/dcloud_all 四种任务类型 - E2E 测试面板:API 全链路(8条) + UI 点击(3条) + 分步测试(3个) - SSE 实时日志流 + 飞书告警 + 定时调度 - 完整还原原 ToB 平台 TestPanel E2E 模块
67 lines
2.9 KiB
Python
67 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
||
"""E2E 验证脚本:创建真实数据 → 你去平台确认 → 自动清理"""
|
||
import json, httpx, uuid, sys, os
|
||
|
||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||
|
||
from tests.conftest_auth import _get_token_from_auth_state
|
||
|
||
token = _get_token_from_auth_state()
|
||
if not token:
|
||
print("无法获取认证 token,请先运行一次登录")
|
||
sys.exit(1)
|
||
|
||
headers = {'Authorization': token}
|
||
client = httpx.Client(base_url='https://cloud-fat.d-robotics.cc', headers=headers, timeout=10)
|
||
|
||
print("=" * 60)
|
||
print("E2E 验证脚本:创建真实数据,你去平台确认,回来按 Enter 清理")
|
||
print("=" * 60)
|
||
|
||
# 1. 创建系统提示词
|
||
sp_name = f'E2E_VERIFY_{uuid.uuid4().hex[:6]}'
|
||
resp = client.post('/api/generationApi/systemPrompt/create', json={
|
||
'name': sp_name, 'description': 'E2E验证', 'prompt': 'verify content', 'permission': 'public'
|
||
})
|
||
sp_id = resp.json().get('data', {}).get('id')
|
||
print(f'\n✅ 系统提示词已创建: {sp_name} (id={sp_id})')
|
||
|
||
# 2. 创建数据空间
|
||
space_name = f'E2E_SPACE_{uuid.uuid4().hex[:6]}'
|
||
resp2 = client.post('/api/cloudDiskApi/spaces', json={'name': space_name, 'type': 'private'})
|
||
space_id = resp2.json().get('data', {}).get('id')
|
||
print(f'✅ 数据空间已创建: {space_name} (id={space_id})')
|
||
|
||
# 3. 创建任务
|
||
resp3 = client.post('/api/generationApi/comfyWorkflow/list', json={})
|
||
wf_id = resp3.json()['data']['list'][0]['id']
|
||
task_name = f'E2E_TASK_{uuid.uuid4().hex[:6]}'
|
||
resp4 = client.post('/api/generationApi/imgGeneration/task', json={
|
||
'name': task_name, 'workflow_id': int(wf_id), 'batch_size': 1, 'instance_count': 1,
|
||
'cache_path': f'fattest/e2e_{uuid.uuid4().hex[:6]}',
|
||
'prompt_list': ['e2e verify'],
|
||
'expansion_param': {'prompt': 'verify', 'system_prompt': ''},
|
||
'resource_param': {'sku_id': 'a10690ab-816a-e350-0f00-b6f318ee86ee', 'queue_name': 'fattest-elastic', 'queue_type': 'elastic'}
|
||
})
|
||
task_id = resp4.json().get('data', {}).get('task_id') or resp4.json().get('taskId')
|
||
print(f'✅ 任务已创建: {task_name} (id={task_id})')
|
||
|
||
print()
|
||
print('=' * 60)
|
||
print('现在去平台验证这些数据真实存在:')
|
||
print()
|
||
print(f' 系统提示词 → https://cloud-fat.d-robotics.cc/d-cloud/data-create/list (切到系统提示词tab)')
|
||
print(f' 数据空间 → https://cloud-fat.d-robotics.cc/d-cloud/data-space')
|
||
print(f' 任务 → https://cloud-fat.d-robotics.cc/d-cloud/data-create/list')
|
||
print()
|
||
print(f' 搜索关键词: E2E_VERIFY 或 E2E_SPACE 或 E2E_TASK')
|
||
print('=' * 60)
|
||
|
||
input('\n确认完毕后,按 Enter 清理所有数据...')
|
||
|
||
# 清理
|
||
client.delete(f'/api/generationApi/systemPrompt/{sp_id}')
|
||
client.delete(f'/api/cloudDiskApi/spaces/{space_id}')
|
||
client.post(f'/api/generationApi/imgGeneration/task/{task_id}/stop', json={})
|
||
client.post(f'/api/generationApi/imgGeneration/task/{task_id}/delete', json={})
|
||
print('\n✅ 全部数据已清理。刷新平台页面确认数据已消失。') |