@@ -21,6 +21,8 @@ const allowMissingChromium = process.env.OPENCLAW_UI_E2E_ALLOW_MISSING_CHROMIUM
2121const describeControlUiE2e = chromiumAvailable || ! allowMissingChromium ? describe : describe . skip ;
2222const captureUiProof = process . env . OPENCLAW_CAPTURE_UI_PROOF === "1" ;
2323const proofDir = path . join ( process . cwd ( ) , ".artifacts" , "control-ui-e2e" , "profile-identity" ) ;
24+ const basePath = "/wilfred" ;
25+ const profilePath = `${ basePath } /settings/profile` ;
2426
2527async function screenshot ( page : Page , name : string ) {
2628 if ( ! captureUiProof ) {
@@ -74,12 +76,13 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
7476
7577 async function openProfilePage ( page : Page ) {
7678 const gateway = await installMockGateway ( page , {
79+ basePath,
7780 presenceUsers : testPresenceUsers ,
7881 methodResponses : {
7982 "users.self" : { profile : testProfile } ,
8083 } ,
8184 } ) ;
82- const response = await page . goto ( ` ${ server . baseUrl } settings/profile` ) ;
85+ const response = await page . goto ( new URL ( profilePath , server . baseUrl ) . href ) ;
8386 expect ( response ?. status ( ) ) . toBe ( 200 ) ;
8487 return gateway ;
8588 }
@@ -121,7 +124,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
121124 viewport : { width : 1280 , height : 800 } ,
122125 } ) ;
123126 const page = await context . newPage ( ) ;
124- await page . route ( ` ${ server . baseUrl } settings/profile` , async ( route ) => {
127+ await page . route ( new URL ( profilePath , server . baseUrl ) . href , async ( route ) => {
125128 const response = await route . fetch ( ) ;
126129 const body = await response . text ( ) ;
127130 await route . fulfill ( {
@@ -182,14 +185,15 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
182185 } ) ;
183186 } ) ;
184187 const gateway = await installMockGateway ( page , {
188+ basePath,
185189 presenceUsers : testPresenceUsers ,
186190 methodResponses : {
187191 "users.self" : { profile : testProfile } ,
188192 } ,
189193 } ) ;
190194
191195 try {
192- const response = await page . goto ( ` ${ server . baseUrl } settings/profile` ) ;
196+ const response = await page . goto ( new URL ( profilePath , server . baseUrl ) . href ) ;
193197 expect ( response ?. status ( ) ) . toBe ( 200 ) ;
194198 expect ( response ?. headers ( ) [ "content-security-policy" ] ) . toContain (
195199 "img-src 'self' data: blob:" ,
@@ -220,7 +224,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
220224 await expect . poll ( ( ) => avatarRequests . length ) . toBe ( 1 ) ;
221225 expect ( avatarRequests [ 0 ] ) . toEqual ( {
222226 authorization : "Bearer e2e-device-token" ,
223- url : expect . stringContaining ( ` /api/users/${ testProfile . id } /avatar?v=2`) ,
227+ url : new URL ( ` ${ basePath } /api/users/${ testProfile . id } /avatar?v=2`, server . baseUrl ) . href ,
224228 } ) ;
225229 expect ( await sidebarAvatar . getAttribute ( "src" ) ) . toBe ( imageUrl ) ;
226230 expect (
@@ -286,7 +290,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
286290 ) . toBe ( false ) ;
287291 expect ( avatarRequests [ 1 ] ) . toEqual ( {
288292 authorization : "Bearer e2e-device-token" ,
289- url : expect . stringContaining ( ` /api/users/${ testProfile . id } /avatar?v=3`) ,
293+ url : new URL ( ` ${ basePath } /api/users/${ testProfile . id } /avatar?v=3`, server . baseUrl ) . href ,
290294 } ) ;
291295 if ( captureUiProof ) {
292296 await page . screenshot ( {
@@ -321,7 +325,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
321325 expect ( await originalSidebarImage ?. evaluate ( ( image ) => image . isConnected ) ) . toBe ( true ) ;
322326 expect ( avatarRequests [ 2 ] ) . toEqual ( {
323327 authorization : "Bearer e2e-device-token" ,
324- url : expect . stringContaining ( ` /api/users/${ testProfile . id } /avatar?v=4`) ,
328+ url : new URL ( ` ${ basePath } /api/users/${ testProfile . id } /avatar?v=4`, server . baseUrl ) . href ,
325329 } ) ;
326330 if ( captureUiProof ) {
327331 await page . screenshot ( {
@@ -338,14 +342,15 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
338342 const context = await browser . newContext ( ) ;
339343 const page = await context . newPage ( ) ;
340344 const gateway = await installMockGateway ( page , {
345+ basePath,
341346 presenceUsers : testPresenceUsers ,
342347 methodResponses : {
343348 "users.self" : { sequence : [ { } , { profile : testProfile } ] } ,
344349 } ,
345350 } ) ;
346351
347352 try {
348- const response = await page . goto ( ` ${ server . baseUrl } settings/profile` ) ;
353+ const response = await page . goto ( new URL ( profilePath , server . baseUrl ) . href ) ;
349354 expect ( response ?. status ( ) ) . toBe ( 200 ) ;
350355
351356 const emptyState = page . locator ( ".profile-identity-empty" ) ;
@@ -370,6 +375,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
370375 const context = await browser . newContext ( ) ;
371376 const page = await context . newPage ( ) ;
372377 const gateway = await installMockGateway ( page , {
378+ basePath,
373379 deferredMethods : [ "users.self" ] ,
374380 presenceUsers : testPresenceUsers ,
375381 methodResponses : {
@@ -378,7 +384,7 @@ describeControlUiE2e("Control UI profile page mocked Gateway E2E", () => {
378384 } ) ;
379385
380386 try {
381- const response = await page . goto ( ` ${ server . baseUrl } settings/profile` ) ;
387+ const response = await page . goto ( new URL ( profilePath , server . baseUrl ) . href ) ;
382388 expect ( response ?. status ( ) ) . toBe ( 200 ) ;
383389
384390 const refresh = page . locator ( ".profile-refresh" ) ;
0 commit comments