0d986f60bd
web-platform-ci / Standalone decision service (no cloud credentials) (push) Has been cancelled
web-platform-ci / TypeScript, lint, unit, build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
lekiwi-compatibility / cpu-compatibility (push) Has been cancelled
集成服务器托管模型、自然语言移动与有界抓放、内置 LeKiwi URL 导入和双摄像头;同步部署契约与指定域名 iframe 白名单,保留原有物理安全、会话及调用预算防护。 更新 npm 包及锁文件版本、CHANGELOG 与发布文档。提交前 typecheck、120 项定向前端测试和 44 项后端测试通过(3 项可选跳过);真实 v2 云模型抓放仍待单独验收,不包含运行密钥或构建产物。
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { resolve } from 'node:path';
|
|
import { writeFile } from 'node:fs/promises';
|
|
import type {} from '../physics/agent';
|
|
|
|
test('v2 物理:连续两次搬运,不重载或移动支撑面', async ({ page }, info) => {
|
|
await page.goto('/physics/agent.html');
|
|
await page.waitForFunction(() => Boolean(window.lekiwiAgent));
|
|
await page.evaluate(
|
|
(url) => window.lekiwiAgent.boot(url),
|
|
`/@fs${resolve('build/lekiwi/lekiwi-v1.zip')}`,
|
|
);
|
|
const results = await page.evaluate(() =>
|
|
window.lekiwiAgent.languagePhysical([
|
|
[0.257, 0.75, 0.128],
|
|
[0.25, 0.5, 0.128],
|
|
]),
|
|
);
|
|
await writeFile(info.outputPath('continuous-physical.json'), JSON.stringify(results, null, 2));
|
|
for (const r of results) {
|
|
console.log('language physical', {
|
|
status: r.status,
|
|
error: r.error,
|
|
goal: r.goal,
|
|
sample: r.sample,
|
|
transported: r.transported,
|
|
});
|
|
expect(r.status, r.error).toBe('succeeded');
|
|
expect(r.succeeded).toBe(true);
|
|
expect(r.sample.onGoalSupport).toBe(true);
|
|
expect(r.maxJointSpeed).toBeLessThanOrEqual(2);
|
|
}
|
|
await page.evaluate(() => window.lekiwiAgent.dispose());
|
|
});
|
|
|
|
test('v2 真实故障:夹爪锁开不会宣称成功', async ({ page }, info) => {
|
|
await page.goto('/physics/agent.html');
|
|
await page.waitForFunction(() => Boolean(window.lekiwiAgent));
|
|
await page.evaluate(
|
|
(url) => window.lekiwiAgent.boot(url),
|
|
`/@fs${resolve('build/lekiwi/lekiwi-v1.zip')}`,
|
|
);
|
|
const results = await page.evaluate(() =>
|
|
window.lekiwiAgent.languagePhysical([[0.257, 0.75, 0.128]], 'empty'),
|
|
);
|
|
await writeFile(info.outputPath('empty-grasp.json'), JSON.stringify(results, null, 2));
|
|
expect(results[0].status).toBe('failed');
|
|
expect(results[0].error).toBe('empty_grasp');
|
|
expect(results[0].transported).toBe(0);
|
|
expect(results[0].succeeded).toBe(false);
|
|
await page.evaluate(() => window.lekiwiAgent.dispose());
|
|
});
|
|
|
|
test('v2 标定:连续台面边界与停靠姿态 scratch IK', async ({ page }, info) => {
|
|
await page.goto('/physics/agent.html');
|
|
await page.waitForFunction(() => Boolean(window.lekiwiAgent));
|
|
await page.evaluate(
|
|
(url) => window.lekiwiAgent.boot(url),
|
|
`/@fs${resolve('build/lekiwi/lekiwi-v1.zip')}`,
|
|
);
|
|
const result = await page.evaluate(() => window.lekiwiAgent.calibrateLanguage());
|
|
await writeFile(info.outputPath('calibration.json'), JSON.stringify(result, null, 2));
|
|
expect(result.unchanged).toBe(true);
|
|
for (const check of result.checks)
|
|
expect(check.residual, JSON.stringify(check.target)).toBeLessThan(0.004);
|
|
await page.evaluate(() => window.lekiwiAgent.dispose());
|
|
});
|