@@ -2389,9 +2389,11 @@ test("manage channel keeps canvas near the top of the sheet", async ({
23892389 expect ( canvasBox ?. y ) . toBeLessThan ( nameBox ?. y ) ;
23902390} ) ;
23912391
2392- test ( "home inbox channel label opens management without leaving home" , async ( {
2393- page,
2394- } ) => {
2392+ async function seedHomeInboxMention (
2393+ page : import ( "@playwright/test" ) . Page ,
2394+ itemId : string ,
2395+ tags ?: string [ ] [ ] ,
2396+ ) {
23952397 await page . goto ( "/" ) ;
23962398 await expect ( page . getByTestId ( "home-inbox-list" ) ) . toBeVisible ( ) ;
23972399 await page . waitForFunction (
@@ -2401,22 +2403,29 @@ test("home inbox channel label opens management without leaving home", async ({
24012403 ) ;
24022404
24032405 await page . evaluate (
2404- ( { channelId, createdAt, currentPubkey, senderPubkey } ) => {
2406+ ( {
2407+ channelId,
2408+ createdAt,
2409+ currentPubkey,
2410+ itemId : id ,
2411+ senderPubkey,
2412+ tags : seededTags ,
2413+ } ) => {
24052414 const pushFeedItem = ( window as MockFeedWindow )
24062415 . __BUZZ_E2E_PUSH_MOCK_FEED_ITEM__ ;
24072416 if ( ! pushFeedItem ) {
24082417 throw new Error ( "Mock feed injection helper is not installed." ) ;
24092418 }
24102419
24112420 pushFeedItem ( {
2412- id : "mock-feed-home-channel-panel" ,
2421+ id,
24132422 kind : 9 ,
24142423 pubkey : senderPubkey ,
24152424 content : "Please review the home panel routing." ,
24162425 created_at : createdAt ,
24172426 channel_id : channelId ,
24182427 channel_name : "general" ,
2419- tags : [
2428+ tags : seededTags ?? [
24202429 [ "e" , channelId ] ,
24212430 [ "p" , currentPubkey ] ,
24222431 ] ,
@@ -2427,18 +2436,68 @@ test("home inbox channel label opens management without leaving home", async ({
24272436 channelId : GENERAL_CHANNEL_ID ,
24282437 createdAt : Math . floor ( Date . now ( ) / 1000 ) ,
24292438 currentPubkey : TEST_IDENTITIES . tyler . pubkey ,
2439+ itemId,
24302440 senderPubkey : TEST_IDENTITIES . alice . pubkey ,
2441+ tags,
24312442 } ,
24322443 ) ;
24332444
2445+ await page . getByTestId ( `home-inbox-item-${ itemId } ` ) . click ( ) ;
2446+ }
2447+
2448+ test ( "home inbox channel label navigates to the channel message" , async ( {
2449+ page,
2450+ } ) => {
2451+ await seedHomeInboxMention ( page , "mock-feed-home-channel-navigate" ) ;
2452+
24342453 await page
2435- . getByTestId ( "home-inbox-item-mock-feed-home-channel-panel" )
2454+ . getByTestId ( "home-inbox-detail" )
2455+ . getByRole ( "button" , { exact : true , name : "general" } )
24362456 . click ( ) ;
2457+
2458+ await expect ( page ) . toHaveURL (
2459+ new RegExp ( `#/channels/${ GENERAL_CHANNEL_ID } \\?` ) ,
2460+ ) ;
2461+ await expect ( page ) . toHaveURL ( / m e s s a g e I d = m o c k - f e e d - h o m e - c h a n n e l - n a v i g a t e / ) ;
2462+ await expect ( page ) . not . toHaveURL ( / t h r e a d R o o t I d = / ) ;
2463+ await expect ( page . getByTestId ( "message-timeline" ) ) . toBeVisible ( ) ;
2464+ await expect ( page . getByTestId ( "home-inbox-list" ) ) . toHaveCount ( 0 ) ;
2465+ } ) ;
2466+
2467+ test ( "home inbox thread reply mention carries threadRootId to the channel" , async ( {
2468+ page,
2469+ } ) => {
2470+ const rootEventId = "mock-feed-home-thread-root" ;
2471+ await seedHomeInboxMention ( page , "mock-feed-home-thread-navigate" , [
2472+ [ "e" , rootEventId , "" , "root" ] ,
2473+ [ "e" , "mock-feed-home-thread-parent" , "" , "reply" ] ,
2474+ [ "p" , TEST_IDENTITIES . tyler . pubkey ] ,
2475+ ] ) ;
2476+
24372477 await page
24382478 . getByTestId ( "home-inbox-detail" )
24392479 . getByRole ( "button" , { exact : true , name : "general" } )
24402480 . click ( ) ;
24412481
2482+ await expect ( page ) . toHaveURL (
2483+ new RegExp ( `#/channels/${ GENERAL_CHANNEL_ID } \\?` ) ,
2484+ ) ;
2485+ await expect ( page ) . toHaveURL ( / m e s s a g e I d = m o c k - f e e d - h o m e - t h r e a d - n a v i g a t e / ) ;
2486+ await expect ( page ) . toHaveURL ( new RegExp ( `threadRootId=${ rootEventId } ` ) ) ;
2487+ await expect ( page . getByTestId ( "message-timeline" ) ) . toBeVisible ( ) ;
2488+ await expect ( page . getByTestId ( "home-inbox-list" ) ) . toHaveCount ( 0 ) ;
2489+ } ) ;
2490+
2491+ test ( "home inbox manage affordance opens management without leaving home" , async ( {
2492+ page,
2493+ } ) => {
2494+ await seedHomeInboxMention ( page , "mock-feed-home-channel-panel" ) ;
2495+
2496+ await page
2497+ . getByTestId ( "home-inbox-detail" )
2498+ . getByTestId ( "channel-management-trigger" )
2499+ . click ( ) ;
2500+
24422501 await expect ( page . getByTestId ( "channel-management-sheet" ) ) . toBeVisible ( ) ;
24432502 await expect ( page . getByTestId ( "channel-management-name-row" ) ) . toContainText (
24442503 "general" ,
0 commit comments