@@ -113,6 +113,19 @@ test('source authorization returns to its desktop screen and refreshes live', as
113113 redirect ( `/credential-groups/slack-complete?state=${ state } &ok=${ ok } ` )
114114 return
115115 }
116+ if (
117+ path ===
118+ '/api/knowledge/00000000-0000-4000-8000-000000000001/connectors/fixture-connector/enroll'
119+ ) {
120+ if ( url . searchParams . has ( 'oauthCompletionId' ) )
121+ json ( { error : 'Direct account connection requires a Search source' } , 400 )
122+ else
123+ json ( {
124+ success : true ,
125+ data : { url : `${ origin } /credential-groups/enroll/fixture-invitation` } ,
126+ } )
127+ return
128+ }
116129 if ( path === '/api/knowledge/github/setup' ) {
117130 if ( request . method === 'POST' ) {
118131 const { setupId } = await body ( )
@@ -367,6 +380,15 @@ test('source authorization returns to its desktop screen and refreshes live', as
367380 expect ( page . url ( ) ) . toBe ( `${ origin } /home` )
368381 }
369382 )
383+ await check ( 'ordinary knowledge-base enrollment preserves its invitation step' , async ( ) => {
384+ await page . getByRole ( 'button' , { name : 'Connect invited source' } ) . click ( )
385+ await expect . poll ( async ( ) => ( await opened ( ) ) . length ) . toBe ( 7 )
386+ await external . goto ( ( await opened ( ) ) [ 6 ] )
387+ await external . getByRole ( 'link' , { name : 'Authorize invited source' } ) . click ( )
388+ await expect ( page . getByLabel ( 'Enrollment pending' ) ) . toHaveText ( 'false' )
389+ await expect ( page . getByLabel ( 'Enrollment error' ) ) . toHaveText ( '' )
390+ expect ( page . url ( ) ) . toBe ( `${ origin } /home` )
391+ } )
370392 await page . screenshot ( { path : test . info ( ) . outputPath ( 'source-connect-desktop.png' ) } )
371393 } finally {
372394 mkdirSync ( dirname ( reportPath ) , { recursive : true } )
0 commit comments