Skip to content

Commit d23e267

Browse files
committed
chore: add test cases for parsing action with square brackets
1 parent b448cc9 commit d23e267

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

packages/action-parser/src/index.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,50 @@ describe('actionParser', () => {
7474
});
7575
});
7676

77+
it('should return parsed action with square brackets', () => {
78+
const result = actionParser({
79+
prediction:
80+
"Action_Summary: 左键单击窗口右上角的最小化按钮(图标为横线),将当前窗口最小化到任务栏。\nAction: click(start_box='[948,57]')",
81+
factor: 1000,
82+
});
83+
84+
expect(result).toEqual({
85+
parsed: [
86+
{
87+
action_inputs: {
88+
start_box: '[0.948,0.057,0.948,0.057]',
89+
},
90+
action_type: 'click',
91+
reflection: '',
92+
thought:
93+
'左键单击窗口右上角的最小化按钮(图标为横线),将当前窗口最小化到任务栏。',
94+
},
95+
],
96+
});
97+
});
98+
99+
it('should return parsed action english with square brackets', () => {
100+
const result = actionParser({
101+
prediction:
102+
'Thought: The task is to open Chrome, but the current screen shows a GitHub repository page in a different browser. To proceed, I need to close this window and open Chrome. The most efficient way to do this is by clicking the "X" button in the top-right corner of the current window to close it, which will allow me to access the desktop and open Chrome from there.\nClick on the "X" button in the top-right corner of the current window to close it.\nAction: click(start_box=\'[962,108]\')',
103+
factor: 1000,
104+
});
105+
106+
expect(result).toEqual({
107+
parsed: [
108+
{
109+
action_inputs: {
110+
start_box: '[0.962,0.108,0.962,0.108]',
111+
},
112+
action_type: 'click',
113+
reflection: '',
114+
thought:
115+
'The task is to open Chrome, but the current screen shows a GitHub repository page in a different browser. To proceed, I need to close this window and open Chrome. The most efficient way to do this is by clicking the "X" button in the top-right corner of the current window to close it, which will allow me to access the desktop and open Chrome from there.\nClick on the "X" button in the top-right corner of the current window to close it.',
116+
},
117+
],
118+
});
119+
});
120+
77121
it('should return Action_Summary', () => {
78122
const result = actionParser({
79123
prediction:

0 commit comments

Comments
 (0)