mirror of
https://github.com/web-infra-dev/midscene.git
synced 2025-08-03 14:22:56 +00:00
34 lines
890 B
TypeScript
34 lines
890 B
TypeScript
![]() |
import Insight from '@/insight';
|
||
|
import { sleep } from '@/utils';
|
||
|
import { getContextFromFixture } from 'tests/evaluation';
|
||
|
import { expect, test, vi } from 'vitest';
|
||
|
|
||
|
vi.setConfig({
|
||
|
testTimeout: 60 * 1000,
|
||
|
});
|
||
|
|
||
|
test('insight locate with search area', async () => {
|
||
|
const { context } = await getContextFromFixture('taobao');
|
||
|
|
||
|
const insight = new Insight(context);
|
||
|
const { element } = await insight.locate({
|
||
|
prompt: '购物车 icon',
|
||
|
searchArea: '顶部购物车栏目',
|
||
|
});
|
||
|
expect(element).toBeDefined();
|
||
|
|
||
|
await sleep(3000);
|
||
|
});
|
||
|
|
||
|
test('insight locate with search area and think twice', async () => {
|
||
|
const { context } = await getContextFromFixture('taobao');
|
||
|
|
||
|
const insight = new Insight(context);
|
||
|
const { element } = await insight.locate({
|
||
|
prompt: '顶部购物车 icon',
|
||
|
deepThink: true,
|
||
|
});
|
||
|
expect(element).toBeDefined();
|
||
|
await sleep(3000);
|
||
|
});
|