@@ -14,6 +14,14 @@ function requireFirstNoteText(noteFn: ReturnType<typeof vi.fn>): string {
1414 return String ( message ) ;
1515}
1616
17+ function requireNoteTextContaining ( noteFn : ReturnType < typeof vi . fn > , expected : string ) : string {
18+ const call = noteFn . mock . calls . find ( ( [ message ] ) => String ( message ) . includes ( expected ) ) ;
19+ if ( ! call ) {
20+ throw new Error ( `expected browser doctor note containing ${ expected } ` ) ;
21+ }
22+ return String ( call [ 0 ] ) ;
23+ }
24+
1725describe ( "browser doctor readiness" , ( ) => {
1826 it ( "does nothing when Chrome MCP is not configured" , async ( ) => {
1927 const noteFn = vi . fn ( ) ;
@@ -164,14 +172,16 @@ describe("browser doctor readiness", () => {
164172 {
165173 noteFn,
166174 platform : "darwin" ,
175+ homeDir : "/__openclaw_browser_doctor_missing_home__" ,
167176 resolveChromeExecutable : ( ) => null ,
168177 } ,
169178 ) ;
170179
171- expect ( noteFn ) . toHaveBeenCalledTimes ( 1 ) ;
172- const note = requireFirstNoteText ( noteFn ) ;
173- expect ( note ) . toContain ( "Google Chrome was not found" ) ;
174- expect ( note ) . toContain ( "brave://inspect/#remote-debugging" ) ;
180+ const chromeNote = requireNoteTextContaining ( noteFn , "Google Chrome was not found" ) ;
181+ expect ( chromeNote ) . toContain ( "brave://inspect/#remote-debugging" ) ;
182+ const importNote = requireNoteTextContaining ( noteFn , "System browser profile cookie import" ) ;
183+ expect ( importNote ) . toContain ( "enabled" ) ;
184+ expect ( importNote ) . toContain ( "Importable Chrome-family profile cookie databases found: 0" ) ;
175185 } ) ;
176186
177187 it ( "warns when detected Chrome is too old for Chrome MCP" , async ( ) => {
0 commit comments