Zhou Xiao edf0871fea
feat(browser): Add the forceSameTabNavigation configuration to prevent AI from opening new pages during operations, thus avoiding task interruptions. (#389)
* 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>
2025-02-14 21:54:47 +08:00

30 lines
794 B
TypeScript

import {
AgentOverChromeBridge,
getBridgePageInCliSide,
} from '@/bridge-mode/agent-cli-side';
import { sleep } from '@midscene/core/utils';
import { describe, expect, it, vi } from 'vitest';
vi.setConfig({
testTimeout: 300 * 1000,
});
const describeIf = process.env.BRIDGE_MODE ? describe : describe.skip;
describeIf('drag event', () => {
it('agent in cli side, current tab', async () => {
const agent = new AgentOverChromeBridge({
cacheId: 'finish-form-and-submit',
});
await agent.connectCurrentTab();
await sleep(2000);
await agent.aiAction(
'Use the test data to complete the form,Comply with the following restrictions: 1. The Captcha code is not required 2. No need to click the register button',
);
await agent.destroy();
});
});