refactor(extract): optimize image box selection #130
Merged
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.
This pull request includes a variety of changes to the
packages/midscene/tests/ai/evaluate/test-data/antd-pagination/element-snapshot.json
file, as well as updates to thepackages/shared/src/img/box-select.ts
,packages/web-integration/playwright.config.ts
, andpackages/web-integration/src/debug/index.ts
files. The most important updates involve modifying node attributes and improving the logic for checking overlaps in box selection.Changes to node attributes and index IDs:
packages/midscene/tests/ai/evaluate/test-data/antd-pagination/element-snapshot.json
: Updatedid
,indexId
,nodePath
,nodeHashId
,locator
,attributes
,content
,rect
, andcenter
for multiple nodes to reflect new values. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27]Improvements to box selection logic:
packages/shared/src/img/box-select.ts
: Added functions to check for overlaps and ensure positions are within image bounds, and updated logic to place text boxes in alternative positions if the original position overlaps or is out of bounds.Other updates:
packages/web-integration/playwright.config.ts
: Commented out thetestIgnore
configuration forgenerate-test-data.spec.ts
.packages/web-integration/src/debug/index.ts
: Commented out the condition to skip saving snapshots if they already exist and are identical to the new snapshot.