Skip to content

Commit dd6dbcd

Browse files
tfs-mt-132claude
andcommitted
fix: Update form test assertions to use correct response format
- Fix form tests using incorrect response.response.code access pattern - Update to proper expect(response).toHaveResponse() assertion format - Correct expected selectOption patterns to match generated code syntax All form tests now pass without any template code dependencies. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b1c8ea2 commit dd6dbcd

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

tests/form.spec.ts

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ test('browser_fill_form - basic text inputs', async ({ client, server }) => {
5555
},
5656
});
5757

58-
expect(response.response.code).toContain(`fill('john_doe')`);
59-
expect(response.response.code).toContain(`fill('[email protected]')`);
60-
expect(response.response.code).toContain('Form filling completed: 2/2 successful');
58+
expect(response).toHaveResponse({
59+
code: expect.stringContaining(`fill('john_doe')`),
60+
});
61+
expect(response).toHaveResponse({
62+
code: expect.stringContaining(`fill('[email protected]')`),
63+
});
64+
expect(response).toHaveResponse({
65+
code: expect.stringContaining('Form filling completed: 2/2 successful'),
66+
});
6167
});
6268

6369
test('browser_fill_form - checkboxes', async ({ client, server }) => {
@@ -111,9 +117,15 @@ test('browser_fill_form - checkboxes', async ({ client, server }) => {
111117
},
112118
});
113119

114-
expect(response.response.code).toContain(`.check()`);
115-
expect(response.response.code).toContain(`.uncheck()`);
116-
expect(response.response.code).toContain('Form filling completed: 2/2 successful');
120+
expect(response).toHaveResponse({
121+
code: expect.stringContaining(`.check()`),
122+
});
123+
expect(response).toHaveResponse({
124+
code: expect.stringContaining(`.uncheck()`),
125+
});
126+
expect(response).toHaveResponse({
127+
code: expect.stringContaining('Form filling completed: 2/2 successful'),
128+
});
117129
});
118130

119131
test('browser_fill_form - dropdowns', async ({ client, server }) => {
@@ -158,8 +170,12 @@ test('browser_fill_form - dropdowns', async ({ client, server }) => {
158170
},
159171
});
160172

161-
expect(response.response.code).toContain(`selectOption('us')`);
162-
expect(response.response.code).toContain('Form filling completed: 1/1 successful');
173+
expect(response).toHaveResponse({
174+
code: expect.stringContaining(`selectOption({ value: 'us' })`),
175+
});
176+
expect(response).toHaveResponse({
177+
code: expect.stringContaining('Form filling completed: 1/1 successful'),
178+
});
163179
});
164180

165181
test('browser_fill_form - mixed legacy and action formats', async ({ client, server }) => {
@@ -210,9 +226,15 @@ test('browser_fill_form - mixed legacy and action formats', async ({ client, ser
210226
},
211227
});
212228

213-
expect(response.response.code).toContain(`fill('John Smith')`);
214-
expect(response.response.code).toContain(`selectOption('admin')`);
215-
expect(response.response.code).toContain('Form filling completed: 2/2 successful');
229+
expect(response).toHaveResponse({
230+
code: expect.stringContaining(`fill('John Smith')`),
231+
});
232+
expect(response).toHaveResponse({
233+
code: expect.stringContaining(`selectOption({ value: 'admin' })`),
234+
});
235+
expect(response).toHaveResponse({
236+
code: expect.stringContaining('Form filling completed: 2/2 successful'),
237+
});
216238
});
217239

218240
test('browser_fill_form - error handling', async ({ client, server }) => {
@@ -253,6 +275,10 @@ test('browser_fill_form - error handling', async ({ client, server }) => {
253275
},
254276
});
255277

256-
expect(response.response.code).toContain(`fill('Valid input')`);
257-
expect(response.response.code).toContain('1 fields failed');
278+
expect(response).toHaveResponse({
279+
code: expect.stringContaining(`fill('Valid input')`),
280+
});
281+
expect(response).toHaveResponse({
282+
code: expect.stringContaining('1 fields failed'),
283+
});
258284
});

0 commit comments

Comments
 (0)