mirror of
https://github.com/web-infra-dev/midscene.git
synced 2025-08-01 05:12:50 +00:00

* feat(core): support custom midscene_run dir * feat(report): add search functionality to PlaywrightCaseSelector component * refactor(shared): simplify base directory resolution and remove unused environment variable * feat(shared): integrate shared environment variables across multiple packages * refactor(shared): update base directory resolution to use dynamic midscene_run directory * fix(puppeteer): increase screenshot timeout from 3s to 10s for improved reliability
30 lines
866 B
TypeScript
30 lines
866 B
TypeScript
import { AiLocateElement } from '@/ai-model';
|
|
import { AiLocateSection } from '@/ai-model/inspect';
|
|
import { saveBase64Image } from '@/image';
|
|
import { getTmpFile } from '@/utils';
|
|
import { vlLocateMode } from '@midscene/shared/env';
|
|
import { getContextFromFixture } from 'tests/evaluation';
|
|
import { expect, test } from 'vitest';
|
|
|
|
test.skipIf(!vlLocateMode())(
|
|
'locate section',
|
|
async () => {
|
|
const { context } = await getContextFromFixture('antd-tooltip');
|
|
const { rect, imageBase64 } = await AiLocateSection({
|
|
context,
|
|
sectionDescription: 'the version info on the top right corner',
|
|
});
|
|
expect(rect).toBeDefined();
|
|
expect(imageBase64).toBeDefined();
|
|
|
|
const tmpFile = getTmpFile('jpg');
|
|
await saveBase64Image({
|
|
base64Data: imageBase64!,
|
|
outputPath: tmpFile!,
|
|
});
|
|
},
|
|
{
|
|
timeout: 60 * 1000,
|
|
},
|
|
);
|