Skip to content

Commit 84befd4

Browse files
committed
chore: optimize report logic
1 parent 02f4292 commit 84befd4

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

packages/visualizer/src/component/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const Sidebar = (props: { hideLogo?: boolean }): JSX.Element => {
186186
return (
187187
<div className="side-bar">
188188
<div className="top-controls">
189-
<div className="brand" onClick={reset} style={{ display: props?.hideLogo ? 'none' : 'block' }}>
189+
<div className="brand" onClick={reset} style={{ display: props?.hideLogo ? 'none' : 'flex' }}>
190190
<Logo
191191
style={{ width: 70, height: 70, margin: 'auto' }}
192192
// onClick={() => {

packages/web-integration/src/playwright/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ export const PlaywrightAiFixture = () => {
3939

4040
return {
4141
ai: async ({ page }: any, use: any, testInfo: TestInfo) => {
42-
await use(async (taskPrompt: string, type = 'action') => {
42+
await use(async (taskPrompt: string, opts?: { type?: 'action' | 'query' }) => {
4343
const { groupName, caseName } = groupAndCaseForTest(testInfo);
4444
const agent = agentForPage(page, testInfo.testId);
45-
const result = await agent.ai(taskPrompt, type, caseName, groupName);
45+
const actionType = opts?.type || 'action';
46+
const result = await agent.ai(taskPrompt, actionType, caseName, groupName);
4647
if (agent.dumpFile) {
4748
testInfo.annotations.push({
4849
type: 'PLAYWRIGHT_AI_ACTION',
@@ -93,7 +94,7 @@ export const PlaywrightAiFixture = () => {
9394
};
9495

9596
export type PlayWrightAiFixtureType = {
96-
ai: <T = any>(prompt: string, type?: 'action' | 'query') => Promise<T>;
97+
ai: <T = any>(prompt: string, opts?: { type?: 'action' | 'query' }) => Promise<T>;
9798
aiAction: (taskPrompt: string) => ReturnType<PageTaskExecutor['action']>;
9899
aiQuery: <T = any>(demand: any) => Promise<T>;
99100
};
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
// import { expect } from 'playwright/test';
1+
import { expect } from 'playwright/test';
22
import { test } from './fixture';
33

44
test.beforeEach(async ({ page }) => {
55
await page.goto('https://todomvc.com/examples/react/dist/');
66
});
77

8-
test('ai todo', async ({ ai, aiQuery: _test }) => {
8+
test('ai todo', async ({ ai, aiQuery }) => {
99
await ai('Enter "Learn JS today" in the task box, then press Enter to create');
10-
// await ai('Enter "Learn Rust tomorrow" in the task box, then press Enter to create');
11-
// await ai('Enter "Learning AI the day after tomorrow" in the task box, then press Enter to create');
12-
// await ai(
13-
// 'Move your mouse over the second item in the task list and click the Delete button to the right of the second task',
14-
// );
15-
// await ai('Click the check button to the left of the second task');
16-
// await ai('Click the completed Status button below the task list');
10+
await ai('Enter "Learn Rust tomorrow" in the task box, then press Enter to create');
11+
await ai('Enter "Learning AI the day after tomorrow" in the task box, then press Enter to create');
12+
await ai(
13+
'Move your mouse over the second item in the task list and click the Delete button to the right of the second task',
14+
);
15+
await ai('Click the check button to the left of the second task');
16+
await ai('Click the completed Status button below the task list');
1717

18-
// const taskList = await aiQuery<string[]>('string[], tasks in the list');
19-
// expect(taskList.length).toBe(1);
20-
// expect(taskList[0]).toBe('Learning AI the day after tomorrow');
18+
const taskList = await aiQuery<string[]>('string[], tasks in the list');
19+
expect(taskList.length).toBe(1);
20+
expect(taskList[0]).toBe('Learning AI the day after tomorrow');
2121

22-
// const placeholder = await ai('string, return the placeholder text in the input box', 'query');
23-
// expect(placeholder).toBe('What needs to be done?');
22+
const placeholder = await ai('string, return the placeholder text in the input box', { type: 'query' });
23+
expect(placeholder).toBe('What needs to be done?');
2424
});

0 commit comments

Comments
 (0)