fix: ci testing (#529)

* fix: ci

* fix: ci
This commit is contained in:
yuyutaotao 2025-04-03 10:51:50 +08:00 committed by GitHub
parent bc645c3d0c
commit 0171b5e2de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 8 deletions

View File

@ -1,11 +1,12 @@
import { AiLocateElement } from '@/ai-model'; import { AiLocateElement } from '@/ai-model';
import { AiLocateSection } from '@/ai-model/inspect'; import { AiLocateSection } from '@/ai-model/inspect';
import { vlLocateMode } from '@/env';
import { saveBase64Image } from '@/image'; import { saveBase64Image } from '@/image';
import { getTmpFile } from '@/utils'; import { getTmpFile } from '@/utils';
import { getContextFromFixture } from 'tests/evaluation'; import { getContextFromFixture } from 'tests/evaluation';
import { expect, test } from 'vitest'; import { expect, test } from 'vitest';
test( test.skipIf(!vlLocateMode())(
'locate section', 'locate section',
async () => { async () => {
const { context } = await getContextFromFixture('antd-tooltip'); const { context } = await getContextFromFixture('antd-tooltip');
@ -21,7 +22,6 @@ test(
base64Data: imageBase64!, base64Data: imageBase64!,
outputPath: tmpFile!, outputPath: tmpFile!,
}); });
console.log('tmpFile', tmpFile);
}, },
{ {
timeout: 60 * 1000, timeout: 60 * 1000,

View File

@ -7,6 +7,7 @@ import type {
plan, plan,
} from '@midscene/core'; } from '@midscene/core';
import type { AiLocateSection } from '@midscene/core/ai-model'; import type { AiLocateSection } from '@midscene/core/ai-model';
import { vlLocateMode } from '@midscene/core/env';
import type { TestCase } from '../tests/util'; import type { TestCase } from '../tests/util';
type ActualResult = type ActualResult =
@ -229,7 +230,7 @@ ${errorMsg ? `Error: ${errorMsg}` : ''}
} }
// compare coordinates // compare coordinates
if (testCase.response_rect) { if (testCase.response_rect && vlLocateMode()) {
const resultRect = (result as LocateResult).rect; const resultRect = (result as LocateResult).rect;
if (!resultRect) { if (!resultRect) {
throw new Error( throw new Error(

View File

@ -3,7 +3,7 @@ import { expect } from 'playwright/test';
import { test } from '../playwright/fixture'; import { test } from '../playwright/fixture';
import { getLastModifiedReportHTMLFile } from '../playwright/util'; import { getLastModifiedReportHTMLFile } from '../playwright/util';
test('ai report', async ({ page, ai, aiAssert }, testInfo) => { test('ai report', async ({ page, ai, aiAssert, aiQuery }, testInfo) => {
testInfo.snapshotSuffix = ''; testInfo.snapshotSuffix = '';
await new Promise((resolve) => setTimeout(resolve, 3000)); await new Promise((resolve) => setTimeout(resolve, 3000));
const htmlFile = getLastModifiedReportHTMLFile( const htmlFile = getLastModifiedReportHTMLFile(
@ -17,11 +17,8 @@ test('ai report', async ({ page, ai, aiAssert }, testInfo) => {
await ai( await ai(
'Move your mouse over the task file path (on the right of the logo, with a check or cross icon) and click ai todo from the drop-down list', 'Move your mouse over the task file path (on the right of the logo, with a check or cross icon) and click ai todo from the drop-down list',
); );
const actionsList = await ai( const actionsList = await aiQuery(
'Array<{title: string(task name,include action、wait), actions: Array<string(task action name,Excluding time)>}>', 'Array<{title: string(task name,include action、wait), actions: Array<string(task action name,Excluding time)>}>',
{
type: 'query',
},
); );
const parseList = JSON.stringify(actionsList, null, 4); const parseList = JSON.stringify(actionsList, null, 4);
console.log('parseList:', parseList); console.log('parseList:', parseList);