2025-02-14 21:54:47 +08:00
|
|
|
import {
|
|
|
|
AgentOverChromeBridge,
|
|
|
|
getBridgePageInCliSide,
|
|
|
|
} from '@/bridge-mode/agent-cli-side';
|
|
|
|
import { sleep } from '@midscene/core/utils';
|
|
|
|
import { describe, expect, it, test, vi } from 'vitest';
|
|
|
|
|
|
|
|
vi.setConfig({
|
|
|
|
testTimeout: 300 * 1000,
|
|
|
|
});
|
|
|
|
|
|
|
|
const describeIf = process.env.BRIDGE_MODE ? describe : describe.skip;
|
|
|
|
|
|
|
|
describeIf('open new tab in bridge mode', () => {
|
|
|
|
it(
|
|
|
|
'open new tab',
|
|
|
|
{
|
|
|
|
timeout: 3 * 60 * 1000,
|
|
|
|
},
|
|
|
|
async () => {
|
|
|
|
const agent = new AgentOverChromeBridge();
|
2025-02-15 09:14:21 +08:00
|
|
|
await agent.connectNewTabWithUrl('https://www.google.com');
|
2025-02-14 21:54:47 +08:00
|
|
|
|
|
|
|
await agent.aiAction(
|
|
|
|
'search "midscene github" and open the first result',
|
|
|
|
);
|
2025-02-21 16:15:51 +08:00
|
|
|
|
|
|
|
// sleep 3s
|
|
|
|
await sleep(5000);
|
|
|
|
|
2025-02-14 21:54:47 +08:00
|
|
|
await agent.aiAssert('the page is "midscene github"');
|
|
|
|
|
|
|
|
await agent.destroy();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|