diff --git a/tests/tools/tabs.test.ts b/tests/tools/tabs.test.ts index 432f2f95..fce830d2 100644 --- a/tests/tools/tabs.test.ts +++ b/tests/tools/tabs.test.ts @@ -225,8 +225,8 @@ describe('TabsCreateTool', () => { await handler(testSessionId, { url: 'https://google.com' }); - // Now includes optional workerId parameter - expect(mockSessionManager.createTarget).toHaveBeenCalledWith(testSessionId, 'https://google.com', undefined, undefined); + // Now includes optional workerId + isolatedContext parameters (#848 / #946). + expect(mockSessionManager.createTarget).toHaveBeenCalledWith(testSessionId, 'https://google.com', undefined, undefined, undefined); }); test('returns error when URL is not provided', async () => { @@ -246,7 +246,8 @@ describe('TabsCreateTool', () => { await handler(testSessionId, { url: 'https://example.com' }); // createTarget implicitly creates/uses session, now with optional workerId - expect(mockSessionManager.createTarget).toHaveBeenCalledWith(testSessionId, 'https://example.com', undefined, undefined); + // + isolatedContext parameters (#848 / #946). + expect(mockSessionManager.createTarget).toHaveBeenCalledWith(testSessionId, 'https://example.com', undefined, undefined, undefined); }); }); diff --git a/tests/utils/mock-session.ts b/tests/utils/mock-session.ts index 5a9ffbfc..e95eb4e7 100644 --- a/tests/utils/mock-session.ts +++ b/tests/utils/mock-session.ts @@ -198,6 +198,11 @@ export function createMockSessionManager(options: MockSessionManagerOptions = {} return Array.from(worker.targets); }), + // #946: real SessionManager returns the BrowserContext name for tabs + // created with isolatedContext, or undefined for the default context. + // Tests don't exercise the named-context path, so always return undefined. + getTargetContextName: jest.fn().mockReturnValue(undefined), + registerExternalTarget: jest.fn().mockImplementation((targetId: string, sessionId: string, workerId: string) => { const session = sessions.get(sessionId); if (!session) return;