@@ -437,15 +437,15 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
437
437
} ) ;
438
438
} ) ;
439
439
440
- [ 'Audio to Text' , ' ChatBot' , 'Summarizer' , 'Code Generation' , 'RAG Chatbot ', 'Function calling' ] . forEach ( appName => {
440
+ [ 'ChatBot' , 'Function calling' ] . forEach ( appName => {
441
441
test . describe . serial ( `AI Recipe installation` , ( ) => {
442
442
test . skip (
443
443
! process . env . EXT_TEST_RAG_CHATBOT && appName === 'RAG Chatbot' ,
444
444
'EXT_TEST_RAG_CHATBOT variable not set, skipping test' ,
445
445
) ;
446
446
let recipesCatalogPage : AILabRecipesCatalogPage ;
447
447
448
- test ( `Navigate to Recipes Catalog for ${ appName } `, async ( { runner, page, navigationBar } ) => {
448
+ test . beforeAll ( `Open Recipes Catalog`, async ( { runner, page, navigationBar } ) => {
449
449
[ page , webview ] = await handleWebview ( runner , page , navigationBar ) ;
450
450
aiLabPage = new AILabPage ( page , webview ) ;
451
451
await aiLabPage . navigationBar . waitForLoad ( ) ;
@@ -461,46 +461,52 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
461
461
await demoApp . startNewDeployment ( ) ;
462
462
} ) ;
463
463
464
- /* eslint-disable sonarjs/no-nested-functions */
465
- if ( appName === 'Function calling' ) {
466
- test ( `Verify that model service for the ${ appName } is working` , async ( { request } ) => {
467
- test . setTimeout ( 600_000 ) ;
468
- const modelServicePage = await aiLabPage . navigationBar . openServices ( ) ;
469
- const serviceDetailsPage = await modelServicePage . openSercviceDetails (
470
- 'ibm-granite/granite-3.3-8b-instruct-GGUF' ,
471
- ) ;
472
- await playExpect . poll ( async ( ) => await serviceDetailsPage . getServiceState ( ) ) . toBe ( 'RUNNING' ) ;
473
- const port = await serviceDetailsPage . getInferenceServerPort ( ) ;
474
- const url = `http://localhost:${ port } /v1/chat/completions` ;
464
+ test ( `Verify that model service for the ${ appName } is working` , async ( { request } ) => {
465
+ test . skip ( appName !== 'Function calling' ) ;
466
+ test . setTimeout ( 600_000 ) ;
475
467
476
- const response = await request . post ( url , {
477
- data : {
478
- messages : [
479
- {
480
- content : 'You are a helpful assistant.' ,
481
- role : 'system' ,
482
- } ,
483
- {
484
- content : 'What is the capital of Czech Republic?' ,
485
- role : 'user' ,
486
- } ,
487
- ] ,
488
- } ,
489
- timeout : 600_000 ,
490
- } ) ;
468
+ const modelServicePage = await aiLabPage . navigationBar . openServices ( ) ;
469
+ const serviceDetailsPage = await modelServicePage . openServiceDetails (
470
+ 'ibm-granite/granite-3.3-8b-instruct-GGUF' ,
471
+ ) ;
472
+ // eslint-disable-next-line sonarjs/no-nested-functions
473
+ await playExpect . poll ( async ( ) => await serviceDetailsPage . getServiceState ( ) ) . toBe ( 'RUNNING' ) ;
474
+ const port = await serviceDetailsPage . getInferenceServerPort ( ) ;
475
+ const url = `http://localhost:${ port } /v1/chat/completions` ;
491
476
492
- playExpect ( response . ok ( ) ) . toBeTruthy ( ) ;
493
- const body = await response . body ( ) ;
494
- const text = body . toString ( ) ;
495
- playExpect ( text ) . toContain ( 'Prague' ) ;
477
+ const response = await request . post ( url , {
478
+ data : {
479
+ messages : [
480
+ {
481
+ content : 'You are a helpful assistant.' ,
482
+ role : 'system' ,
483
+ } ,
484
+ {
485
+ content : 'What is the capital of Czech Republic?' ,
486
+ role : 'user' ,
487
+ } ,
488
+ ] ,
489
+ } ,
490
+ timeout : 600_000 ,
496
491
} ) ;
497
- }
498
- /* eslint-enable sonarjs/no-nested-functions */
499
492
500
- test ( `Stop ${ appName } app` , async ( { navigationBar } ) => {
493
+ playExpect ( response . ok ( ) ) . toBeTruthy ( ) ;
494
+ const body = await response . body ( ) ;
495
+ const text = body . toString ( ) ;
496
+ playExpect ( text ) . toContain ( 'Prague' ) ;
497
+ } ) ;
498
+
499
+ test ( `Stop ${ appName } app` , async ( ) => {
501
500
test . setTimeout ( 150_000 ) ;
502
501
await stopAndDeleteApp ( appName ) ;
503
502
await cleanupServiceModels ( ) ;
503
+ } ) ;
504
+
505
+ test . afterAll ( `Ensure cleanup of "${ appName } " app, related service, and images` , async ( { navigationBar } ) => {
506
+ test . setTimeout ( 150_000 ) ;
507
+
508
+ await stopAndDeleteApp ( appName ) ;
509
+ await cleanupServiceModels ( ) ;
504
510
await deleteUnusedImages ( navigationBar ) ;
505
511
} ) ;
506
512
} ) ;
@@ -521,6 +527,9 @@ async function cleanupServiceModels(): Promise<void> {
521
527
async function stopAndDeleteApp ( appName : string ) : Promise < void > {
522
528
const aiRunningAppsPage = await aiLabPage . navigationBar . openRunningApps ( ) ;
523
529
await aiRunningAppsPage . waitForLoad ( ) ;
530
+ if ( ! ( await aiRunningAppsPage . appExists ( appName ) ) ) {
531
+ console . log ( `"${ appName } " is not present in the running apps list. Skipping stop and delete operations.` ) ;
532
+ }
524
533
await playExpect . poll ( async ( ) => await aiRunningAppsPage . appExists ( appName ) , { timeout : 10_000 } ) . toBeTruthy ( ) ;
525
534
await playExpect
526
535
. poll ( async ( ) => await aiRunningAppsPage . getCurrentStatusForApp ( appName ) , { timeout : 60_000 } )
0 commit comments