-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use different color for annotations (#366)
- Loading branch information
1 parent
bdff171
commit 2a28472
Showing
187 changed files
with
5,849 additions
and
12,643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: AI unit test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to checkout' | ||
required: false | ||
default: 'main' | ||
type: string | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
node-version: [18.19.0] | ||
|
||
env: | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} | ||
MIDSCENE_MODEL_NAME: gpt-4o-2024-11-20 | ||
CI: 1 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.inputs.branch || 'main' }} | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 9.3.0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build project | ||
run: pnpm run build | ||
|
||
- name: Run evaluation | ||
run: | | ||
cd packages/evaluation | ||
pnpm run evaluate:inspect | ||
pnpm run evaluate:assertion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Midscene.js dump files | ||
midscene_run/report | ||
midscene_run/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { PlayWrightAiFixtureType } from '@midscene/web'; | ||
import { PlaywrightAiFixture } from '@midscene/web/playwright'; | ||
import { test as base } from '@playwright/test'; | ||
|
||
export const test = base.extend<PlayWrightAiFixtureType>(PlaywrightAiFixture()); |
23 changes: 23 additions & 0 deletions
23
packages/evaluation/data-generator/generator-headed.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { PlaywrightWebPage } from '@midscene/web/playwright'; | ||
import { test } from './fixture'; | ||
import { generateExtractData, generateTestDataPath } from './utils'; | ||
|
||
function sleep(time: number) { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(0); | ||
}, time); | ||
}); | ||
} | ||
|
||
test('taobao', async ({ page, ai }) => { | ||
const playwrightPage = new PlaywrightWebPage(page); | ||
page.setViewportSize({ width: 1280, height: 800 }); | ||
|
||
await page.goto('https://www.taobao.com/'); | ||
|
||
// for --ui | ||
await sleep(5000); | ||
|
||
await generateExtractData(playwrightPage, generateTestDataPath('taobao')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "evaluation", | ||
"private": true, | ||
"scripts": { | ||
"update-page-data:headless": "playwright test ./data-generator/generator-headless.spec.ts", | ||
"update-page-data:headed": "playwright test ./data-generator/generator-headed.spec.ts --headed", | ||
"evaluate:inspect": "npx vitest --run tests/llm-inspect.test.ts", | ||
"evaluate:inspect:update": "UPDATE_AI_DATA=true npm run evaluate:inspect", | ||
"evaluate:assertion": "npx vitest --run tests/assertion.test.ts", | ||
"evaluate:assertion:update": "UPDATE_AI_DATA=true npm run evaluate:assertion" | ||
}, | ||
"dependencies": { | ||
"@midscene/core": "workspace:*", | ||
"@midscene/shared": "workspace:*", | ||
"@midscene/web": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"dotenv": "16.4.5", | ||
"playwright": "1.44.1", | ||
"@playwright/test": "^1.44.1", | ||
"typescript": "~5.0.4", | ||
"vitest": "^1.6.0" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"testDataPath": "aweme-play", | ||
"testCases": [ | ||
{ | ||
"prompt": "左下角暂停按钮", | ||
"response": [ | ||
{ | ||
"id": "3" | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt": "点赞(爱心)按钮", | ||
"response": [ | ||
{ | ||
"id": "afifi", | ||
"indexId": 22 | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt": "评论按钮", | ||
"response": [ | ||
{ | ||
"id": "jldma", | ||
"indexId": 24 | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt": "书签收藏按钮", | ||
"response": [ | ||
{ | ||
"id": "nmgcl", | ||
"indexId": 26 | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt": "分享按钮", | ||
"response": [ | ||
{ | ||
"id": "eabap", | ||
"indexId": 28 | ||
} | ||
] | ||
}, | ||
{ | ||
"prompt": "右下角区域声音按钮", | ||
"response": [ | ||
{ | ||
"id": "djknm", | ||
"indexId": 9 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.