@@ -18,6 +18,7 @@ import {
1818 openStoredWorkspaceContextById ,
1919 seedLocalWorkspaceContexts ,
2020} from './github-pr-drawer/github-pr-drawer.helpers.js'
21+ import { selectWorkspacesRepositoryFilter } from './github-pr-drawer/github-pr-drawer.helpers.js'
2122
2223test ( 'PR/BYOT controls are visible and chat stays hidden until token connect' , async ( {
2324 page,
@@ -492,7 +493,7 @@ test('Active Local non-PR workspace can be renamed from Workspaces drawer', asyn
492493 await expect ( page . locator ( '#workspace-context-status' ) ) . toContainText ( renamedTitle )
493494} )
494495
495- test ( 'Active Local PR-associated workspace cannot be renamed from Workspaces drawer' , async ( {
496+ test ( 'Active Local workspace with active PR context and null PR number cannot be renamed from Workspaces drawer' , async ( {
496497 page,
497498} ) => {
498499 const activeWorkspaceId = 'active_local_workspace_rename_blocked_pr_associated'
@@ -507,7 +508,7 @@ test('Active Local PR-associated workspace cannot be renamed from Workspaces dra
507508 head : 'feat/active-local-rename-blocked' ,
508509 prTitle : 'PR-associated local workspace' ,
509510 prContextState : 'active' ,
510- prNumber : 97 ,
511+ prNumber : null ,
511512 tabs : [
512513 {
513514 id : 'component' ,
@@ -541,6 +542,68 @@ test('Active Local PR-associated workspace cannot be renamed from Workspaces dra
541542 await expect ( renameButton ) . toBeDisabled ( )
542543} )
543544
545+ test ( 'Repository-scoped workspace cannot be renamed from Workspaces drawer' , async ( {
546+ page,
547+ } ) => {
548+ const repositoryFullName = 'knightedcodemonkey/develop'
549+ const repositoryWorkspaceId = 'repository_workspace_rename_blocked'
550+
551+ await waitForAppReady ( page )
552+
553+ await seedLocalWorkspaceContexts ( page , [
554+ {
555+ id : repositoryWorkspaceId ,
556+ repo : repositoryFullName ,
557+ workspaceScope : 'repository' ,
558+ head : 'feat/repository-rename-blocked' ,
559+ prTitle : 'Repository scoped workspace' ,
560+ prContextState : 'inactive' ,
561+ prNumber : null ,
562+ tabs : [
563+ {
564+ id : 'component' ,
565+ path : 'src/component.tsx' ,
566+ language : 'tsx' ,
567+ role : 'component' ,
568+ content : 'export const App = () => <main>repository rename blocked</main>' ,
569+ order : 0 ,
570+ source : 'workspace' ,
571+ dirty : false ,
572+ } ,
573+ ] ,
574+ activeTabId : 'component' ,
575+ } ,
576+ ] )
577+
578+ await page . route ( 'https://api.github.com/user/repos**' , async route => {
579+ await route . fulfill ( {
580+ status : 200 ,
581+ contentType : 'application/json' ,
582+ body : JSON . stringify ( [
583+ {
584+ id : 11 ,
585+ owner : { login : 'knightedcodemonkey' } ,
586+ name : 'develop' ,
587+ full_name : repositoryFullName ,
588+ default_branch : 'main' ,
589+ permissions : { push : true } ,
590+ } ,
591+ ] ) ,
592+ } )
593+ } )
594+
595+ await page . reload ( )
596+ await waitForAppReady ( page )
597+ await connectByotWithSingleRepo ( page )
598+ await selectWorkspacesRepositoryFilter ( page , repositoryFullName )
599+
600+ const workspaceSelect = page . getByLabel ( 'Stored workspace' )
601+ const renameButton = page . getByRole ( 'button' , { name : 'Rename' , exact : true } )
602+
603+ await expect ( workspaceSelect ) . toHaveValue ( repositoryWorkspaceId )
604+ await expect ( renameButton ) . toBeHidden ( )
605+ } )
606+
544607test ( 'chat stays usable after opening a Local workspace with PAT connected' , async ( {
545608 page,
546609} ) => {
0 commit comments