skillhub/plugins/dsh/test/integration/optional-module-probe.mjs
XiaoSeS 3560679793
Some checks failed
Deploy Docs / build (push) Has been cancelled
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
feat(dsh): add native SkillHub plugin for DeepSeek Harness (#956)
Add the native SkillHub plugin for DeepSeek Harness with a scoped skill center, conversation search/install tools, exact-version installation and protected lifecycle management. Prepare the independently versioned 0.1.0 npm candidate with an empty default Registry and documented compatibility limits.

Keep formal specifications and executable regression tests; remove archived development screenshots and runtime reports from the final tree. Review fixes cover independent scopes, installed references, pre-staging recovery and idempotent discovery.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-10-16 19:22:26 +08:00

45 lines
2.6 KiB
JavaScript

import assert from 'node:assert/strict';
import { writeFile } from 'node:fs/promises';
import { chromium } from 'playwright';
const { DSH_PROBE_URL: entry, DSH_PROBE_OUTPUT: output, DSH_FIXTURE_MODULE_STATE: state } = process.env;
if (!entry || !output || !state) throw new Error('Set isolated Host, output and module fixture state');
const browser = await chromium.launch({ headless: true, executablePath: process.env.DSH_PROBE_CHROMIUM });
const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });
const errors = [];
let writes = 0;
page.on('pageerror', error => errors.push(error.message.replace(/token=[^\s&]+/g, 'token=[redacted]')));
page.on('request', request => {
if (/\/(startInstall|executePlan|recoverOperation)$/.test(new URL(request.url()).pathname)) writes++;
});
try {
await writeFile(state, 'unavailable');
await page.goto(entry, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'Configure later', exact: true }).click();
await page.getByText('技能中心', { exact: true }).click();
const plaza = page.getByRole('region', { name: 'SkillHub 技能广场' });
await plaza.getByRole('button', { name: /document-helper/ }).click();
await plaza.getByText('评论是否可读取尚未确认,不代表没有内容。', { exact: true }).waitFor();
assert.equal(await plaza.getByRole('tab', { name: '评论', exact: true }).count(), 0);
await page.screenshot({ path: `${output}/module-unconfirmed.png` });
await writeFile(state, 'available');
await plaza.getByRole('button', { name: '重新检查可选内容', exact: true }).click();
await plaza.getByRole('tab', { name: '评论', exact: true }).waitFor();
await plaza.getByRole('button', { name: '重新检查可选内容', exact: true }).waitFor({ state: 'hidden' });
await plaza.getByRole('tab', { name: '评论', exact: true }).click();
await plaza.getByText('适合整理长文档', { exact: true }).waitFor();
await page.screenshot({ path: `${output}/module-available.png` });
assert.equal(writes, 0);
assert.deepEqual(errors, []);
const result = { passed: true, unavailableNotEmpty: true, unknownAutoTabHidden: true,
explicitRetryRecovered: true, commentsLoadedAfterActivation: true, writes, errors };
await writeFile(`${output}/module-result.json`, JSON.stringify(result, null, 2));
console.log(JSON.stringify(result));
} catch (error) {
await page.screenshot({ path: `${output}/module-failure.png` });
console.log(JSON.stringify({ passed: false, error: error.message.replace(/token=[^\s&]+/g, 'token=[redacted]'), errors }));
process.exitCode = 1;
} finally {
await writeFile(state, 'available');
await browser.close();
}