brave-real-browser-mcp-server 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55,7 +55,11 @@ describe('Browser Handlers', () => {
|
|
|
55
55
|
});
|
|
56
56
|
// Ensure updateContentPriorityConfig is properly mocked
|
|
57
57
|
mockBrowserManager.updateContentPriorityConfig.mockReturnValue(undefined);
|
|
58
|
-
|
|
58
|
+
// Mock initializeBrowser to return valid browser/page objects
|
|
59
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
60
|
+
browser: { isConnected: () => true },
|
|
61
|
+
page: { url: () => 'about:blank' }
|
|
62
|
+
});
|
|
59
63
|
mockBrowserManager.closeBrowser.mockResolvedValue(undefined);
|
|
60
64
|
// Ensure workflow validation functions are properly mocked
|
|
61
65
|
mockWorkflowValidation.recordExecution.mockReturnValue(undefined);
|
|
@@ -69,7 +73,10 @@ describe('Browser Handlers', () => {
|
|
|
69
73
|
headless: false,
|
|
70
74
|
disableXvfb: false
|
|
71
75
|
};
|
|
72
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
76
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
77
|
+
browser: { isConnected: () => true },
|
|
78
|
+
page: { url: () => 'about:blank' }
|
|
79
|
+
});
|
|
73
80
|
// Act: Initialize browser
|
|
74
81
|
const result = await handleBrowserInit(args);
|
|
75
82
|
// Assert: Should initialize browser and return success message
|
|
@@ -103,7 +110,10 @@ describe('Browser Handlers', () => {
|
|
|
103
110
|
errorMessage: null,
|
|
104
111
|
suggestedAction: null
|
|
105
112
|
});
|
|
106
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
113
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
114
|
+
browser: { isConnected: () => true },
|
|
115
|
+
page: { url: () => 'about:blank' }
|
|
116
|
+
});
|
|
107
117
|
// Mock updateContentPriorityConfig to actually update the returned config
|
|
108
118
|
mockBrowserManager.updateContentPriorityConfig.mockImplementation((newConfig) => {
|
|
109
119
|
// After update is called, getContentPriorityConfig should return the new value
|
|
@@ -175,7 +185,10 @@ describe('Browser Handlers', () => {
|
|
|
175
185
|
autoSuggestGetContent: true
|
|
176
186
|
});
|
|
177
187
|
const args = { headless: false };
|
|
178
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
188
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
189
|
+
browser: { isConnected: () => true },
|
|
190
|
+
page: { url: () => 'about:blank' }
|
|
191
|
+
});
|
|
179
192
|
// Act: Initialize browser
|
|
180
193
|
const result = await handleBrowserInit(args);
|
|
181
194
|
// Assert: Should include comprehensive workflow guidance
|
|
@@ -262,7 +275,10 @@ describe('Browser Handlers', () => {
|
|
|
262
275
|
it('should validate workflow before executing operation', async () => {
|
|
263
276
|
// Arrange: Valid workflow state
|
|
264
277
|
const args = { headless: false };
|
|
265
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
278
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
279
|
+
browser: { isConnected: () => true },
|
|
280
|
+
page: { url: () => 'about:blank' }
|
|
281
|
+
});
|
|
266
282
|
// Act: Execute browser init (uses workflow validation)
|
|
267
283
|
await handleBrowserInit(args);
|
|
268
284
|
// Assert: Should validate workflow first
|
|
@@ -272,7 +288,10 @@ describe('Browser Handlers', () => {
|
|
|
272
288
|
it('should record execution results for successful operations', async () => {
|
|
273
289
|
// Arrange: Successful operation
|
|
274
290
|
const args = { headless: false };
|
|
275
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
291
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
292
|
+
browser: { isConnected: () => true },
|
|
293
|
+
page: { url: () => 'about:blank' }
|
|
294
|
+
});
|
|
276
295
|
// Act: Execute successful operation
|
|
277
296
|
await handleBrowserInit(args);
|
|
278
297
|
// Assert: Should record successful execution
|
|
@@ -313,7 +332,10 @@ describe('Browser Handlers', () => {
|
|
|
313
332
|
it('should use system error handling wrapper', async () => {
|
|
314
333
|
// Arrange: Browser init with error handling
|
|
315
334
|
const args = { headless: false };
|
|
316
|
-
mockBrowserManager.initializeBrowser.mockResolvedValue(
|
|
335
|
+
mockBrowserManager.initializeBrowser.mockResolvedValue({
|
|
336
|
+
browser: { isConnected: () => true },
|
|
337
|
+
page: { url: () => 'about:blank' }
|
|
338
|
+
});
|
|
317
339
|
// Act: Execute browser init
|
|
318
340
|
await handleBrowserInit(args);
|
|
319
341
|
// Assert: Should use error handling wrapper
|