@@ -210,13 +210,6 @@ describe("browser config", () => {
210210 } ) ;
211211 } ) ;
212212
213- it ( "normalizes hex colors" , ( ) => {
214- const resolved = resolveBrowserConfig ( {
215- color : "ff4500" ,
216- } ) ;
217- expect ( resolved . color ) . toBe ( "#FF4500" ) ;
218- } ) ;
219-
220213 it ( "expands tilde-prefixed executablePath with the OS home directory" , ( ) => {
221214 const resolved = resolveBrowserConfig ( {
222215 executablePath : " ~/.local/bin/chromium " ,
@@ -274,21 +267,6 @@ describe("browser config", () => {
274267 expect ( resolved . executablePath ) . toBe ( "/opt/~chromium/chrome" ) ;
275268 } ) ;
276269
277- it ( "falls back to default color for invalid hex" , ( ) => {
278- const resolved = resolveBrowserConfig ( {
279- color : "#GGGGGG" ,
280- } ) ;
281- expect ( resolved . color ) . toBe ( "#FF4500" ) ;
282- } ) ;
283-
284- it ( "treats non-loopback cdpUrl as remote" , ( ) => {
285- const resolved = resolveBrowserConfig ( {
286- cdpUrl : "http://example.com:9222" ,
287- } ) ;
288- const profile = resolveProfile ( resolved , "openclaw" ) ;
289- expect ( profile ?. cdpIsLoopback ) . toBe ( false ) ;
290- } ) ;
291-
292270 it ( "supports explicit CDP URLs for the default profile" , ( ) => {
293271 const resolved = resolveBrowserConfig ( {
294272 cdpUrl : "http://example.com:9222" ,
@@ -1067,62 +1045,17 @@ describe("browser config", () => {
10671045 expect ( getBrowserProfileCapabilities ( work ) . usesChromeMcp ) . toBe ( false ) ;
10681046 } ) ;
10691047
1070- describe ( "default profile preference" , ( ) => {
1071- it ( "defaults to openclaw profile when defaultProfile is not configured" , ( ) => {
1072- const resolved = resolveBrowserConfig ( {
1073- headless : false ,
1074- noSandbox : false ,
1075- } ) ;
1076- expect ( resolved . defaultProfile ) . toBe ( "openclaw" ) ;
1077- } ) ;
1078-
1079- it ( "keeps openclaw default when headless=true" , ( ) => {
1080- const resolved = resolveBrowserConfig ( {
1081- headless : true ,
1082- } ) ;
1083- expect ( resolved . defaultProfile ) . toBe ( "openclaw" ) ;
1084- } ) ;
1085-
1086- it ( "keeps openclaw default when noSandbox=true" , ( ) => {
1087- const resolved = resolveBrowserConfig ( {
1088- noSandbox : true ,
1089- } ) ;
1090- expect ( resolved . defaultProfile ) . toBe ( "openclaw" ) ;
1091- } ) ;
1092-
1093- it ( "keeps openclaw default when both headless and noSandbox are true" , ( ) => {
1094- const resolved = resolveBrowserConfig ( {
1095- headless : true ,
1096- noSandbox : true ,
1097- } ) ;
1098- expect ( resolved . defaultProfile ) . toBe ( "openclaw" ) ;
1099- } ) ;
1100-
1101- it ( "explicit defaultProfile config overrides defaults in headless mode" , ( ) => {
1102- const resolved = resolveBrowserConfig ( {
1103- headless : true ,
1104- defaultProfile : "user" ,
1105- } ) ;
1106- expect ( resolved . defaultProfile ) . toBe ( "user" ) ;
1107- } ) ;
1108-
1109- it ( "explicit defaultProfile config overrides defaults in noSandbox mode" , ( ) => {
1110- const resolved = resolveBrowserConfig ( {
1111- noSandbox : true ,
1112- defaultProfile : "user" ,
1113- } ) ;
1114- expect ( resolved . defaultProfile ) . toBe ( "user" ) ;
1048+ it ( "resolves a configured custom default profile" , ( ) => {
1049+ const resolved = resolveBrowserConfig ( {
1050+ defaultProfile : "custom" ,
1051+ profiles : {
1052+ custom : { cdpPort : 19999 } ,
1053+ } ,
11151054 } ) ;
11161055
1117- it ( "allows custom profile as default even in headless mode" , ( ) => {
1118- const resolved = resolveBrowserConfig ( {
1119- headless : true ,
1120- defaultProfile : "custom" ,
1121- profiles : {
1122- custom : { cdpPort : 19999 , color : "#00FF00" } ,
1123- } ,
1124- } ) ;
1125- expect ( resolved . defaultProfile ) . toBe ( "custom" ) ;
1126- } ) ;
1056+ const profile = resolveProfile ( resolved , resolved . defaultProfile ) ;
1057+ expect ( resolved . defaultProfile ) . toBe ( "custom" ) ;
1058+ expect ( profile ?. name ) . toBe ( "custom" ) ;
1059+ expect ( profile ?. cdpPort ) . toBe ( 19999 ) ;
11271060 } ) ;
11281061} ) ;
0 commit comments