mirror of
https://github.com/web-infra-dev/midscene.git
synced 2025-07-23 17:02:10 +00:00
28 lines
784 B
TypeScript
28 lines
784 B
TypeScript
![]() |
import { PuppeteerAgent } from '@/puppeteer';
|
||
|
import { sleep } from '@midscene/core/utils';
|
||
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||
|
import { launchPage } from './utils';
|
||
|
|
||
|
vi.setConfig({
|
||
|
testTimeout: 120 * 1000,
|
||
|
});
|
||
|
|
||
|
describe('open new tab integration', () => {
|
||
|
let resetFn: () => Promise<void>;
|
||
|
afterEach(async () => {
|
||
|
if (resetFn) {
|
||
|
await resetFn();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
it('open new tab', async () => {
|
||
|
const { originPage, reset } = await launchPage('https://www.bing.com/');
|
||
|
resetFn = reset;
|
||
|
const agent = new PuppeteerAgent(originPage, {
|
||
|
cacheId: 'puppeteer-open-new-tab',
|
||
|
});
|
||
|
await agent.aiAction('search "midscene github" and open the first result');
|
||
|
await agent.aiAssert('the page is "midscene github"');
|
||
|
});
|
||
|
});
|