-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use different color for annotations #366
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a518692
chore: update evaluation
yuyutaotao 49ee50c
chore: update evaluation
yuyutaotao fbfedb2
fix: lint
yuyutaotao 772e57f
chore: fix test case
yuyutaotao e24453c
feat: merge main
yuyutaotao 03cd007
chore: keep moving code
yuyutaotao 463b045
chore: update evaluation
yuyutaotao 2cd4fd7
fix: lint
yuyutaotao 7bec8e7
fix: lint
yuyutaotao 062bb76
fix: lint
yuyutaotao 0636daa
chore: add github action
yuyutaotao cbbcb71
Merge branch 'main' into feat/colorful-markup-2
yuyutaotao eba5012
fix: screenshot output in web extractor
yuyutaotao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
Comment on lines
+16
to
+54
Check warning Code scanning / CodeQL Workflow does not contain permissions Medium
Actions Job or Workflow does not set permissions
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium