feat:添加连接测试
This commit is contained in:
parent
ae56771c5a
commit
1702f93d16
1
.github/workflows/build.yaml
vendored
1
.github/workflows/build.yaml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- dev
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
|
1
.github/workflows/test.yaml
vendored
1
.github/workflows/test.yaml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- dev
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
|
3643
package-lock.json
generated
3643
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -265,6 +265,7 @@
|
|||||||
"@types/node": "^22.15.29",
|
"@types/node": "^22.15.29",
|
||||||
"@types/pako": "^2.0.3",
|
"@types/pako": "^2.0.3",
|
||||||
"@types/showdown": "^2.0.0",
|
"@types/showdown": "^2.0.0",
|
||||||
|
"@types/sinon": "^17.0.4",
|
||||||
"@types/vscode": "^1.72.0",
|
"@types/vscode": "^1.72.0",
|
||||||
"@vscode/test-cli": "^0.0.11",
|
"@vscode/test-cli": "^0.0.11",
|
||||||
"@vscode/test-electron": "^2.5.2",
|
"@vscode/test-electron": "^2.5.2",
|
||||||
@ -275,6 +276,7 @@
|
|||||||
"rollup": "^4.43.0",
|
"rollup": "^4.43.0",
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
"rollup-plugin-visualizer": "^6.0.1",
|
"rollup-plugin-visualizer": "^6.0.1",
|
||||||
|
"sinon": "^21.0.0",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
"turbo": "^2.5.3",
|
"turbo": "^2.5.3",
|
||||||
"typescript": "^5.4.2",
|
"typescript": "^5.4.2",
|
||||||
|
@ -2,9 +2,11 @@ import * as assert from 'assert';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
suite('测试基础插件激活和命令注册', () => {
|
suite('测试基础插件激活和命令注册', () => {
|
||||||
vscode.window.showInformationMessage('Start base tests.');
|
vscode.window.showInformationMessage('开始测试基础插件激活和命令注册');
|
||||||
|
setup(async () => {
|
||||||
test('Sample test', () => {
|
await vscode.commands.executeCommand('workbench.view.extension.openmcp-sidebar');
|
||||||
|
});
|
||||||
|
test('测试的测试', () => {
|
||||||
assert.strictEqual([1, 2, 3].indexOf(5), -1);
|
assert.strictEqual([1, 2, 3].indexOf(5), -1);
|
||||||
assert.strictEqual([1, 2, 3].indexOf(0), -1);
|
assert.strictEqual([1, 2, 3].indexOf(0), -1);
|
||||||
});
|
});
|
||||||
@ -25,9 +27,5 @@ suite('测试基础插件激活和命令注册', () => {
|
|||||||
assert.ok(commands.includes('openmcp.showOpenMCP'), '命令未注册');
|
assert.ok(commands.includes('openmcp.showOpenMCP'), '命令未注册');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('等待 10 秒以便观察窗口', async function () {
|
|
||||||
this.timeout(15000);
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
||||||
});
|
|
||||||
//
|
//
|
||||||
});
|
});
|
44
src/test/e2e/suite/connect.test.ts
Normal file
44
src/test/e2e/suite/connect.test.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
import * as sinon from 'sinon';
|
||||||
|
|
||||||
|
|
||||||
|
suite('连接管理测试', () => {
|
||||||
|
vscode.window.showInformationMessage('开始测试连接管理');
|
||||||
|
|
||||||
|
let inputBoxStub: sinon.SinonStub;
|
||||||
|
let quickPickStub: sinon.SinonStub;
|
||||||
|
|
||||||
|
setup(async () => {
|
||||||
|
// mock showQuickPick
|
||||||
|
// quickPickStub = sinon.stub(vscode.window, 'showQuickPick');
|
||||||
|
// // mock showInputBox
|
||||||
|
// inputBoxStub = sinon.stub(vscode.window, 'showInputBox');
|
||||||
|
await vscode.commands.executeCommand('workbench.view.extension.openmcp-sidebar');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
teardown(() => {
|
||||||
|
sinon.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('新建STDIO连接', async function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
// await vscode.commands.executeCommand('openmcp.sidebar.workspace-connection.addConnection');
|
||||||
|
// quickPickStub.onFirstCall().resolves('STDIO');
|
||||||
|
// await new Promise(resolve => setTimeout(resolve, 5000));
|
||||||
|
// inputBoxStub.onFirstCall().resolves('echo'); // command
|
||||||
|
// await new Promise(resolve => setTimeout(resolve, 5000));
|
||||||
|
// inputBoxStub.onSecondCall().resolves(''); // cwd
|
||||||
|
|
||||||
|
await vscode.commands.executeCommand('openmcp.sidebar.workspace-connection.addConnection');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('等待以便观察窗口', async function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user