Skip to content

Commit b30bdd6

Browse files
test: use snapshots for McpResponse (#483)
1 parent e8394ab commit b30bdd6

File tree

2 files changed

+163
-146
lines changed

2 files changed

+163
-146
lines changed

tests/McpResponse.test.js.snapshot

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
1+
exports[`McpResponse > add network request when attached 1`] = `
2+
# test response
3+
## Request http://example.com
4+
Status: [pending]
5+
### Request Headers
6+
- content-size:10
7+
## Network requests
8+
Showing 1-1 of 1 (Page 1 of 1).
9+
reqid=1 GET http://example.com [pending]
10+
`;
11+
12+
exports[`McpResponse > add network request when attached with POST data 1`] = `
13+
# test response
14+
## Request http://example.com
15+
Status: [success - 200]
16+
### Request Headers
17+
- content-size:10
18+
### Request Body
19+
{"request":"body"}
20+
### Response Headers
21+
- Content-Type:application/json
22+
### Response Body
23+
{"response":"body"}
24+
## Network requests
25+
Showing 1-1 of 1 (Page 1 of 1).
26+
reqid=1 POST http://example.com [success - 200]
27+
`;
28+
29+
exports[`McpResponse > add network requests when setting is true 1`] = `
30+
# test response
31+
## Network requests
32+
Showing 1-2 of 2 (Page 1 of 1).
33+
reqid=1 GET http://example.com [pending]
34+
reqid=2 GET http://example.com [pending]
35+
`;
36+
37+
exports[`McpResponse > adds a message when no console messages exist 1`] = `
38+
# test response
39+
## Console messages
40+
<no console messages found>
41+
`;
42+
43+
exports[`McpResponse > adds a prompt dialog 1`] = `
44+
# test response
45+
# Open dialog
46+
prompt: message (default value: "default").
47+
Call handle_dialog to handle it before continuing.
48+
`;
49+
50+
exports[`McpResponse > adds an alert dialog 1`] = `
51+
# test response
52+
# Open dialog
53+
alert: message.
54+
Call handle_dialog to handle it before continuing.
55+
`;
56+
57+
exports[`McpResponse > adds console messages when the setting is true 1`] = `
58+
# test response
59+
## Console messages
60+
Showing 1-1 of 1 (Page 1 of 1).
61+
msgid=1 [log] Hello from the test (1 args)
62+
`;
63+
64+
exports[`McpResponse > adds cpu throttling setting when it is over 1 1`] = `
65+
# test response
66+
## CPU emulation
67+
Emulating: 4x slowdown
68+
`;
69+
70+
exports[`McpResponse > adds throttling setting when it is not null 1`] = `
71+
# test response
72+
## Network emulation
73+
Emulating: Slow 3G
74+
Default navigation timeout set to 100000 ms
75+
`;
76+
77+
exports[`McpResponse > allows response text lines to be added 1`] = `
78+
# test response
79+
Testing 1
80+
Testing 2
81+
`;
82+
83+
exports[`McpResponse > list pages 1`] = `
84+
# test response
85+
## Pages
86+
0: about:blank [selected]
87+
`;
88+
189
exports[`McpResponse > returns correctly formatted snapshot for a simple tree 1`] = `
290
# test response
391
## Page content
@@ -43,3 +131,46 @@ uid=1_0 RootWebArea "My test page" url="about:blank"
43131
uid=1_5 InlineTextBox "test"
44132

45133
`;
134+
135+
exports[`McpResponse network request filtering > filters network requests by resource type 1`] = `
136+
# test response
137+
## Network requests
138+
Showing 1-2 of 2 (Page 1 of 1).
139+
reqid=1 GET http://example.com [pending]
140+
reqid=1 GET http://example.com [pending]
141+
`;
142+
143+
exports[`McpResponse network request filtering > filters network requests by single resource type 1`] = `
144+
# test response
145+
## Network requests
146+
Showing 1-1 of 1 (Page 1 of 1).
147+
reqid=1 GET http://example.com [pending]
148+
`;
149+
150+
exports[`McpResponse network request filtering > shows all requests when empty resourceTypes array is provided 1`] = `
151+
# test response
152+
## Network requests
153+
Showing 1-5 of 5 (Page 1 of 1).
154+
reqid=1 GET http://example.com [pending]
155+
reqid=1 GET http://example.com [pending]
156+
reqid=1 GET http://example.com [pending]
157+
reqid=1 GET http://example.com [pending]
158+
reqid=1 GET http://example.com [pending]
159+
`;
160+
161+
exports[`McpResponse network request filtering > shows all requests when no filters are provided 1`] = `
162+
# test response
163+
## Network requests
164+
Showing 1-5 of 5 (Page 1 of 1).
165+
reqid=1 GET http://example.com [pending]
166+
reqid=1 GET http://example.com [pending]
167+
reqid=1 GET http://example.com [pending]
168+
reqid=1 GET http://example.com [pending]
169+
reqid=1 GET http://example.com [pending]
170+
`;
171+
172+
exports[`McpResponse network request filtering > shows no requests when filter matches nothing 1`] = `
173+
# test response
174+
## Network requests
175+
No requests found.
176+
`;

0 commit comments

Comments
 (0)