mirror of
https://github.com/web-infra-dev/midscene.git
synced 2025-07-07 17:11:17 +00:00

* feat(tab-control): enhance the configuration to limit AI from opening new tabs during operations, preventing failures. * chore: optimize evaluate error * chore: resolve navigation error * fix(browser): add forceSameTabNavigation config toe limit open new tab * chore: upgrade vitest version * fix: typo (#390) --------- Co-authored-by: yuyutaotao <167746126+yuyutaotao@users.noreply.github.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import {
|
|
AgentOverChromeBridge,
|
|
getBridgePageInCliSide,
|
|
} from '@/bridge-mode/agent-cli-side';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
|
|
vi.setConfig({
|
|
testTimeout: 3 * 60 * 1000,
|
|
});
|
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
const describeIf = process.env.BRIDGE_MODE ? describe : describe.skip;
|
|
|
|
describeIf(
|
|
'keyboard event in bridge mode',
|
|
{
|
|
timeout: 3 * 60 * 10,
|
|
},
|
|
() => {
|
|
it('page in cli side scroll down', async () => {
|
|
const agent = new AgentOverChromeBridge();
|
|
await agent.connectNewTabWithUrl('https://www.baidu.com');
|
|
|
|
await agent.aiAction('type "midscene" and hit Enter and scroll down');
|
|
// sleep 3s
|
|
await sleep(3000);
|
|
|
|
await agent.destroy();
|
|
});
|
|
|
|
it('page in cli side select all text', async () => {
|
|
const agent = new AgentOverChromeBridge();
|
|
await agent.connectNewTabWithUrl('https://www.baidu.com');
|
|
|
|
await agent.aiAction('type "Midscene" and hit Enter and select all text');
|
|
// sleep 3s
|
|
await sleep(3000);
|
|
|
|
await agent.destroy();
|
|
});
|
|
},
|
|
);
|